We assume the $PWD
is path/to/InputIBA/
in the following tutorials.
Experiments of this part require an addition json file that records the
predicted probability of the ground truth class of each image. We use it to
filter out the samples that have low confidence on target class. For the small
ImageNet dataset downloaded from the aforementioned link, we also provided
a json file here. One can also obtain the json
file by running:
python tools/vision/get_target_scores.py configs/vgg_imagenet.py workdirs/vgg_imagenet/target_scores/ target_scores.json
.
If using our provided json file, copy the file from resources
to
workdirs
by mkdir workdirs/vgg_imagenet/target_scores/ && cp resources/target_scores.json workdirs/vgg_imagenet/target_scores/
- Assume the
workdirs/vgg_imagenet/input_masks/
contains the final attribution maps. Run:
python tools/vision/sanity_check.py \
configs/sanity_check.py \
workdirs/vgg_imagenet/input_masks/ \
workdirs/vgg_imagenet/sanity_check/ \
vgg_sanity_check.json \
--scores-file workdirs/vgg_imagenet/target_scores/target_scores.json
- Check results in
workdirs/vgg_imagenet/sanity_check/
- Run
python tools/vision/insertion_deletion.py \
configs/vgg_imagenet.py \
workdirs/vgg_imagenet/input_masks/ \
workdirs/vgg_imagenet/insertion_deletion/ \
vgg_insertion_deletion.json \
--scores-file workdirs/vgg_imagenet/target_scores/target_scores.json \
--sigma 15 \
--num-samples 2000
- Check results in
workdirs/vgg_imagenet/insertion_deletion
.
- Run
python tools/vision/sensitivity_n.py \
configs/vgg_imagenet.py \
workdirs/vgg_imagenet/input_masks/ \
workdirs/vgg_imagenet/sensitivity_n/ \
vgg_sensitivity_n.json \
--scores-file workdirs/vgg_imagenet/target_scores/target_scores.json \
--num-masks 100 \
--num-samples 1000
- Check results in
workdirs/vgg_imagenet/sensitivity_n/
.
- Run
python tools/vision/evaluate_ehr.py \
configs/vgg_imagenet.py \
workdirs/vgg_imagenet/input_masks/ \
workdirs/vgg_imagenet/ehr/ \
vgg_ehr.json \
--weight \
--scores-file workdirs/vgg_imagenet/target_scores/target_scores.json \
- Check the files in
workdirs/vgg_imagenet/ehr/
.
Assume workdirs/lstm_imdb/input_masks/
stores the final attribution maps.
- Run:
python tools/nlp/nlp_insertion_deletion.py \
configs/deep_lstm.py \
workdirs/lstm_imdb/input_masks/ \
workdirs/lstm_imdb/insertion_deletion/ \
lstm_insertion_deletion.json
- Check the results in
workdirs/lstm_imdb/insertion_deletion/
.
- Run:
python tools/nlp/nlp_sensitivity_n.py \
configs/deep_lstm.py \
workdirs/lstm_imdb/input_masks/ \
workdirs/lstm_imdb/sensitivity_n/ \
lstm_sensitivity_n.json \
--num-masks 100
- Check the results in
work_dirs/lstm_imdb/sensitivity_n/
.