xmrt commited on
Commit
dc17745
1 Parent(s): 5fed344

mp4 for tracking

Browse files
Files changed (1) hide show
  1. main.py +8 -6
main.py CHANGED
@@ -63,9 +63,11 @@ def show_tracking(video_content, vis_out_dir, model):
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
 
70
  out_track.release()
71
 
@@ -110,17 +112,17 @@ def infer(video, check):
110
  out_files.extend(out_file)
111
  print(out_files)
112
 
113
- return out_files[0], out_files[1], out_files[2], out_file # out_files[3]
114
 
115
  def run():
116
  #https://github.com/open-mmlab/mmpose/blob/main/docs/en/user_guides/inference.md
117
- check_web = gr.CheckboxGroup(choices = ["Estimate human 2d poses", "Estimate human 2d hand poses", "Estimate human 3d poses", "Detect and track"], label="Methods", type="value", info="Select the model(s) you want")
118
- check_file = gr.CheckboxGroup(choices = ["Estimate human 2d poses", "Estimate human 2d hand poses", "Estimate human 3d poses", "Detect and track"], label="Methods", type="value", info="Select the model(s) you want")
119
 
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,7 +131,7 @@ def run():
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
 
 
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
+ out_track.write(result_track)
67
+
68
  print("[INFO] Done with frames")
69
  #print(type(result_pose)) numpy ndarray
70
+
71
 
72
  out_track.release()
73
 
 
112
  out_files.extend(out_file)
113
  print(out_files)
114
 
115
+ return "track.mp4", out_files[0], out_files[1], out_files[2] # out_files[3]
116
 
117
  def run():
118
  #https://github.com/open-mmlab/mmpose/blob/main/docs/en/user_guides/inference.md
119
+ check_web = gr.CheckboxGroup(choices = ["Detect and track", "Estimate human 2d poses", "Estimate human 2d hand poses", "Estimate human 3d poses"], label="Methods", type="value", info="Select the model(s) you want")
120
+ check_file = gr.CheckboxGroup(choices = ["Detect and track", "Estimate human 2d poses", "Estimate human 2d hand poses", "Estimate human 3d poses"], label="Methods", type="value", info="Select the model(s) you want")
121
 
122
  webcam = gr.Interface(
123
  fn=infer,
124
  inputs= [gr.Video(source="webcam", height=412), check_web],
125
+ outputs = [gr.Video(format='mp4'), gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()],
126
  title = 'Pose estimation',
127
  description = 'Pose estimation on video',
128
  allow_flagging=False
 
131
  file = gr.Interface(
132
  infer,
133
  inputs = [gr.Video(source="upload", height=412), check_file],
134
+ outputs = [gr.Video(format='mp4'), gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()],
135
  allow_flagging=False
136
  )
137