Spaces:
Sleeping
Sleeping
Update common_detection.py
Browse files- common_detection.py +5 -2
common_detection.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
# common_detection.py
|
2 |
import cv2
|
3 |
import numpy as np
|
4 |
from PIL import Image
|
@@ -21,9 +20,13 @@ def perform_detection(image, interpreter, labels, input_details, output_details,
|
|
21 |
classes = interpreter.get_tensor(output_details[1]['index'])[0]
|
22 |
scores = interpreter.get_tensor(output_details[2]['index'])[0]
|
23 |
|
|
|
|
|
|
|
|
|
24 |
detections = []
|
25 |
for i in range(len(scores)):
|
26 |
-
if
|
27 |
ymin = int(max(1, (boxes[i][0] * imH)))
|
28 |
xmin = int(max(1, (boxes[i][1] * imW)))
|
29 |
ymax = int(min(imH, (boxes[i][2] * imH)))
|
|
|
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
from PIL import Image
|
|
|
20 |
classes = interpreter.get_tensor(output_details[1]['index'])[0]
|
21 |
scores = interpreter.get_tensor(output_details[2]['index'])[0]
|
22 |
|
23 |
+
print(f"boxes shape: {boxes.shape}")
|
24 |
+
print(f"classes shape: {classes.shape}")
|
25 |
+
print(f"scores shape: {scores.shape}")
|
26 |
+
|
27 |
detections = []
|
28 |
for i in range(len(scores)):
|
29 |
+
if scores[i] > 0.5:
|
30 |
ymin = int(max(1, (boxes[i][0] * imH)))
|
31 |
xmin = int(max(1, (boxes[i][1] * imW)))
|
32 |
ymax = int(min(imH, (boxes[i][2] * imH)))
|