• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

meliketoy/gradcam.pytorch: Pytorch Implementation of Visual Explanations from De ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

meliketoy/gradcam.pytorch

开源软件地址(OpenSource Url):

https://github.com/meliketoy/gradcam.pytorch

开源编程语言(OpenSource Language):

Python 98.9%

开源软件介绍(OpenSource Introduction):


This is the repository for Pytorch Implementation of "Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization". If you have any issues regarding this repository, please contact [email protected].

You can see the original paper here

Modules

Requirements

See the installation instruction for a step-by-step installation guide. See the server instruction for server settup.

pip install http://download.pytorch.org/whl/cu80/torch-0.1.12.post2-cp27-none-linux_x86_64.whl
pip install torchvision
git clone https://github.com/meliketoy/gradcam.pytorch

Grad-CAM

"Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization".

alt_tag

In this repo, we will be training and testing the model with a very simple, cat vs dog dataset. You can view and download the dataset yourself by clicking the link above.

Implementation on your own private data only requires modifications in the directory within the configuration files inside each modules.

STEP 1 : Data preperation

You can prepare your data with the preprocessing module. In the configuration file, set the directory to the directory containing the training data.

As we are fine-tuning the model, we will only be taking a small portion of the original training set.

$ cd ./1_preprocessor
$ python main

> Enter mode name : split # This will make a train-validation split in your 'split_dir' in config.py
> Enter mode name : check # This will print out the distribution of your split.
> Enter mode name : meanstd # This will print out the meanstd value of your train set.

Copy the value of meanstd in the third line, and paste it in the configurations of each module 3 and module 4. View the README-preprocessor for further instructions.

STEP 2 : Classification

Then, in the classifier module, run the line below

$ ./scripts/train/resnet

This will fine-tune a pre-trained resnet-50 model on your dataset. To train your network on different models & layers, view the scripts. See README-classifier for further instructions.

STEP 3 : Detection

After you have trained your model, there will be a model saved in the checkpoint directory. The files in directory will be automatically updated in the detector module, searched by the directory name of your training set.

In the configuration of module 4, match the 'name' variable identical to the 'name' you used in your classification training data directory name.

The heatmap generation for each of the test data can be done by running,

$ ./scripts/detect.sh

This will generate a heatmap which will look like

Attention for cat

alt-text-1 alt-text-2

Attention for dog

alt-text-1 alt-text-2

See README-detector for further instructions.

FUTURE WORKS : Semi-supervised Object Detection

This strategy could be used as a method to perform semi-supervised detection, a detection learning when only given the classification label and not any local annotations.

Implementation on luekocyte detection(which I submitted a paper on) will look like, alt_tag

If you want to change the model configuration, see the script or the configuration file




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap