glob
Browse files
main.py
CHANGED
@@ -92,8 +92,9 @@ def pose3d(video):
|
|
92 |
rebase_keypoint_height=True,
|
93 |
device="cuda")
|
94 |
|
|
|
|
|
95 |
result = [result for result in result_generator] #next(result_generator)
|
96 |
-
out_file = glob.glob(os.path.join(vis_out_dir, "*"))
|
97 |
out_file = glob.glob(os.path.join(vis_out_dir, "*.mp4")) + glob.glob(os.path.join(vis_out_dir, "*.webm"))
|
98 |
print("[INFO]: CURRENT OUT FILE NAME: ", out_file)
|
99 |
|
@@ -108,10 +109,12 @@ def pose2d(video):
|
|
108 |
|
109 |
result_generator = human(video,
|
110 |
vis_out_dir = vis_out_dir,
|
111 |
-
thickness=2,
|
112 |
return_vis=True,
|
|
|
113 |
rebase_keypoint_height=True,
|
114 |
-
|
|
|
|
|
115 |
|
116 |
result = [result for result in result_generator] #next(result_generator)
|
117 |
|
@@ -145,78 +148,79 @@ def pose2dhand(video):
|
|
145 |
|
146 |
return out_file
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
with gr.
|
152 |
-
with gr.
|
153 |
-
with gr.
|
154 |
-
with gr.
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
with gr.
|
171 |
-
with gr.
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
submit_hand_web.click(fn=pose2dhand,
|
215 |
-
inputs= webcam_input,
|
216 |
-
outputs = video_output3)
|
217 |
-
|
218 |
-
submit_detect_web.click(fn=show_tracking,
|
219 |
inputs= webcam_input,
|
220 |
-
outputs =
|
|
|
|
|
|
|
|
|
221 |
|
222 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
92 |
rebase_keypoint_height=True,
|
93 |
device="cuda")
|
94 |
|
95 |
+
print("OUTDIR", os.listdir(os.path.join(vis_out_dir)))
|
96 |
+
|
97 |
result = [result for result in result_generator] #next(result_generator)
|
|
|
98 |
out_file = glob.glob(os.path.join(vis_out_dir, "*.mp4")) + glob.glob(os.path.join(vis_out_dir, "*.webm"))
|
99 |
print("[INFO]: CURRENT OUT FILE NAME: ", out_file)
|
100 |
|
|
|
109 |
|
110 |
result_generator = human(video,
|
111 |
vis_out_dir = vis_out_dir,
|
|
|
112 |
return_vis=True,
|
113 |
+
thickness=2,
|
114 |
rebase_keypoint_height=True,
|
115 |
+
#kpt_thr=kpt_thr,
|
116 |
+
device="cuda"
|
117 |
+
)
|
118 |
|
119 |
result = [result for result in result_generator] #next(result_generator)
|
120 |
|
|
|
148 |
|
149 |
return out_file
|
150 |
|
151 |
+
if __name__ == "__main__":
|
152 |
+
|
153 |
+
|
154 |
+
with gr.Blocks() as demo:
|
155 |
+
with gr.Column():
|
156 |
+
with gr.Tab("Upload video"):
|
157 |
+
with gr.Row():
|
158 |
+
with gr.Column():
|
159 |
+
video_input = gr.Video(source="upload", type="filepath", height=512)
|
160 |
+
# Insert slider with kpt_thr
|
161 |
+
file_kpthr = gr.Slider(0, 1, value=0.3)
|
162 |
+
|
163 |
+
submit_pose_file = gr.Button("Make 2d pose estimation")
|
164 |
+
submit_pose3d_file = gr.Button("Make 3d pose estimation")
|
165 |
+
submit_hand_file = gr.Button("Make 2d hand estimation")
|
166 |
+
submit_detect_file = gr.Button("Detect and track objects")
|
167 |
+
|
168 |
+
video_output1 = gr.Video(height=512)
|
169 |
+
video_output2 = gr.Video(height=512)
|
170 |
+
video_output3 = gr.Video(height=512)
|
171 |
+
video_output4 = gr.Video(height=512)
|
172 |
+
|
173 |
+
with gr.Tab("Record video with webcam"):
|
174 |
+
with gr.Row():
|
175 |
+
with gr.Column():
|
176 |
+
webcam_input = gr.Video(source="webcam", height=512)
|
177 |
+
|
178 |
+
web_kpthr = gr.Slider(0, 1, value=0.3)
|
179 |
+
|
180 |
+
submit_pose_web = gr.Button("Make 2d pose estimation")
|
181 |
+
submit_pose3d_web = gr.Button("Make 3d pose estimation")
|
182 |
+
submit_hand_web = gr.Button("Make 2d hand estimation")
|
183 |
+
submit_detect_web = gr.Button("Detect and track objects")
|
184 |
+
|
185 |
+
webcam_output1 = gr.Video(height=512)
|
186 |
+
webcam_output2 = gr.Video(height=512)
|
187 |
+
webcam_output3 = gr.Video(height=512)
|
188 |
+
webcam_output4 = gr.Video(height=512)
|
189 |
+
|
190 |
+
|
191 |
|
192 |
+
# From file
|
193 |
+
submit_pose_file.click(fn=pose2d,
|
194 |
+
inputs= video_input,
|
195 |
+
outputs = video_output1)
|
196 |
+
|
197 |
+
submit_pose3d_file.click(fn=pose3d,
|
198 |
+
inputs= video_input,
|
199 |
+
outputs = video_output2)
|
200 |
+
|
201 |
+
submit_hand_file.click(fn=pose2dhand,
|
202 |
+
inputs= video_input,
|
203 |
+
outputs = video_output3)
|
204 |
+
|
205 |
+
submit_detect_file.click(fn=show_tracking,
|
206 |
+
inputs= video_input,
|
207 |
+
outputs = video_output4)
|
208 |
+
|
209 |
+
# Web
|
210 |
+
submit_pose_web.click(fn=pose2d,
|
211 |
+
inputs = webcam_input,
|
212 |
+
outputs = webcam_output1)
|
213 |
+
|
214 |
+
submit_pose3d_web.click(fn=pose3d,
|
215 |
+
inputs= webcam_input,
|
216 |
+
outputs = webcam_output2)
|
217 |
+
|
218 |
+
submit_hand_web.click(fn=pose2dhand,
|
|
|
|
|
|
|
|
|
|
|
219 |
inputs= webcam_input,
|
220 |
+
outputs = video_output3)
|
221 |
+
|
222 |
+
submit_detect_web.click(fn=show_tracking,
|
223 |
+
inputs= webcam_input,
|
224 |
+
outputs = video_output4)
|
225 |
|
226 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|