Spaces:
Sleeping
Sleeping
imabackstabber
commited on
Commit
·
ed25de7
1
Parent(s):
0f987d3
test mmdet pipeline
Browse files- app.py +7 -5
- assets/04.jpg +0 -0
- main/inference.py +1 -1
app.py
CHANGED
@@ -32,7 +32,7 @@ def infer(image_input, in_threshold=0.5, num_people="Single person", render_mesh
|
|
32 |
inferer = Inferer(DEFAULT_MODEL, num_gpus, OUT_FOLDER)
|
33 |
os.system(f'rm -rf {OUT_FOLDER}/*')
|
34 |
multi_person = False if (num_people == "Single person") else True
|
35 |
-
vis_img,
|
36 |
|
37 |
# cap = cv2.VideoCapture(video_input)
|
38 |
# fps = math.ceil(cap.get(5))
|
@@ -67,7 +67,7 @@ def infer(image_input, in_threshold=0.5, num_people="Single person", render_mesh
|
|
67 |
# os.system(f'zip -r {save_mesh_file} {save_path_mesh}')
|
68 |
# os.system(f'zip -r {save_smplx_file} {save_path_smplx}')
|
69 |
# yield img, video_path, save_mesh_file, save_smplx_file
|
70 |
-
return vis_img, "bbox meta: {}".format(
|
71 |
|
72 |
TITLE = '''<h1 align="center">PostoMETRO: Pose Token Enhanced Mesh Transformer for Robust 3D Human Mesh Recovery</h1>'''
|
73 |
DESCRIPTION = '''
|
@@ -86,7 +86,8 @@ with gr.Blocks(title="PostoMETRO", css=".gradio-container") as demo:
|
|
86 |
with gr.Row():
|
87 |
with gr.Column():
|
88 |
image_input = gr.Image(label="Input image", elem_classes="Image")
|
89 |
-
threshold = gr.Slider(0, 1.0, value=0.
|
|
|
90 |
num_people = gr.Radio(
|
91 |
choices=["Single person", "Multiple people"],
|
92 |
value="Single person",
|
@@ -96,7 +97,7 @@ with gr.Blocks(title="PostoMETRO", css=".gradio-container") as demo:
|
|
96 |
scale=1,)
|
97 |
mesh_as_vertices = gr.Checkbox(
|
98 |
label="Render as mesh",
|
99 |
-
info="By default, the estimated SMPL
|
100 |
interactive=True,
|
101 |
scale=1,)
|
102 |
send_button = gr.Button("Infer")
|
@@ -111,8 +112,9 @@ with gr.Blocks(title="PostoMETRO", css=".gradio-container") as demo:
|
|
111 |
['/home/user/app/assets/01.jpg'],
|
112 |
['/home/user/app/assets/02.jpg'],
|
113 |
['/home/user/app/assets/03.jpg'],
|
|
|
114 |
],
|
115 |
-
inputs=[image_input, 0.
|
116 |
|
117 |
#demo.queue()
|
118 |
demo.queue().launch(debug=True)
|
|
|
32 |
inferer = Inferer(DEFAULT_MODEL, num_gpus, OUT_FOLDER)
|
33 |
os.system(f'rm -rf {OUT_FOLDER}/*')
|
34 |
multi_person = False if (num_people == "Single person") else True
|
35 |
+
vis_img, num_bbox, mmdet_box = inferer.infer(image_input, in_threshold, 0, multi_person, not(render_mesh))
|
36 |
|
37 |
# cap = cv2.VideoCapture(video_input)
|
38 |
# fps = math.ceil(cap.get(5))
|
|
|
67 |
# os.system(f'zip -r {save_mesh_file} {save_path_mesh}')
|
68 |
# os.system(f'zip -r {save_smplx_file} {save_path_smplx}')
|
69 |
# yield img, video_path, save_mesh_file, save_smplx_file
|
70 |
+
return vis_img, "bbox num: {}, bbox meta: {}".format(num_bbox, mmdet_box)
|
71 |
|
72 |
TITLE = '''<h1 align="center">PostoMETRO: Pose Token Enhanced Mesh Transformer for Robust 3D Human Mesh Recovery</h1>'''
|
73 |
DESCRIPTION = '''
|
|
|
86 |
with gr.Row():
|
87 |
with gr.Column():
|
88 |
image_input = gr.Image(label="Input image", elem_classes="Image")
|
89 |
+
threshold = gr.Slider(0, 1.0, value=0.2, label='BBox detection threshold',
|
90 |
+
info="PostoMETRO will take in cropped bboxes as input to produce human mesh. A small threshold will prevent redundant bboxes and vice versa.")
|
91 |
num_people = gr.Radio(
|
92 |
choices=["Single person", "Multiple people"],
|
93 |
value="Single person",
|
|
|
97 |
scale=1,)
|
98 |
mesh_as_vertices = gr.Checkbox(
|
99 |
label="Render as mesh",
|
100 |
+
info="By default, the estimated SMPL parameters are rendered as vertices for faster visualization. Check this option if you want to visualize meshes instead.",
|
101 |
interactive=True,
|
102 |
scale=1,)
|
103 |
send_button = gr.Button("Infer")
|
|
|
112 |
['/home/user/app/assets/01.jpg'],
|
113 |
['/home/user/app/assets/02.jpg'],
|
114 |
['/home/user/app/assets/03.jpg'],
|
115 |
+
['/home/user/app/assets/04.jpg'],
|
116 |
],
|
117 |
+
inputs=[image_input, 0.2])
|
118 |
|
119 |
#demo.queue()
|
120 |
demo.queue().launch(debug=True)
|
assets/04.jpg
ADDED
![]() |
main/inference.py
CHANGED
@@ -142,5 +142,5 @@ class Inferer:
|
|
142 |
# vis_img = render_mesh(vis_img, mesh, smpl_x.face, {'focal': focal, 'princpt': princpt},
|
143 |
# mesh_as_vertices=mesh_as_vertices)
|
144 |
# vis_img = vis_img.astype('uint8')
|
145 |
-
return vis_img,
|
146 |
|
|
|
142 |
# vis_img = render_mesh(vis_img, mesh, smpl_x.face, {'focal': focal, 'princpt': princpt},
|
143 |
# mesh_as_vertices=mesh_as_vertices)
|
144 |
# vis_img = vis_img.astype('uint8')
|
145 |
+
return vis_img, num_bbox, mmdet_box
|
146 |
|