xmrt commited on
Commit
0c80e1d
1 Parent(s): fd8361a

height in playable and kptthresh

Browse files
Files changed (1) hide show
  1. main.py +15 -11
main.py CHANGED
@@ -77,14 +77,14 @@ def show_tracking(video_content, vis_out_dir, model):
77
  return out_file
78
 
79
 
80
- def poses(inferencer, video, vis_out_dir):
81
 
82
  result_generator = inferencer(video,
83
  vis_out_dir = vis_out_dir,
84
  return_vis=True,
85
  thickness=2,
86
  rebase_keypoint_height=True,
87
- kpt_thr=0.15,
88
  device="cuda"
89
  )
90
 
@@ -94,7 +94,7 @@ def poses(inferencer, video, vis_out_dir):
94
 
95
  return out_file
96
 
97
- def infer(video, check):
98
  # Selecting the specific inferencer
99
  out_files=[]
100
 
@@ -108,7 +108,7 @@ def infer(video, check):
108
  trackfile = show_tracking(video, vis_out_dir, inferencer)
109
 
110
  else:
111
- out_file = poses(inferencer, video, vis_out_dir)
112
 
113
  out_files.extend(out_file)
114
 
@@ -122,20 +122,24 @@ def run():
122
  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")
123
 
124
  # Insert slider with kpt_thr
125
-
 
 
126
  webcam = gr.Interface(
127
  fn=infer,
128
- inputs= [gr.Video(source="webcam", height=512), check_web],
129
- outputs = [gr.Video(format='mp4', height=512), gr.PlayableVideo(height=512), gr.PlayableVideo(height=512), gr.PlayableVideo(height=512)],
130
- title = 'Pose estimation',
131
- description = 'Pose estimation on video',
132
  allow_flagging=False
133
  )
134
 
135
  file = gr.Interface(
136
  infer,
137
- inputs = [gr.Video(source="upload", height=512), check_file],
138
- outputs = [gr.Video(format='mp4', height=512), gr.PlayableVideo(height=512), gr.PlayableVideo(height=512), gr.PlayableVideo(height=512)],
 
 
139
  allow_flagging=False
140
  )
141
 
 
77
  return out_file
78
 
79
 
80
+ def poses(inferencer, video, vis_out_dir, kpt_thr):
81
 
82
  result_generator = inferencer(video,
83
  vis_out_dir = vis_out_dir,
84
  return_vis=True,
85
  thickness=2,
86
  rebase_keypoint_height=True,
87
+ kpt_thr=kpt_thr,
88
  device="cuda"
89
  )
90
 
 
94
 
95
  return out_file
96
 
97
+ def infer(video, check, kpt_thr):
98
  # Selecting the specific inferencer
99
  out_files=[]
100
 
 
108
  trackfile = show_tracking(video, vis_out_dir, inferencer)
109
 
110
  else:
111
+ out_file = poses(inferencer, video, vis_out_dir, kpt_thr)
112
 
113
  out_files.extend(out_file)
114
 
 
122
  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")
123
 
124
  # Insert slider with kpt_thr
125
+ web_kpthr = gr.Slider(0, 1, value=0.3)
126
+ file_kpthr = gr.Slider(0, 1, value=0.3)
127
+
128
  webcam = gr.Interface(
129
  fn=infer,
130
+ inputs= [gr.Video(source="webcam", height=512), check_web, web_kpthr],
131
+ outputs = [gr.Video(format='mp4', height=512, label="Detect and track", show_label=True), gr.PlayableVideo(height=512, label = "Estimate human 2d poses", show_label=True), gr.PlayableVideo(height=512, label = "Estimate human 2d hand poses", show_label=True), gr.PlayableVideo(height=512, label = "Estimate human 3d poses", show_label=True)],
132
+ title = 'Tracking and pose estimation',
133
+ description = 'Tracking and pose estimation',
134
  allow_flagging=False
135
  )
136
 
137
  file = gr.Interface(
138
  infer,
139
+ inputs = [gr.Video(source="upload", height=512), check_file, file_kpthr],
140
+ outputs = [gr.Video(format='mp4', height=512, label="Detect and track", show_label=True), gr.PlayableVideo(height=512, label = "Estimate human 2d poses", show_label=True), gr.PlayableVideo(height=512, label = "Estimate human 2d hand poses", show_label=True), gr.PlayableVideo(height=512, label = "Estimate human 3d poses", show_label=True)],
141
+ title = 'Tracking and pose estimation',
142
+ description = 'Tracking and pose estimation',
143
  allow_flagging=False
144
  )
145