mapreader.process.occlusion_analysis ==================================== .. py:module:: mapreader.process.occlusion_analysis Classes ------- .. autoapisummary:: mapreader.process.occlusion_analysis.OcclusionAnalyzer Module Contents --------------- .. py:class:: OcclusionAnalyzer(patch_df, model, transform = 'default', delimiter = ',', device = 'default') A class for carrying out occlusion analysis on patches. :param patch_df: The DataFrame containing patches and predictions. :type patch_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path :param model: The PyTorch model to add to the object. If a string, this should be the path to a model checkpoint. :type model: str or nn.Module :param transform: The transform to apply to the patches. Options of "default" or a torchvision transform. Default transform :type transform: str or callable :param delimiter: The delimiter used in the patch_df csv file. By default, ",". :type delimiter: str :param device: The device to use. By default, "default". :type device: str .. py:attribute:: loss_fn :value: None .. py:method:: add_loss_fn(loss_fn = 'cross entropy') Add a loss function to the object. :param loss_fn: The loss function to use. Can be a string or a torch.nn loss function. Accepted string values are "cross entropy" or "ce" (cross-entropy), "bce" (binary cross-entropy) and "mse" (mean squared error). By default, "cross entropy" is used. :type loss_fn: str or torch.nn.modules.loss._Loss .. py:method:: run_occlusion(label, sample_size = 10, save = False, path_save = './occlusion_analysis/', block_size = 14) Run occlusion analysis on a sample of patches for a given label. :param label: The label to run the analysis on. :type label: str :param sample_size: The number of patches to run the analysis on. By default, 10. :type sample_size: int :param save: Whether to save the occlusion analysis images. By default, False. :type save: bool :param path_save: The path to save the occlusion analysis images to. By default, "./occlusion_analysis/". :type path_save: str :param block_size: The size of the occlusion block. By default, 14. :type block_size: int