skipping tracking
Browse files
main.py
CHANGED
@@ -50,6 +50,7 @@ def show_tracking(video_content, vis_out_dir, model):
|
|
50 |
|
51 |
# Prepare to save video
|
52 |
out_file = os.path.join(vis_out_dir, "track.mp4")
|
|
|
53 |
print("[INFO]: TRACK", out_file)
|
54 |
|
55 |
fourcc = cv2.VideoWriter_fourcc(*"mp4v") # Codec for MP4 video
|
@@ -62,7 +63,7 @@ def show_tracking(video_content, vis_out_dir, model):
|
|
62 |
# Go through frames and write them
|
63 |
for frame_track in video_track:
|
64 |
result_track = frame_track[0].plot() # plot a BGR numpy array of predictions
|
65 |
-
|
66 |
#print(type(result_pose)) numpy ndarray
|
67 |
out_track.write(result_track)
|
68 |
|
@@ -99,6 +100,7 @@ def infer(video, check):
|
|
99 |
inferencer = inferencers[i] # 'hand', 'human , device='cuda'
|
100 |
|
101 |
if i == "Detect and track":
|
|
|
102 |
out_file = show_tracking(video, vis_out_dir, inferencer)
|
103 |
|
104 |
else:
|
@@ -108,7 +110,7 @@ def infer(video, check):
|
|
108 |
out_files.extend(out_file)
|
109 |
print(out_files)
|
110 |
|
111 |
-
return out_files[0], out_files[1], out_files[2]
|
112 |
|
113 |
def run():
|
114 |
#https://github.com/open-mmlab/mmpose/blob/main/docs/en/user_guides/inference.md
|
@@ -118,7 +120,7 @@ def run():
|
|
118 |
webcam = gr.Interface(
|
119 |
fn=infer,
|
120 |
inputs= [gr.Video(source="webcam", height=412), check_web],
|
121 |
-
outputs = [gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()
|
122 |
title = 'Pose estimation',
|
123 |
description = 'Pose estimation on video',
|
124 |
allow_flagging=False
|
@@ -127,7 +129,7 @@ def run():
|
|
127 |
file = gr.Interface(
|
128 |
infer,
|
129 |
inputs = [gr.Video(source="upload", height=412), check_file],
|
130 |
-
outputs = [gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()
|
131 |
allow_flagging=False
|
132 |
)
|
133 |
|
|
|
50 |
|
51 |
# Prepare to save video
|
52 |
out_file = os.path.join(vis_out_dir, "track.mp4")
|
53 |
+
out_file = "track.mp4"
|
54 |
print("[INFO]: TRACK", out_file)
|
55 |
|
56 |
fourcc = cv2.VideoWriter_fourcc(*"mp4v") # Codec for MP4 video
|
|
|
63 |
# Go through frames and write them
|
64 |
for frame_track in video_track:
|
65 |
result_track = frame_track[0].plot() # plot a BGR numpy array of predictions
|
66 |
+
print("[INFO] Done with frames")
|
67 |
#print(type(result_pose)) numpy ndarray
|
68 |
out_track.write(result_track)
|
69 |
|
|
|
100 |
inferencer = inferencers[i] # 'hand', 'human , device='cuda'
|
101 |
|
102 |
if i == "Detect and track":
|
103 |
+
continue
|
104 |
out_file = show_tracking(video, vis_out_dir, inferencer)
|
105 |
|
106 |
else:
|
|
|
110 |
out_files.extend(out_file)
|
111 |
print(out_files)
|
112 |
|
113 |
+
return out_files[0], out_files[1], out_files[2]#, out_files[3]
|
114 |
|
115 |
def run():
|
116 |
#https://github.com/open-mmlab/mmpose/blob/main/docs/en/user_guides/inference.md
|
|
|
120 |
webcam = gr.Interface(
|
121 |
fn=infer,
|
122 |
inputs= [gr.Video(source="webcam", height=412), check_web],
|
123 |
+
outputs = [gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()],# gr.PlayableVideo()],
|
124 |
title = 'Pose estimation',
|
125 |
description = 'Pose estimation on video',
|
126 |
allow_flagging=False
|
|
|
129 |
file = gr.Interface(
|
130 |
infer,
|
131 |
inputs = [gr.Video(source="upload", height=412), check_file],
|
132 |
+
outputs = [gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()],#, gr.PlayableVideo()],
|
133 |
allow_flagging=False
|
134 |
)
|
135 |
|