I have a problem with an XAI Task; i have a pretrained model with
YOLOV8n
and i want to use my .pt model to evaluate and detect a random image from my dataset.I just want to detect objects in my image and avoid to start an auto train with 100 epochs; although i put my model in
.eval()
mode, a 100 epochs train starts…Once i made this detection and defined my target layers to create the EigenCAM heatmap, I try to call the EigenCAM method and here also the train starts, can somebody help me with this issue?
I’m following this tutorial (with YOLOv5) and all things works perfectly with this architecture….
https://jacobgil.github.io/pytorch-gradcam-book/EigenCAM%20for%20YOLO5.html
this is my pretrained model definition and root
my_model = YOLO("/root/train_w_YOLOv8n/weights/best.pt")
my_model.eval()
my_model.cpu()
This is the layers structure i want to access and use in EigenCAM method:
[C2f(
(cv1): Conv(
(conv): Conv2d(384, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(384, 256, kernel_size=(1, 1), stride=(1, 1))
(act): SiLU(inplace=True)
)
(m): ModuleList(
(0): Bottleneck(
(cv1): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
(cv2): Conv(
(conv): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act): SiLU(inplace=True)
)
)
)
)]
That’s the EigenCAM method call:
cam = EigenCAM(my_model, target_layers)
grayscale_cam = cam(tensor)[0, :, :]
cam_image = show_cam_on_image(img, grayscale_cam, use_rgb=True)
Image.fromarray(cam_image)
Here starts the training…
VS console image
I just want to detect objects in my image and avoid to start an auto train with 100 epochs; although i put my model in .eval() mode, a 100 epochs train starts…
Once i made this detection and defined my target layers to create the EigenCAM heatmap, I try to call the EigenCAM method and here also the train starts, can somebody help me with this issue?
I’m following this tutorial (with YOLOv5) and all things works perfectly with this architecture….
https://jacobgil.github.io/pytorch-gradcam-book/EigenCAM%20for%20YOLO5.html
Enrico Piergallini is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.