Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAM Mask Shape #27

Open
oseymour opened this issue Jan 28, 2025 · 0 comments
Open

CAM Mask Shape #27

oseymour opened this issue Jan 28, 2025 · 0 comments

Comments

@oseymour
Copy link

Hello! I'm encountering the following error:

ValueError
This cell raised an exception: ValueError('operands could not be broadcast together with shapes (982,748,3) (748,982,3) ')

Here's my code:

<relevant imports here>

model = YOLO(<path to torch file>)

target_layers = [model.model.model[-2]]

cam = EigenCAM(model, target_layers, task="cls")
grayscale_cam = cam(
    frame,
    eigen_smooth=True,
)[0, :, :]

cam_image = show_cam_on_image(frame / 255, grayscale_cam, use_rgb=True)
plt.figure()
plt.imshow(cam_image)
plt.show()

My input, frame, has the correct dimensions of (784, 982, 3). When I view the CAM mask on it's own it has the right orientation but the dimensions are not correct. When I try transposing it, the dimensions match but then the orientation is not correct.

For now I'll just resize the CAM mask but I thought you might want to know the output dimensions are not correct.

Let me know if you want my input files or any other info to debug this. It's a project at work so I can't share all details but I can try to find public data that replicates my issue.

Thank you! Your repo is meeting my exact needs!

@oseymour oseymour changed the title CM Mask Shape CAM Mask Shape Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant