Spaces:
Running
Running
Commit
·
2cd21c1
1
Parent(s):
1ee51c9
Fix:update access lyrs.
Browse files
app.py
CHANGED
@@ -75,8 +75,10 @@ def process_image(image, yolo_versions=["yolov5"]):
|
|
75 |
for yolo_version in yolo_versions:
|
76 |
# Load the model based on YOLO version
|
77 |
model = load_yolo_model(yolo_version)
|
78 |
-
|
79 |
-
|
|
|
|
|
80 |
# Run YOLO detection
|
81 |
results = model([rgb_img])
|
82 |
boxes, colors, names = parse_detections(results)
|
|
|
75 |
for yolo_version in yolo_versions:
|
76 |
# Load the model based on YOLO version
|
77 |
model = load_yolo_model(yolo_version)
|
78 |
+
if yolo_version == "yolov5":
|
79 |
+
target_layers = [model.model.model.model[-2]] # Assumes last layer is used for Grad-CAM
|
80 |
+
else:
|
81 |
+
target_layers = [model.model[-2]]
|
82 |
# Run YOLO detection
|
83 |
results = model([rgb_img])
|
84 |
boxes, colors, names = parse_detections(results)
|