Spaces:
Running
Running
Commit
·
43bd3f4
1
Parent(s):
200f76c
Debug: yolov8 target lyr
Browse files
yolov8.py
CHANGED
@@ -48,7 +48,7 @@ def xai_yolov8(image):
|
|
48 |
image_tensor = torch.tensor(np.array(image)).permute(2, 0, 1).unsqueeze(0).float() / 255.0
|
49 |
image_tensor = image_tensor.to('cpu')
|
50 |
print(model.model) # Output model layers to find the target layer
|
51 |
-
grad_cam = GradCAM(model.model, target_layer='model.model
|
52 |
|
53 |
# Perform Grad-CAM
|
54 |
cam_map = grad_cam(image_tensor)
|
|
|
48 |
image_tensor = torch.tensor(np.array(image)).permute(2, 0, 1).unsqueeze(0).float() / 255.0
|
49 |
image_tensor = image_tensor.to('cpu')
|
50 |
print(model.model) # Output model layers to find the target layer
|
51 |
+
grad_cam = GradCAM(model.model, target_layer='model.model[-1]')
|
52 |
|
53 |
# Perform Grad-CAM
|
54 |
cam_map = grad_cam(image_tensor)
|