Spaces:
Build error
Build error
init
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from z_app_factory import get_app
|
|
5 |
|
6 |
def inference(image):
|
7 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
|
|
8 |
lst2d_res = get_app(image)
|
9 |
thickness = 3
|
10 |
lineType = 8
|
@@ -16,18 +17,18 @@ def inference(image):
|
|
16 |
point_color = (0, int(255 * score), 0) # BGR
|
17 |
x1, y1 = bbox[:2]
|
18 |
x2, y2 = bbox[2:]
|
19 |
-
cv2.putText(
|
20 |
-
cv2.line(
|
21 |
-
cv2.line(
|
22 |
-
cv2.line(
|
23 |
-
cv2.line(
|
24 |
|
25 |
for kp in face["kps"]:
|
26 |
x, y = [int(i) for i in kp]
|
27 |
-
cv2.circle(
|
28 |
|
29 |
-
|
30 |
-
return
|
31 |
|
32 |
|
33 |
|
|
|
5 |
|
6 |
def inference(image):
|
7 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
8 |
+
annotated_image = image.copy()
|
9 |
lst2d_res = get_app(image)
|
10 |
thickness = 3
|
11 |
lineType = 8
|
|
|
17 |
point_color = (0, int(255 * score), 0) # BGR
|
18 |
x1, y1 = bbox[:2]
|
19 |
x2, y2 = bbox[2:]
|
20 |
+
cv2.putText(annotated_image, str(score)[:4], (x1, y1 - 10), font, 0.8, (0, 255, 0), 2)
|
21 |
+
cv2.line(annotated_image, (x1, y1), (x2, y1), point_color, thickness, lineType)
|
22 |
+
cv2.line(annotated_image, (x2, y1), (x2, y2), point_color, thickness, lineType)
|
23 |
+
cv2.line(annotated_image, (x1, y1), (x1, y2), point_color, thickness, lineType)
|
24 |
+
cv2.line(annotated_image, (x1, y2), (x2, y2), point_color, thickness, lineType)
|
25 |
|
26 |
for kp in face["kps"]:
|
27 |
x, y = [int(i) for i in kp]
|
28 |
+
cv2.circle(annotated_image, (x, y), 2, (2, 30, 200), 2)
|
29 |
|
30 |
+
annotated_image = cv2.cvtColor(annotated_image, cv2.COLOR_RGB2BGR)
|
31 |
+
return annotated_image
|
32 |
|
33 |
|
34 |
|