源码地址:https://github.com/jacobgil/pytorch-grad-cam
首先要安装一个包:
pip install grad-cam -i https://pypi.tuna.tsinghua.edu.cn/simple
源代码如下:
# pip install grad-cam -i https://pypi.tuna.tsinghua.edu.cn/simple
import warnings
warnings.filterwarnings('ignore'