GithubHelp home page GithubHelp logo

pytorch-grad-cam's Introduction

中文 | English

使用 Pytorch 实现 Grad-CAM

Fork 自 pytorch-grad-cam README 和 代码注释均做了简单修改和翻译

是什么使神经网络认为图像是 'pug, pug-dog' 和 'tabby, tabby cat' :

Dog Cat

将 Grad-CAM 与 Guided Backpropagation 相结合的 'pug, pug-dog' 图片:

Combined

Gradient class activation maps 是一种深度学习网络的可视化技术。

原论文: https://arxiv.org/pdf/1610.02391v1.pdf

原论文作者的 torch 实现: https://github.com/ramprs/grad-cam

原 github 作者的 Keras 实现: https://github.com/jacobgil/keras-grad-cam


该程序使用 torchvisionVGG19. 在首次运行该程序的时候,将会自动下载预训练模型.

可以修改该该程序以使用其他模型. 但是,torchvisionVGG 模型的网络卷积部分和全连接部分有 features/classifier 方法. 该代码假定传入的 model 具有这两个方法. 若你的模型没有这两方法,那你就自己实现一下hhhh.


用法:

python gradcam.py --image-path <path_to_image>

使用 CUDA 的话请使用参数 --use-cuda:

python gradcam.py --image-path <path_to_image> --use-cuda

pytorch-grad-cam's People

Contributors

jacobgil avatar drryanhuang avatar ohjerm avatar josepdecid avatar mingloo avatar flyingpot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.