(self, path, opt, remove_static_joints=True)
| 202 | |
| 203 | class Human36mDataset(MocapDataset): |
| 204 | def __init__(self, path, opt, remove_static_joints=True): |
| 205 | super().__init__(fps=50, skeleton=h36m_skeleton) |
| 206 | self.train_list = ['S1', 'S5', 'S6', 'S7', 'S8'] |
| 207 | self.test_list = ['S9', 'S11'] |
| 208 | |
| 209 | self._cameras = copy.deepcopy(h36m_cameras_extrinsic_params) |
| 210 | for cameras in self._cameras.values(): |
| 211 | for i, cam in enumerate(cameras): |
| 212 | cam.update(h36m_cameras_intrinsic_params[i]) |
| 213 | for k, v in cam.items(): |
| 214 | if k not in ['id', 'res_w', 'res_h']: |
| 215 | cam[k] = np.array(v, dtype='float32') |
| 216 | |
| 217 | if opt.crop_uv == 0: |
| 218 | cam['center'] = normalize_screen_coordinates(cam['center'], w=cam['res_w'], h=cam['res_h']).astype( |
| 219 | 'float32') |
| 220 | cam['focal_length'] = cam['focal_length'] / cam['res_w'] * 2 |
| 221 | |
| 222 | if 'translation' in cam: |
| 223 | cam['translation'] = cam['translation'] / 1000 |
| 224 | |
| 225 | cam['intrinsic'] = np.concatenate((cam['focal_length'], |
| 226 | cam['center'], |
| 227 | cam['radial_distortion'], |
| 228 | cam['tangential_distortion'])) |
| 229 | |
| 230 | data = np.load(path,allow_pickle=True)['positions_3d'].item() |
| 231 | |
| 232 | self._data = {} |
| 233 | for subject, actions in data.items(): |
| 234 | self._data[subject] = {} |
| 235 | for action_name, positions in actions.items(): |
| 236 | self._data[subject][action_name] = { |
| 237 | 'positions': positions, |
| 238 | 'cameras': self._cameras[subject], |
| 239 | } |
| 240 | |
| 241 | if remove_static_joints: |
| 242 | self.remove_joints([4, 5, 9, 10, 11, 16, 20, 21, 22, 23, 24, 28, 29, 30, 31]) |
| 243 | |
| 244 | self._skeleton._parents[11] = 8 |
| 245 | self._skeleton._parents[14] = 8 |
| 246 | |
| 247 | def supports_semi_supervised(self): |
| 248 | return True |
nothing calls this directly
no test coverage detected