MCPcopy Create free account
hub / github.com/TeleHuman/PBHC / load_data_dict

Function load_data_dict

motion_source/demo.py:176–201  ·  view source on GitHub ↗
(cfg)

Source from the content-addressed store, hash-verified

174
175
176def load_data_dict(cfg):
177 paths = cfg.paths
178 length, width, height = get_video_lwh(cfg.video_path)
179 if cfg.static_cam:
180 R_w2c = torch.eye(3).repeat(length, 1, 1)
181 else:
182 traj = torch.load(cfg.paths.slam)
183 if cfg.use_dpvo: # DPVO
184 traj_quat = torch.from_numpy(traj[:, [6, 3, 4, 5]])
185 R_w2c = quaternion_to_matrix(traj_quat).mT
186 else: # SimpleVO
187 R_w2c = torch.from_numpy(traj[:, :3, :3])
188 if cfg.f_mm is not None:
189 K_fullimg = create_camera_sensor(width, height, cfg.f_mm)[2].repeat(length, 1, 1)
190 else:
191 K_fullimg = estimate_K(width, height).repeat(length, 1, 1)
192
193 data = {
194 "length": torch.tensor(length),
195 "bbx_xys": torch.load(paths.bbx)["bbx_xys"],
196 "kp2d": torch.load(paths.vitpose),
197 "K_fullimg": K_fullimg,
198 "cam_angvel": compute_cam_angvel(R_w2c),
199 "f_imgseq": torch.load(paths.vit_features),
200 }
201 return data
202
203def save_npz(pred, save_path):
204 path1, path2, path3 = f'{save_path}'.split('/')[0:3]

Callers 1

demo.pyFile · 0.85

Calls 4

get_video_lwhFunction · 0.85
create_camera_sensorFunction · 0.85
quaternion_to_matrixFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected