(self, train_sample_interval=1)
| 266 | return eval_result |
| 267 | |
| 268 | def load_data(self, train_sample_interval=1): |
| 269 | |
| 270 | content = np.load(self.annot_path, allow_pickle=True) |
| 271 | try: |
| 272 | frame_range = content['frame_range'] |
| 273 | except KeyError: |
| 274 | self.num_data = len(content['image_path']) |
| 275 | frame_range = \ |
| 276 | np.array([[i, i + 1] for i in range(self.num_data)]) |
| 277 | |
| 278 | num_examples = len(frame_range) |
| 279 | |
| 280 | if 'meta' in content: |
| 281 | meta = content['meta'].item() |
| 282 | print('meta keys:', meta.keys()) |
| 283 | else: |
| 284 | meta = None |
| 285 | print( |
| 286 | 'No meta info provided! Please give height and width manually') |
| 287 | |
| 288 | print( |
| 289 | f'Start loading humandata {self.annot_path} into memory...\nDataset includes: {content.files}' |
| 290 | ) |
| 291 | tic = time.time() |
| 292 | image_path = content['image_path'] |
| 293 | |
| 294 | if meta is not None and 'height' in meta: |
| 295 | height = np.array(meta['height']) |
| 296 | width = np.array(meta['width']) |
| 297 | image_shape = np.stack([height, width], axis=-1) |
| 298 | else: |
| 299 | image_shape = None |
| 300 | |
| 301 | if meta is not None and 'gender' in meta and len(meta['gender']) != 0: |
| 302 | gender = meta['gender'] |
| 303 | else: |
| 304 | gender = None |
| 305 | |
| 306 | face_valid = meta['face_valid'] |
| 307 | lhand_valid = meta['lefthand_valid'] |
| 308 | rhand_valid = meta['righthand_valid'] |
| 309 | valid_label = meta['valid_label'] |
| 310 | is_crowd = meta['iscrowd'] |
| 311 | keypoints_valid = content['keypoints2d_ubody'][:,:,2].sum(-1)!=0 |
| 312 | bbox_xywh = content['bbox_xywh'] |
| 313 | |
| 314 | if 'smplx' in content: |
| 315 | smplx = content['smplx'].item() |
| 316 | as_smplx = 'smplx' |
| 317 | elif 'smpl' in content: |
| 318 | smplx = content['smpl'].item() |
| 319 | as_smplx = 'smpl' |
| 320 | elif 'smplh' in content: |
| 321 | smplx = content['smplh'].item() |
| 322 | as_smplx = 'smplh' |
| 323 | # TODO: temp solution, should be more general. But SHAPY is very special |
| 324 | elif self.__class__.__name__ == 'SHAPY': |
| 325 | smplx = {} |
no test coverage detected