Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ def process_video(video):
|
|
| 40 |
x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
|
| 41 |
class_id = int(box.cls[0]) # Class index for YOLO
|
| 42 |
# Use model's built-in class names
|
| 43 |
-
label = f"
|
| 44 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
| 45 |
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
| 46 |
|
|
@@ -51,7 +51,7 @@ def process_video(video):
|
|
| 51 |
x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
|
| 52 |
class_id = int(box.cls[0]) # Class index for best.pt
|
| 53 |
# Use model's built-in class names for best.pt
|
| 54 |
-
label = f"
|
| 55 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (255, 0, 0), 2)
|
| 56 |
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (255, 0, 0), 2)
|
| 57 |
|
|
|
|
| 40 |
x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
|
| 41 |
class_id = int(box.cls[0]) # Class index for YOLO
|
| 42 |
# Use model's built-in class names
|
| 43 |
+
label = f"{model_yolo11.names[class_id]} - {box.conf[0]:.2f}"
|
| 44 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
| 45 |
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
| 46 |
|
|
|
|
| 51 |
x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
|
| 52 |
class_id = int(box.cls[0]) # Class index for best.pt
|
| 53 |
# Use model's built-in class names for best.pt
|
| 54 |
+
label = f"{model_best.names[class_id]} - {box.conf[0]:.2f}"
|
| 55 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (255, 0, 0), 2)
|
| 56 |
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (255, 0, 0), 2)
|
| 57 |
|