如何结合Grad-CAM进行mmdetection的特征可视化

AudioSeal 音频水印系统

AudioSeal 音频水印系统

语音合成
PyTorch
Cuda

**AudioSeal** 是 Meta 开源的语音水印系统,用于 AI 生成音频的检测和溯源。

在mmdetection的github项目中找到一些CAM的相关内容
How to generate the feature heat map of the detection network? #7989
[WIP] Support Grad Free and Grad Based CAM #7987

在这里插入图片描述在这里插入图片描述

如何 从 Pull Request 下载变更文件
1.访问的链接是一个 Pull Request(#7987)的文件差异页面。可以打开 PR 页面: → https://github.com/open-mmlab/mmdetection/pull/7987
2.点击 “Files changed” 标签页
3.找到需要下载的文件,点击右上角的 … → “View file”
4.在文件页面点击 “Raw” 按钮,再保存或下载

下载vis_cam.py和det_cam_visualizer.py,分别将其放在指定路径下。
在这里插入图片描述
在这里插入图片描述

踩坑记录

在这里插入图片描述
det_cam_visualizer.py文件中,由于版本更新,np.long换成np.int64,并且文件中的use_cuda 参数全部需要注释掉。否则执行vis_cam.py时会报错。

det_cam_visualizer.py 函数逐行解读记录

vis_cam.py 函数解读记录

使用方式

# FeatmapAM method
python demo/vis_cam.py demo/demo.jpg configs/retinanet/retinanet_r50_fpn_1x_coco.py retinanet_r50_fpn_1x_coco_20200130-c2398f9e.pth

# EigenCAM method
python demo/vis_cam.py demo/demo.jpg configs/retinanet/retinanet_r50_fpn_1x_coco.py retinanet_r50_fpn_1x_coco_20200130-c2398f9e.pth --method eigencam

# AblationCAM method
python demo/vis_cam.py demo/demo.jpg configs/retinanet/retinanet_r50_fpn_1x_coco.py retinanet_r50_fpn_1x_coco_20200130-c2398f9e.pth --method ablationcam

# AblationCAM method and save img
python demo/vis_cam.py demo/demo.jpg configs/retinanet/retinanet_r50_fpn_1x_coco.py retinanet_r50_fpn_1x_coco_20200130-c2398f9e.pth --method ablationcam --out-dir save_dir

# GradCAM
python demo/vis_cam.py demo/demo.jpg configs/retinanet/retinanet_r50_fpn_1x_coco.py retinanet_r50_fpn_1x_coco_20200130-c2398f9e.pth --method gradcam

您可能感兴趣的与本文相关的镜像

AudioSeal 音频水印系统

AudioSeal 音频水印系统

语音合成
PyTorch
Cuda

**AudioSeal** 是 Meta 开源的语音水印系统,用于 AI 生成音频的检测和溯源。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值