Skip to content
Snippets Groups Projects
Commit 4d6e9c13 authored by André Anjos's avatar André Anjos :speech_balloon: Committed by Daniel CARRON
Browse files

[saliencymap_evaluator] Improve TODO comments with more ideas

parent 982404c9
No related branches found
No related tags found
1 merge request!12Adds grad-cam support on classifiers
...@@ -93,8 +93,6 @@ def _extract_bounding_box( ...@@ -93,8 +93,6 @@ def _extract_bounding_box(
* width (pixels) * width (pixels)
* height (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, :])[ x, y, x2, y2 = torchvision.ops.masks_to_boxes(torch.tensor(mask)[None, :])[
0 0
] ]
...@@ -330,14 +328,15 @@ def run( ...@@ -330,14 +328,15 @@ def run(
retval: dict[str, list[typing.Any]] = {} 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(): for dataset_name, dataset_loader in datamodule.predict_dataloader().items():
logger.info( logger.info(
f"Estimating interpretability metrics for dataset `{dataset_name}`..." f"Estimating interpretability metrics for dataset `{dataset_name}`..."
) )
retval[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( for sample in tqdm(
dataset_loader, desc="batches", leave=False, disable=None dataset_loader, desc="batches", leave=False, disable=None
): ):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment