introdyced state
Browse files- main_noweb.py +11 -13
main_noweb.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
# Pose inferencing
|
2 |
-
import mmpose
|
3 |
from mmpose.apis import MMPoseInferencer
|
4 |
|
5 |
import torch
|
@@ -9,7 +8,6 @@ import gradio as gr
|
|
9 |
import moviepy.editor as moviepy
|
10 |
|
11 |
|
12 |
-
|
13 |
# System and files
|
14 |
import os
|
15 |
import glob
|
@@ -33,6 +31,7 @@ os.system("nvidia-smi")
|
|
33 |
print("[INFO]: Imported modules!")
|
34 |
human = MMPoseInferencer("simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192") # simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192 dekr_hrnet-w32_8xb10-140e_coco-512x512
|
35 |
hand = MMPoseInferencer("hand")
|
|
|
36 |
|
37 |
#"https://github.com/open-mmlab/mmpose/blob/main/configs/body_3d_keypoint/pose_lift/h36m/pose-lift_simplebaseline3d_8xb64-200e_h36m.py",
|
38 |
#"https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth") # pose3d="human3d"
|
@@ -94,11 +93,13 @@ def check_extension(video):
|
|
94 |
def pose3d(video, kpt_threshold):
|
95 |
video = check_extension(video)
|
96 |
print(device)
|
|
|
|
|
97 |
|
98 |
-
human3d = MMPoseInferencer(device=device,
|
99 |
pose3d="human3d",
|
100 |
-
scope="mmpose")
|
101 |
-
|
102 |
# Define new unique folder
|
103 |
add_dir = str(uuid.uuid4())
|
104 |
vis_out_dir = os.path.join("/".join(video.split("/")[:-1]), add_dir)
|
@@ -304,13 +305,10 @@ print("Angle is: ", angle)
|
|
304 |
16: Right Ankle
|
305 |
```
|
306 |
|
307 |
-
\n Below, you can see a visualization of the poses of the
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
<img src="./cocohand.png" width="200">
|
312 |
-
|
313 |
-
""")
|
314 |
|
315 |
|
316 |
|
@@ -340,7 +338,7 @@ if __name__ == "__main__":
|
|
340 |
#max_size=25, # Maximum number of requests that the queue processes
|
341 |
api_open = False # When creating a Gradio demo, you may want to restrict all traffic to happen through the user interface as opposed to the programmatic API that is automatically created for your Gradio demo.
|
342 |
).launch(
|
343 |
-
max_threads=31,
|
344 |
server_name="0.0.0.0",
|
345 |
server_port=7860,
|
346 |
auth=("novouser", "bstad2023")
|
|
|
1 |
# Pose inferencing
|
|
|
2 |
from mmpose.apis import MMPoseInferencer
|
3 |
|
4 |
import torch
|
|
|
8 |
import moviepy.editor as moviepy
|
9 |
|
10 |
|
|
|
11 |
# System and files
|
12 |
import os
|
13 |
import glob
|
|
|
31 |
print("[INFO]: Imported modules!")
|
32 |
human = MMPoseInferencer("simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192") # simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192 dekr_hrnet-w32_8xb10-140e_coco-512x512
|
33 |
hand = MMPoseInferencer("hand")
|
34 |
+
#model3d = gr.State()
|
35 |
|
36 |
#"https://github.com/open-mmlab/mmpose/blob/main/configs/body_3d_keypoint/pose_lift/h36m/pose-lift_simplebaseline3d_8xb64-200e_h36m.py",
|
37 |
#"https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth") # pose3d="human3d"
|
|
|
93 |
def pose3d(video, kpt_threshold):
|
94 |
video = check_extension(video)
|
95 |
print(device)
|
96 |
+
|
97 |
+
#human3d = MMPoseInferencer(device=device, pose3d="human3d", scope="mmpose")#"pose-lift_videopose3d-243frm-supv-cpn-ft_8xb128-200e_h36m")
|
98 |
|
99 |
+
human3d = gr.State(value=MMPoseInferencer(device=device,
|
100 |
pose3d="human3d",
|
101 |
+
scope="mmpose"))
|
102 |
+
|
103 |
# Define new unique folder
|
104 |
add_dir = str(uuid.uuid4())
|
105 |
vis_out_dir = os.path.join("/".join(video.split("/")[:-1]), add_dir)
|
|
|
305 |
16: Right Ankle
|
306 |
```
|
307 |
|
308 |
+
\n Below, you can see a visualization of the poses of the 2d, 3d and hand keypoint locations: """)
|
309 |
+
gr.Image("./cocoposes.png", width="200")
|
310 |
+
gr.Image("./cocohand.png", width="200")
|
311 |
+
|
|
|
|
|
|
|
312 |
|
313 |
|
314 |
|
|
|
338 |
#max_size=25, # Maximum number of requests that the queue processes
|
339 |
api_open = False # When creating a Gradio demo, you may want to restrict all traffic to happen through the user interface as opposed to the programmatic API that is automatically created for your Gradio demo.
|
340 |
).launch(
|
341 |
+
# max_threads=31,
|
342 |
server_name="0.0.0.0",
|
343 |
server_port=7860,
|
344 |
auth=("novouser", "bstad2023")
|