Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,7 +76,8 @@ def detect_objects(image_path):
|
|
| 76 |
def draw_bounding_boxes(img, results):
|
| 77 |
for (x1, y1, x2, y2), conf, cls in results:
|
| 78 |
x1, y1, x2, y2, cls = map(int, [x1, y1, x2, y2, cls])
|
| 79 |
-
|
|
|
|
| 80 |
cv2.rectangle(img, (x1, y1), (x2, y2), (255, 0, 0), 2)
|
| 81 |
cv2.putText(img, f'{model.names[int(cls)]} {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
|
| 82 |
return img
|
|
|
|
| 76 |
def draw_bounding_boxes(img, results):
|
| 77 |
for (x1, y1, x2, y2), conf, cls in results:
|
| 78 |
x1, y1, x2, y2, cls = map(int, [x1, y1, x2, y2, cls])
|
| 79 |
+
conf = conf.detatch().item()
|
| 80 |
+
print("results in draw_bounding box:",[(x1, y1, x2, y2), conf, cls])
|
| 81 |
cv2.rectangle(img, (x1, y1), (x2, y2), (255, 0, 0), 2)
|
| 82 |
cv2.putText(img, f'{model.names[int(cls)]} {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
|
| 83 |
return img
|