Spaces:
Sleeping
Sleeping
dont know
Browse files
app.py
CHANGED
@@ -15,8 +15,14 @@ path = [['img/test-image.jpg'], ['img/test-image-2.jpg']]
|
|
15 |
|
16 |
def show_preds_image(image_path):
|
17 |
image = cv2.imread(image_path)
|
18 |
-
|
19 |
-
results
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
for i, det in enumerate(results.boxes.xyxy):
|
21 |
cv2.rectangle(
|
22 |
image,
|
|
|
15 |
|
16 |
def show_preds_image(image_path):
|
17 |
image = cv2.imread(image_path)
|
18 |
+
results = model(image_path)
|
19 |
+
results.xyxy[0] # img1 predictions (tensor)
|
20 |
+
results.pandas().xyxy[0] # img1 predictions (pandas)
|
21 |
+
predictions = results.pred[0]
|
22 |
+
boxes = predictions[:, :4] # x1, y1, x2, y2
|
23 |
+
scores = predictions[:, 4]
|
24 |
+
categories = predictions[:, 5]
|
25 |
+
|
26 |
for i, det in enumerate(results.boxes.xyxy):
|
27 |
cv2.rectangle(
|
28 |
image,
|