MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / generate_by_video

Function generate_by_video

mGPT/render/visualize.py:190–349  ·  view source on GitHub ↗
(visualization, reconstructions, generation,
                      label_to_action_name, params, nats, nspa, tmp_path)

Source from the content-addressed store, hash-verified

188
189
190def generate_by_video(visualization, reconstructions, generation,
191 label_to_action_name, params, nats, nspa, tmp_path):
192 # shape : (17, 3, 4, 480, 640, 3)
193 # (nframes, row, column, h, w, 3)
194 fps = params["fps"]
195
196 params = params.copy()
197
198 gen_only = False
199 if visualization is None:
200 gen_only = True
201 outputkey = "output_vertices"
202 params["pose_rep"] = "vertices"
203 elif "output_vertices" in visualization:
204 outputkey = "output_vertices"
205 params["pose_rep"] = "vertices"
206 elif "output_xyz" in visualization:
207 outputkey = "output_xyz"
208 params["pose_rep"] = "xyz"
209 else:
210 outputkey = "poses"
211
212 keep = [outputkey, 'lengths', "y"]
213 gener = {key: generation[key].data.cpu().numpy() for key in keep}
214 if not gen_only:
215 visu = {key: visualization[key].data.cpu().numpy() for key in keep}
216 recons = {}
217 # visualize regressor results
218 if 'vertices_hat' in reconstructions['ntf']:
219 recons['regressor'] = {
220 'output_vertices':
221 reconstructions['ntf']['vertices_hat'].data.cpu().numpy(),
222 'lengths':
223 reconstructions['ntf']['lengths'].data.cpu().numpy(),
224 'y':
225 reconstructions['ntf']['y'].data.cpu().numpy()
226 }
227
228 recons['regressor_side'] = {
229 'output_vertices':
230 reconstructions['ntf']['vertices_hat'].data.cpu().numpy(),
231 'lengths':
232 reconstructions['ntf']['lengths'].data.cpu().numpy(),
233 'y':
234 reconstructions['ntf']['y'].data.cpu().numpy(),
235 'side':
236 True
237 }
238 # ToDo rendering overlap results
239 # recons['overlap'] = {'output_vertices':reconstructions['ntf']['vertices_hat'].data.cpu().numpy(),
240 # 'lengths':reconstructions['ntf']['lengths'].data.cpu().numpy(),
241 # 'y':reconstructions['ntf']['y'].data.cpu().numpy(),
242 # 'imgs':reconstructions['ntf']['imgs'],
243 # 'bbox':reconstructions['ntf']['bbox'].data.cpu().numpy(),
244 # 'cam':reconstructions['ntf']['preds'][0]['cam'].data.cpu().numpy()}
245 for mode, reconstruction in reconstructions.items():
246 recons[mode] = {
247 key: reconstruction[key].data.cpu().numpy()

Callers 1

viz_epochFunction · 0.85

Calls 6

pool_job_with_descFunction · 0.85
stack_imagesFunction · 0.85
stack_images_genFunction · 0.85
itemsMethod · 0.80
keysMethod · 0.80
valuesMethod · 0.80

Tested by

no test coverage detected