Spaces:
Runtime error
Runtime error
Commit
·
d3201bf
1
Parent(s):
ee24a3d
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ from face_detection import RetinaFace
|
|
14 |
from model import SixDRepNet
|
15 |
import utils
|
16 |
import cv2
|
|
|
17 |
|
18 |
snapshot_path = hf_hub_download(repo_id="osanseviero/6DRepNet_300W_LP_AFLW2000", filename="model.pth")
|
19 |
|
@@ -63,7 +64,9 @@ def predict(frame):
|
|
63 |
p_pred_deg = euler[:, 0].cpu()
|
64 |
y_pred_deg = euler[:, 1].cpu()
|
65 |
r_pred_deg = euler[:, 2].cpu()
|
66 |
-
|
|
|
|
|
67 |
|
68 |
title = "6D Rotation Representation for Unconstrained Head Pose Estimation"
|
69 |
description = "Gradio demo for 6DRepNet. To use it, simply click the camera picture. Read more at the links below."
|
|
|
14 |
from model import SixDRepNet
|
15 |
import utils
|
16 |
import cv2
|
17 |
+
from PIL import Image
|
18 |
|
19 |
snapshot_path = hf_hub_download(repo_id="osanseviero/6DRepNet_300W_LP_AFLW2000", filename="model.pth")
|
20 |
|
|
|
64 |
p_pred_deg = euler[:, 0].cpu()
|
65 |
y_pred_deg = euler[:, 1].cpu()
|
66 |
r_pred_deg = euler[:, 2].cpu()
|
67 |
+
arr = utils.plot_pose_cube(frame, y_pred_deg, p_pred_deg, r_pred_deg, x_min + int(.5*(x_max-x_min)), y_min + int(.5*(y_max-y_min)), size = bbox_width)
|
68 |
+
img = Image.fromarray(arr)
|
69 |
+
return img.resize(size=(200, 200))
|
70 |
|
71 |
title = "6D Rotation Representation for Unconstrained Head Pose Estimation"
|
72 |
description = "Gradio demo for 6DRepNet. To use it, simply click the camera picture. Read more at the links below."
|