Git Product home page Git Product logo

Comments (5)

jacobgil avatar jacobgil commented on May 21, 2024

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.

chengengliu avatar chengengliu commented on May 21, 2024

@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.

avijit9 avatar avijit9 commented on May 21, 2024

@chengengliu Have you figured this out?

from pytorch-grad-cam.

ZziTaiLeo avatar ZziTaiLeo commented on May 21, 2024

@chengengliu Have you figured this out?

I have same quetion about grad-cam used for video recognition.

from pytorch-grad-cam.

chengengliu avatar chengengliu commented on May 21, 2024

@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)

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.