From 4d6e9c13dc59f0394e24895f8ab970033f2eb91a Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Sat, 7 Oct 2023 14:06:54 +0200 Subject: [PATCH] [saliencymap_evaluator] Improve TODO comments with more ideas --- src/ptbench/engine/saliencymap_evaluator.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ptbench/engine/saliencymap_evaluator.py b/src/ptbench/engine/saliencymap_evaluator.py index 7871cefb..9a5fc156 100644 --- a/src/ptbench/engine/saliencymap_evaluator.py +++ b/src/ptbench/engine/saliencymap_evaluator.py @@ -93,8 +93,6 @@ def _extract_bounding_box( * width (pixels) * height (pixels) """ - # opencv implementation: - # x, y, w, h = cv2.boundingRect(mask.astype(numpy.uint8)) x, y, x2, y2 = torchvision.ops.masks_to_boxes(torch.tensor(mask)[None, :])[ 0 ] @@ -330,14 +328,15 @@ def run( retval: dict[str, list[typing.Any]] = {} + # TODO: This loads the images from the dataset, but they are not useful at + # this point. Possibly using the contents of ``datamodule.splits`` can + # substantially speed this up. for dataset_name, dataset_loader in datamodule.predict_dataloader().items(): logger.info( f"Estimating interpretability metrics for dataset `{dataset_name}`..." ) retval[dataset_name] = [] - # TODO: This loads the images from the dataset, but they are not useful at - # this point... for sample in tqdm( dataset_loader, desc="batches", leave=False, disable=None ): -- GitLab