Spaces:
Sleeping
Sleeping
imabackstabber commited on
Commit ·
abde0ae
1
Parent(s): 0a34307
test postometro pipeline
Browse files- common/utils/vis.py +1 -1
- main/inference.py +0 -10
common/utils/vis.py
CHANGED
|
@@ -5,7 +5,7 @@ from mpl_toolkits.mplot3d import Axes3D
|
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
import matplotlib as mpl
|
| 7 |
import os
|
| 8 |
-
os.environ["PYOPENGL_PLATFORM"] = "
|
| 9 |
import pyrender
|
| 10 |
import trimesh
|
| 11 |
from config import cfg
|
|
|
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
import matplotlib as mpl
|
| 7 |
import os
|
| 8 |
+
os.environ["PYOPENGL_PLATFORM"] = "egl"
|
| 9 |
import pyrender
|
| 10 |
import trimesh
|
| 11 |
from config import cfg
|
main/inference.py
CHANGED
|
@@ -16,7 +16,6 @@ from utils.inference_utils import process_mmdet_results, non_max_suppression
|
|
| 16 |
from postometro_utils.smpl import SMPL
|
| 17 |
import data.config as smpl_cfg
|
| 18 |
from postometro import get_model
|
| 19 |
-
from postometro_utils.renderer_pyrender import PyRender_Renderer
|
| 20 |
|
| 21 |
class Inferer:
|
| 22 |
|
|
@@ -116,8 +115,6 @@ class Inferer:
|
|
| 116 |
img = transform(img)
|
| 117 |
img = img.to(cfg.device)[None,:,:,:]
|
| 118 |
|
| 119 |
-
self.renderer = PyRender_Renderer(resolution=(bbox[2], bbox[3]), faces=self.faces)
|
| 120 |
-
|
| 121 |
# mesh recovery
|
| 122 |
with torch.no_grad():
|
| 123 |
out = self.hmr_model(img)
|
|
@@ -134,13 +131,6 @@ class Inferer:
|
|
| 134 |
cx_delta, cy_delta = bbox_cx / img_cx - 1, bbox_cy / img_cy - 1
|
| 135 |
|
| 136 |
# render single person mesh
|
| 137 |
-
# focal = [self.cfg.focal[0] / self.cfg.renderer_input_body_shape[1] * bbox[2], self.cfg.focal[1] / self.cfg.renderer_input_body_shape[0] * bbox[3]]
|
| 138 |
-
# princpt = [self.cfg.princpt[0] / self.cfg.renderer_input_body_shape[1] * bbox[2] + bbox[0], self.cfg.princpt[1] / self.cfg.renderer_input_body_shape[0] * bbox[3] + bbox[1]]
|
| 139 |
-
# vis_img = render_mesh(vis_img, pred_3d_vertices_fine, self.faces, {'focal': focal, 'princpt': princpt},
|
| 140 |
-
# mesh_as_vertices=mesh_as_vertices)
|
| 141 |
-
# vis_img = render_mesh(vis_img, pred_3d_vertices_fine, self.faces, [pred_cam[0] / (original_img_width / bbox[2]), pred_cam[0] / (original_img_height / bbox[3]), pred_cam[1], pred_cam[2]], mesh_as_vertices=mesh_as_vertices)
|
| 142 |
-
# import ipdb
|
| 143 |
-
# ipdb.set_trace()
|
| 144 |
vis_img = render_mesh(vis_img, pred_3d_vertices_fine, self.faces, [pred_cam[0] / (original_img_width / bbox[2]), pred_cam[0] / (original_img_height / bbox[3]),
|
| 145 |
pred_cam[1] + cx_delta / (pred_cam[0] / (original_img_width / bbox[2])),
|
| 146 |
pred_cam[2] + cy_delta / (pred_cam[0] / (original_img_height / bbox[3]))],
|
|
|
|
| 16 |
from postometro_utils.smpl import SMPL
|
| 17 |
import data.config as smpl_cfg
|
| 18 |
from postometro import get_model
|
|
|
|
| 19 |
|
| 20 |
class Inferer:
|
| 21 |
|
|
|
|
| 115 |
img = transform(img)
|
| 116 |
img = img.to(cfg.device)[None,:,:,:]
|
| 117 |
|
|
|
|
|
|
|
| 118 |
# mesh recovery
|
| 119 |
with torch.no_grad():
|
| 120 |
out = self.hmr_model(img)
|
|
|
|
| 131 |
cx_delta, cy_delta = bbox_cx / img_cx - 1, bbox_cy / img_cy - 1
|
| 132 |
|
| 133 |
# render single person mesh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
vis_img = render_mesh(vis_img, pred_3d_vertices_fine, self.faces, [pred_cam[0] / (original_img_width / bbox[2]), pred_cam[0] / (original_img_height / bbox[3]),
|
| 135 |
pred_cam[1] + cx_delta / (pred_cam[0] / (original_img_width / bbox[2])),
|
| 136 |
pred_cam[2] + cy_delta / (pred_cam[0] / (original_img_height / bbox[3]))],
|