Spaces:
Runtime error
Runtime error
Commit
·
9481ef1
1
Parent(s):
cec17f7
modify
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def draw_detections(img, box, score, class_id):
|
|
| 49 |
label = f'{classes[class_id]}: {score:.2f}'
|
| 50 |
|
| 51 |
# Calculate the dimensions of the label text
|
| 52 |
-
(label_width, label_height), _ = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX,
|
| 53 |
|
| 54 |
# Calculate the position of the label text
|
| 55 |
label_x = x1
|
|
@@ -61,7 +61,7 @@ def draw_detections(img, box, score, class_id):
|
|
| 61 |
cv2.rectangle(img, (label_x, label_y - label_height), (label_x + label_width, label_y + label_height), color, cv2.FILLED)
|
| 62 |
|
| 63 |
# Draw the label text on the image
|
| 64 |
-
cv2.putText(img, label, (label_x, label_y), cv2.FONT_HERSHEY_SIMPLEX,
|
| 65 |
|
| 66 |
|
| 67 |
def postprocess(detections, img_width, img_height, input_size, original_image):
|
|
|
|
| 49 |
label = f'{classes[class_id]}: {score:.2f}'
|
| 50 |
|
| 51 |
# Calculate the dimensions of the label text
|
| 52 |
+
(label_width, label_height), _ = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 1)
|
| 53 |
|
| 54 |
# Calculate the position of the label text
|
| 55 |
label_x = x1
|
|
|
|
| 61 |
cv2.rectangle(img, (label_x, label_y - label_height), (label_x + label_width, label_y + label_height), color, cv2.FILLED)
|
| 62 |
|
| 63 |
# Draw the label text on the image
|
| 64 |
+
cv2.putText(img, label, (label_x, label_y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 1, cv2.LINE_AA)
|
| 65 |
|
| 66 |
|
| 67 |
def postprocess(detections, img_width, img_height, input_size, original_image):
|