All Projects → frgfm → Torch Cam

frgfm / Torch Cam

Licence: mit
Class activation maps for your PyTorch models (CAM, Grad-CAM, Grad-CAM++, Smooth Grad-CAM++, Score-CAM, SS-CAM, IS-CAM, XGrad-CAM)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Torch Cam

Flashtorch
Visualization toolkit for neural networks in PyTorch! Demo -->
Stars: ✭ 561 (+125.3%)
Mutual labels:  cnn, interpretability
Text nn
Text classification models. Used a submodule for other projects.
Stars: ✭ 55 (-77.91%)
Mutual labels:  cnn, interpretability
Cnn Interpretability
🏥 Visualizing Convolutional Networks for MRI-based Diagnosis of Alzheimer’s Disease
Stars: ✭ 68 (-72.69%)
Mutual labels:  cnn, interpretability
Srgan
Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
Stars: ✭ 2,641 (+960.64%)
Mutual labels:  cnn
Pyconv
Pyramidal Convolution: Rethinking Convolutional Neural Networks for Visual Recognition (https://arxiv.org/pdf/2006.11538.pdf)
Stars: ✭ 231 (-7.23%)
Mutual labels:  cnn
Pytorch Sentiment Analysis
Tutorials on getting started with PyTorch and TorchText for sentiment analysis.
Stars: ✭ 3,209 (+1188.76%)
Mutual labels:  cnn
Four flower
使用tensorflow和cnn做的图像识别,对四种花进行了分类。
Stars: ✭ 244 (-2.01%)
Mutual labels:  cnn
Natural Language Processing With Tensorflow
Natural Language Processing with TensorFlow, published by Packt
Stars: ✭ 222 (-10.84%)
Mutual labels:  cnn
Lightnet
Efficient, transparent deep learning in hundreds of lines of code.
Stars: ✭ 243 (-2.41%)
Mutual labels:  cnn
Image Compression Cnn
Semantic JPEG image compression using deep convolutional neural network (CNN)
Stars: ✭ 237 (-4.82%)
Mutual labels:  cnn
Cnn Text Classification Tf Chinese
CNN for Chinese Text Classification in Tensorflow
Stars: ✭ 237 (-4.82%)
Mutual labels:  cnn
Ai Toolbox
Algorithm Engineer Toolbox, for the purpose of quickly iterating new ideas
Stars: ✭ 230 (-7.63%)
Mutual labels:  cnn
Gordon cnn
A small convolution neural network deep learning framework implemented in c++.
Stars: ✭ 241 (-3.21%)
Mutual labels:  cnn
Tengine
Tengine is a lite, high performance, modular inference engine for embedded device
Stars: ✭ 4,012 (+1511.24%)
Mutual labels:  cnn
Dfl Cnn
This is a pytorch re-implementation of Learning a Discriminative Filter Bank Within a CNN for Fine-Grained Recognition
Stars: ✭ 245 (-1.61%)
Mutual labels:  cnn
Person Attribute Recognition Marketduke
A simple baseline implemented in PyTorch for pedestrian attribute recognition task, evaluating on Market-1501 and DukeMTMC-reID dataset.
Stars: ✭ 224 (-10.04%)
Mutual labels:  cnn
Caption generator
A modular library built on top of Keras and TensorFlow to generate a caption in natural language for any input image.
Stars: ✭ 243 (-2.41%)
Mutual labels:  cnn
Convolution network on fpga
CNN acceleration on virtex-7 FPGA with verilog HDL
Stars: ✭ 236 (-5.22%)
Mutual labels:  cnn
Text classification ai100
AI100文本分类竞赛代码。从传统机器学习到深度学习方法的测试
Stars: ✭ 235 (-5.62%)
Mutual labels:  cnn
Hierarchical Attention Networks Pytorch
Hierarchical Attention Networks for document classification
Stars: ✭ 239 (-4.02%)
Mutual labels:  cnn

Torchcam: class activation explorer

License Codacy Badge Build Status codecov Docs Pypi

Simple way to leverage the class-specific activation of convolutional layers in PyTorch.

gradcam_sample

Table of Contents

Getting started

Prerequisites

  • Python 3.6 (or more recent)
  • pip

Installation

You can install the package using pypi as follows:

pip install torchcam

or using conda:

conda install -c frgfm torchcam

Usage

Torchcam was built both for users wishing to get a better understanding of their CNN models, and for researchers to enjoy a strong implementation base with popular methods. Here is a short snippet illustrating its usage:

import torch
from torchcam.cams import SmoothGradCAMpp
from torchvision.models import resnet18

img_tensor = torch.rand((1, 3, 224, 224))
model = resnet18(pretrained=True).eval()
# Hook your model before the forward pass
cam_extractor = SmoothGradCAMpp(model)
# By default the last conv layer will be selected
out = model(img_tensor)
# Retrieve the CAM
activation_map = cam_extractor(out.squeeze(0).argmax().item(), out)

Alternatively, you can use the example script like below to retrieve the CAM of a specific class on a resnet architecture.

python scripts/cam_example.py --model resnet18 --class-idx 232

gradcam_sample

Documentation

The full package documentation is available here for detailed specifications. The documentation was built with Sphinx using a theme provided by Read the Docs.

Contributing

Please refer to CONTRIBUTING if you wish to contribute to this project.

Credits

This project is developed and maintained by the repo owner, but the implementation was based on the following precious papers:

License

Distributed under the MIT License. See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].