diff --git a/src/mednet/config/data/montgomery/datamodule.py b/src/mednet/config/data/montgomery/datamodule.py index edb2cd7137631c9de70c559c863f3d87a3cfc2ec..e245482718fd8ba3f84641f10000fe26cf2fc12b 100644 --- a/src/mednet/config/data/montgomery/datamodule.py +++ b/src/mednet/config/data/montgomery/datamodule.py @@ -48,7 +48,6 @@ class RawDataLoader(_BaseRawDataLoader): where to find the image to be loaded, and an integer, representing the sample label. - Returns ------- The sample representation. diff --git a/src/mednet/engine/saliency/completeness.py b/src/mednet/engine/saliency/completeness.py index c9a961f7fe6d52ec3c65526fe6347485078671ac..6d9cf7b25b27d64f26f9e97507e791788ca301ca 100644 --- a/src/mednet/engine/saliency/completeness.py +++ b/src/mednet/engine/saliency/completeness.py @@ -68,6 +68,7 @@ def _calculate_road_scores( Returns ------- + tuple[float, float, float] A 3-tuple containing floating point numbers representing the most-relevant-first average score (``morf``), least-relevant-first average score (``lerf``) and the combined value (``(lerf-morf)/2``). @@ -143,6 +144,15 @@ def _process_sample( A sequence of percentiles (percent x100) integer values indicating the proportion of pixels to perturb in the original image to calculate both MoRF and LeRF scores. + + Returns + ------- + list + A list containing the following items for a particular sample: + * The relative path to the sample. + * The label. + * An index to the specified target_class. + * The computed ROAD scores. """ name: str = sample[1]["name"][0] diff --git a/src/mednet/engine/saliency/generator.py b/src/mednet/engine/saliency/generator.py index 72b53d5131580575787d119c12faed6f4999045d..6ce13812686206e18a200f2b99a1bf87cc4f5c5f 100644 --- a/src/mednet/engine/saliency/generator.py +++ b/src/mednet/engine/saliency/generator.py @@ -24,7 +24,19 @@ def _create_saliency_map_callable( target_layers: list[torch.nn.Module] | None, use_cuda: bool, ): - """Creates a class activation map (CAM) instance for a given model.""" + """Creates a class activation map (CAM) instance for a given model. + + Parameters + ---------- + algo_type + The algorithm to use for saliency map estimation. + model + Neural network model (e.g. pasa). + target_layers + The target layers to compute CAM for. + use_cuda + Whether to use cuda or not. + """ import pytorch_grad_cam