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

[scripts.saliency_interpretability] Allow user to explicitly define target to be analysed

parent be4a633c
No related branches found
No related tags found
1 merge request!12Adds grad-cam support on classifiers
......@@ -52,6 +52,17 @@ logger = setup(__name__.split(".")[0], format="%(levelname)s: %(message)s")
default="saliency-maps",
cls=ResourceOption,
)
@click.option(
"--target-label",
"-t",
help="""The target label that will be analysed. It must match the target
label that was used to generate the saliency maps provided with option
``--input-folder``. Samples with all other labels are ignored.""",
required=True,
type=click.INT,
default=1,
cls=ResourceOption,
)
@click.option(
"--output-json",
"-o",
......@@ -70,6 +81,7 @@ logger = setup(__name__.split(".")[0], format="%(levelname)s: %(message)s")
def saliency_interpretability(
datamodule,
input_folder,
target_label,
output_json,
**_,
) -> None:
......@@ -128,7 +140,7 @@ def saliency_interpretability(
datamodule.prepare_data()
datamodule.setup(stage="predict")
results = run(input_folder, datamodule)
results = run(input_folder, target_label, datamodule)
with output_json.open("w") as f:
logger.info(f"Saving output file to `{str(output_json)}`...")
......
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