ODAM is a straightforward and easy-to-implement method to generate visual explanation heat maps for predictions of object detection. The framework and results are shown here:
ODAM is easy to be applied on different detector architectures. Here is an example:
- Detector: FCOS
- Data: MS COCO val2017
- Demo for one image: Demo_ODAM ; Demo based on DETR minimal implementation: Demo_ODAM_detr
Steps to save heat maps and evaluation:
-
The path of the dataset is set in
config_coco.py
. -
Download the fcos detector model and put into the folder
./model/fcos_regular/coco_model/
; faster rcnn detector model and put into the folder./model/rcnn_regular/coco_model/
. -
cd tools
-
Saving heat maps for high-quality predictions
- Saving ODAM explanation maps:
python savefig_odam.py -md fcos_regular -r 12
- Saving D-RISE explanation maps:
python savefig_drise.py -md fcos_regular -r 12
- Evaluation of ODAM and D-RISE:
- Point Game
python eval_pointgame.py -md fcos_regular -t odam
- Visual Explanation Accuracy (Mask IoU)
python eval_mask_IoU.py -md fcos_regular -t odam
- ODI
python eval_odi.py -md fcos_regular -t odam
- Deletion
python eval_delet.py -md fcos_regular -r 12 -t odam
- Insertion
python eval_insert.py -md fcos_regular -r 12 -t odam
Train and test on CrowdHuman dataset, the data path is set in config_crowdhuman.py
.
- For train, download the initial weights, and the path is set in
config_crowdhuman.py
, then run:
cd tools
python train_crowdhuman.py -md fcos_odamTrain
- For test, download the fcos model and put into the folder
./model/fcos_odamTrain/outputs/
and faster rcnn model to./model/rcnn_odamTrain/outputs/
. The NMS method choosing option is set inconfig_crowdhuman.py
, then run:
cd tools
python test_crowdhuman.py -md fcos_odamTrain -r 30
If you use the code in your research, please cite:
@inproceedings{chenyangodam,
title={ODAM: Gradient-based Instance-Specific Visual Explanations for Object Detection},
author={Chenyang, ZHAO and Chan, Antoni B},
booktitle={The Eleventh International Conference on Learning Representations},
month = {May},
year = {2023}
}
If you have any questions, please do not hesitate to contact Chenyang ZHAO (zhaocy2333@gmail.com).