딥러닝

[MMdetection] Grad-CAM

승무_ 2022. 9. 24. 22:07

1. grad-cam 설치

!pip install grad-cam

2. 파일 추가

https://github.com/open-mmlab/mmdetection/pull/7987

 

[WIP] Support Grad Free and Grad Based CAM by hhaAndroid · Pull Request #7987 · open-mmlab/mmdetection

We support cam visualization in mmdet. Currently, I have tested RetinaNet, Faster RCNN, Mask RCNN and YOLOX. Currently grad_free and grad_based methods are supported as shown below: GRAD_FREE_METHO...

github.com

demo/vis_cam.py

mmdet/utils/det_cam_visualizer.py

3. assert 삭제

demo/vis_cam.py

assert args.no_norm_in_bbox is False, 'If not norm in bbox, the ' \'visualization result ' \'may not be reasonable.'
 

4. python 실행

!python /content/mmdetection/demo/vis_cam.py /content/drive/MyDrive/12.jpg /content/mmdetection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py /content/drive/MyDrive/epoch_24.pth --no-norm-in-bbox --method gradcam --out-dir /content/sample_data

'딥러닝' 카테고리의 다른 글

Intra-class distance  (0) 2022.10.25
[COCO] 데이터 확인  (1) 2022.10.04
[MMdetection] AP for each class  (0) 2022.09.21
[MMdetection] samples_per_gpu  (0) 2022.09.16
convert_to_coco  (0) 2022.09.14