From 257f53a8aa5a8eb38dd0e8d7bc176f0ff1852d2d Mon Sep 17 00:00:00 2001 From: dcarron <daniel.carron@idiap.ch> Date: Mon, 29 Jan 2024 12:03:44 +0100 Subject: [PATCH] [doc] Doc fixes --- src/mednet/config/data/montgomery/datamodule.py | 1 - src/mednet/engine/saliency/completeness.py | 10 ++++++++++ src/mednet/engine/saliency/generator.py | 14 +++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/mednet/config/data/montgomery/datamodule.py b/src/mednet/config/data/montgomery/datamodule.py index edb2cd71..e2454827 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 c9a961f7..6d9cf7b2 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 72b53d51..6ce13812 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 -- GitLab