opengenome.outputs ================== .. py:module:: opengenome.outputs Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/opengenome/outputs/cnn/index Functions --------- .. autoapisummary:: opengenome.outputs.viz Package Contents ---------------- .. py:function:: viz(layer_num: int, img_path: str, model: Any, classes: List[str | int | float], device: str) -> None Display a visualization of CNN feature map Display convolutional neural network CNN feature maps of specified ``layer`` given ``image path`` and ``model``. :param layer_num: Layer number of CNN to visualize. :type layer_num: int :param img_path: Path to input image. :type img_path: str :param model: PyTorch CNN model :param device: Device to run inference on exp. ``cuda:0`` or ``cpu`` :type device: str .. rubric:: Examples >>> from opengenome.outputs.cnn import viz >>> import torch >>> from torchvision.models import vgg16, VGG16_Weights >>> DEVICE = 'cuda:0' if torch.cuda.is_available() else 'cpu' >>> with open("VGG16_CLASSES.txt", 'r') as f: >>> classes = f.readlines() >>> model = vgg16(weights=VGG16_Weights.DEFAULT) >>> model = model.to(DEVICE) >>> img_car = r"PATH_TO_IMAGE" >>> viz(10, img_car, model, classes, DEVICE)