Spaces:
Build error
Build error
big face
Browse files- .gitignore +1 -0
- app.py +32 -14
- core.bin +2 -2
- imgs/2313.png +0 -0
- mic.bin +2 -2
- z_app_factory.so +0 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
/.idea
|
app.py
CHANGED
@@ -3,32 +3,49 @@ import gradio as gr
|
|
3 |
from z_app_factory import get_app
|
4 |
|
5 |
|
|
|
|
|
|
|
|
|
6 |
def inference(image):
|
7 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
for face in lst2d_res:
|
|
|
15 |
bbox = [int(i) for i in face["bbox"]]
|
16 |
score = face['score']
|
17 |
point_color = (0, int(255 * score), 0) # BGR
|
18 |
x1, y1 = bbox[:2]
|
19 |
x2, y2 = bbox[2:]
|
20 |
-
cv2.putText(
|
21 |
-
cv2.line(
|
22 |
-
cv2.line(
|
23 |
-
cv2.line(
|
24 |
-
cv2.line(
|
25 |
|
26 |
for kp in face["kps"]:
|
27 |
x, y = [int(i) for i in kp]
|
28 |
-
cv2.circle(
|
29 |
|
30 |
-
|
31 |
-
return
|
32 |
|
33 |
|
34 |
|
@@ -46,5 +63,6 @@ gr.Interface(
|
|
46 |
examples=[
|
47 |
["imgs/face1.jpg"],
|
48 |
["imgs/face2.jpg"],
|
49 |
-
["imgs/
|
|
|
50 |
]).launch(debug=True)
|
|
|
3 |
from z_app_factory import get_app
|
4 |
|
5 |
|
6 |
+
thickness = 3
|
7 |
+
lineType = 8
|
8 |
+
font = cv2.FONT_HERSHEY_SIMPLEX
|
9 |
+
|
10 |
def inference(image):
|
11 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
12 |
+
code,lst2d_res = get_app(image)
|
13 |
+
msg = "aaa"
|
14 |
+
if code == 401:
|
15 |
+
msg = "Not RGB three channel picture"
|
16 |
+
elif code == 402:
|
17 |
+
msg = "Pixels less than 32 * 32"
|
18 |
+
elif code == 403:
|
19 |
+
msg = "Pixels greater than 4096 * 4096"
|
20 |
+
elif code == 404:
|
21 |
+
msg = "Files greater than 5MB"
|
22 |
+
elif code == 405:
|
23 |
+
msg = "System error, please contact\n the server for troubleshooting"
|
24 |
+
|
25 |
+
if code!=200:
|
26 |
+
img_out = np.zeros((500, 600,3),dtype=np.uint8)
|
27 |
+
cv2.putText(img_out, msg, (20, 200), font, 1, (0, 255, 0), 2)
|
28 |
+
return img_out
|
29 |
|
30 |
for face in lst2d_res:
|
31 |
+
|
32 |
bbox = [int(i) for i in face["bbox"]]
|
33 |
score = face['score']
|
34 |
point_color = (0, int(255 * score), 0) # BGR
|
35 |
x1, y1 = bbox[:2]
|
36 |
x2, y2 = bbox[2:]
|
37 |
+
cv2.putText(image, str(score)[:4], (x1, y1 - 10), font, 0.8, (0, 255, 0), 2)
|
38 |
+
cv2.line(image, (x1, y1), (x2, y1), point_color, thickness, lineType)
|
39 |
+
cv2.line(image, (x2, y1), (x2, y2), point_color, thickness, lineType)
|
40 |
+
cv2.line(image, (x1, y1), (x1, y2), point_color, thickness, lineType)
|
41 |
+
cv2.line(image, (x1, y2), (x2, y2), point_color, thickness, lineType)
|
42 |
|
43 |
for kp in face["kps"]:
|
44 |
x, y = [int(i) for i in kp]
|
45 |
+
cv2.circle(image, (x, y), 2, (2, 30, 200), 2)
|
46 |
|
47 |
+
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
48 |
+
return image
|
49 |
|
50 |
|
51 |
|
|
|
63 |
examples=[
|
64 |
["imgs/face1.jpg"],
|
65 |
["imgs/face2.jpg"],
|
66 |
+
["imgs/cc.png"],
|
67 |
+
["imgs/2313.png"]
|
68 |
]).launch(debug=True)
|
core.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f02f1f3a3063a53802bd427234db4eed6dbc600e1e5dba59a9eb064401c40fc7
|
3 |
+
size 20928518
|
imgs/2313.png
ADDED
![]() |
mic.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c5c351ce535def9746f385c8d7cf48e2d332ab4de71a0bbdbb40d0f82129524
|
3 |
+
size 1926896
|
z_app_factory.so
CHANGED
Binary files a/z_app_factory.so and b/z_app_factory.so differ
|
|