Update app.py
Browse files
app.py
CHANGED
@@ -30,8 +30,12 @@ def apply_nms(predictions, iou_threshold=0.5):
|
|
30 |
# Perform NMS using OpenCV
|
31 |
indices = cv2.dnn.NMSBoxes(boxes.tolist(), scores.tolist(), score_threshold=0.25, nms_threshold=iou_threshold)
|
32 |
|
33 |
-
#
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
|
36 |
nms_predictions = []
|
37 |
|
|
|
30 |
# Perform NMS using OpenCV
|
31 |
indices = cv2.dnn.NMSBoxes(boxes.tolist(), scores.tolist(), score_threshold=0.25, nms_threshold=iou_threshold)
|
32 |
|
33 |
+
# Ensure indices are a numpy array (if returned as a tuple)
|
34 |
+
if isinstance(indices, tuple):
|
35 |
+
indices = indices[0] # Extracting the first element which contains the indices
|
36 |
+
|
37 |
+
# Now indices is a numpy array, we can safely call .flatten()
|
38 |
+
indices = indices.flatten()
|
39 |
|
40 |
nms_predictions = []
|
41 |
|