Spaces:
Runtime error
Runtime error
sshi
commited on
Commit
·
d252b7e
1
Parent(s):
5eaf2b4
App bug fix.
Browse files
app.py
CHANGED
|
@@ -83,9 +83,19 @@ model_yolos.to(device)
|
|
| 83 |
model_yolos.eval()
|
| 84 |
|
| 85 |
# colors for visualization
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# for output bounding box post-processing
|
| 90 |
def box_cxcywh_to_xyxy(x):
|
| 91 |
x_c, y_c, w, h = x.unbind(1)
|
|
@@ -108,7 +118,7 @@ def plot_results(pil_img, prob, boxes):
|
|
| 108 |
c = colors[cl]
|
| 109 |
c1, c2 = (int(xmin), int(ymin)), (int(xmax), int(ymax))
|
| 110 |
|
| 111 |
-
cv2.rectangle(img, c1, c2,
|
| 112 |
# cv2.text(
|
| 113 |
# [xmin + 5, ymin + 5],
|
| 114 |
# f'{id2label[cl.item()]}: {p[cl]:0.2f}',
|
|
|
|
| 83 |
model_yolos.eval()
|
| 84 |
|
| 85 |
# colors for visualization
|
| 86 |
+
COLORS = [
|
| 87 |
+
[0.000, 0.447, 0.741],
|
| 88 |
+
[0.850, 0.325, 0.098],
|
| 89 |
+
[0.929, 0.694, 0.125],
|
| 90 |
+
[0.756, 0.794, 0.100],
|
| 91 |
+
[0.466, 0.674, 0.188],
|
| 92 |
+
[0.301, 0.745, 0.933],
|
| 93 |
+
[0.184, 0.494, 0.741],
|
| 94 |
+
[0.494, 0.674, 0.556],
|
| 95 |
+
[0.494, 0.301, 0.933],
|
| 96 |
+
[0.000, 0.325, 0.850],
|
| 97 |
+
[0.745, 0.301, 0.188]]
|
| 98 |
+
|
| 99 |
# for output bounding box post-processing
|
| 100 |
def box_cxcywh_to_xyxy(x):
|
| 101 |
x_c, y_c, w, h = x.unbind(1)
|
|
|
|
| 118 |
c = colors[cl]
|
| 119 |
c1, c2 = (int(xmin), int(ymin)), (int(xmax), int(ymax))
|
| 120 |
|
| 121 |
+
cv2.rectangle(img, c1, c2, [0,255,255], thickness=2, lineType=cv2.LINE_AA)
|
| 122 |
# cv2.text(
|
| 123 |
# [xmin + 5, ymin + 5],
|
| 124 |
# f'{id2label[cl.item()]}: {p[cl]:0.2f}',
|