rigvedrs / YOLO-V8-CAM

Wanna know what your model sees? Here's a package for applying EigenCAM on the new YOLO V8 model
MIT License
131 stars 26 forks source link

yolov8 classification not working. #4

Closed aiakash closed 1 year ago

aiakash commented 1 year ago

1051.9ms
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
[<ipython-input-12-215b2f43e8ca>](https://localhost:8080/#) in <cell line: 2>()
      1 cam = EigenCAM(model, target_layers,task='cls')
----> 2 grayscale_cam = cam(rgb_img)[0, :, :]
      3 cam_image = show_cam_on_image(img, grayscale_cam, use_rgb=True)
      4 plt.imshow(cam_image)
      5 plt.show()

8 frames
[/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/engine/results.py](https://localhost:8080/#) in __init__(self, data, orig_shape)
     30             orig_shape (tuple): Original shape of image.
     31         """
---> 32         assert isinstance(data, (torch.Tensor, np.ndarray))
     33         self.data = data
     34         self.orig_shape = orig_shape

AssertionError:
rigvedrs commented 1 year ago

Hi, were you able to solve the issue? This seems like an issue for the new version of ultralytics. I will try to fix it, but till then I recommend you to use ultralytics-8.0.107 or below if you want to use the package.