Comments (5)
Hi,
Currently there is no support for running on a batch of images - it accepts a single image of size 1, 3, H, W (3 is color channel)
You will have to get the cam for every member of the batch separately.
For example, if the batch size is B, T, 3, C, H, W,
# input tensor is x
# i goes over the batch dimension
for i in range(x.size(0)):
# j goes over the T dimension
for j in range(x.size(1)):
cam_grayscale = cam(input_tensor=x[i, j, :, :].unsqueeze(0),
method="gradcam",
target_category=target_category)
from pytorch-grad-cam.
@jacobgil HI Jacob,
if the input of the model is a clip of images with T as number of images in one clip, which other parts of Grad-Cam should be modified? I noticed that in base_cam
, img
is resized according to input tensor shape, which means that resizing will not work under this situation.
from pytorch-grad-cam.
@chengengliu Have you figured this out?
from pytorch-grad-cam.
@chengengliu Have you figured this out?
I have same quetion about grad-cam used for video recognition.
from pytorch-grad-cam.
@chengengliu Have you figured this out?
I have same quetion about grad-cam used for video recognition.
Hi Leo, sorry for the late reply. Iām sorry I cannot remember the details about how to use it since I did the project two years ago; but yes it is doable, I managed to use it frame by frame, so each image is saved with its CAM concatenation. Maybe try to change the input shape or something. The main flow would be the same.
Hope it will help you.
from pytorch-grad-cam.
Related Issues (20)
- gradcam for binary segmentaion network
- Installation showing missing requirements.txt
- Model improvement HOT 1
- GradCAM throws error for models that give ClassifierOutput class as model output instead of tensors
- How to Generate Attention Graphs on Custom Models ?
- Memory leakage during multiple loss calculations HOT 1
- What is the different colors mean? HOT 3
- AttributeError: 'AblationLayer' object has no attribute 'f' HOT 1
- Problem generating CAMs using the saved model HOT 2
- [Q] Are CAMs generated using the output of the specified layer or its input? HOT 2
- How to extract cam during training without creating issues to the bakpropagation HOT 1
- help me!!!thank you AttributeError: 'function' object has no attribute 'register_forward_hook'
- the example in README need to update HOT 1
- How should I assign a value to the "targets" when I draw the heatmap of yolov8-pose?
- float16 is not supported (src data type = 23 is not supported)
- YOLOv5 2021-10-21 torch 2.0.1+cpu CPU Fusing layers... Model Summary: 213 layers, 7225885 parameters, 0 gradients Adding AutoShape... Traceback (most recent call last): File "E:\yolov5-v6.1\yolov5ēåå¾.py", line 70, in <module> print(model.model.model.model[-2]) File "D:\anaconda\envs\fastapi\lib\site-packages\torch\nn\modules\module.py", line 1614, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Sequential' object has no attribute 'model'
- Mismatch in the number of attribution slices for 3D volume Torch tensor
- How can I use gradcam for Contrastive Unsupervised Representations (CURL), one of the methods for reinforcement learning?
- How to use Grad-CAM in segmetnt angthing model
- Grad CAM for multiple input arguments
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-grad-cam.