(self, train_sample_interval=1,
hand_bbox_ratio=1, body_bbox_ratio=1)
| 135 | data_strategy=getattr(cfg, 'data_strategy', None)) |
| 136 | |
| 137 | def load_data(self, train_sample_interval=1, |
| 138 | hand_bbox_ratio=1, body_bbox_ratio=1): |
| 139 | |
| 140 | content = np.load(self.annot_path, allow_pickle=True) |
| 141 | try: |
| 142 | frame_range = content['frame_range'] |
| 143 | except KeyError: |
| 144 | self.num_data = len(content['image_path']) |
| 145 | frame_range = \ |
| 146 | np.array([[i, i + 1] for i in range(self.num_data)]) |
| 147 | |
| 148 | num_examples = len(frame_range) |
| 149 | if 'meta' in content: |
| 150 | meta = content['meta'].item() |
| 151 | print('meta keys:', meta.keys()) |
| 152 | else: |
| 153 | meta = None |
| 154 | print( |
| 155 | 'No meta info provided! Please give height and width manually') |
| 156 | |
| 157 | print( |
| 158 | f'Start loading humandata {self.annot_path} into memory...\nDataset includes: {content.files}' |
| 159 | ) |
| 160 | tic = time.time() |
| 161 | image_path = content['image_path'] |
| 162 | if meta is not None and 'height' in meta and len(meta['height'])>0: |
| 163 | height = np.array(meta['height']) |
| 164 | width = np.array(meta['width']) |
| 165 | image_shape = np.stack([height, width], axis=-1) |
| 166 | else: |
| 167 | image_shape = None |
| 168 | |
| 169 | if meta is not None and 'gender' in meta and len(meta['gender']) != 0: |
| 170 | gender = np.array(meta['gender']) |
| 171 | else: |
| 172 | gender = None |
| 173 | bbox_xywh = content['bbox_xywh'] |
| 174 | |
| 175 | if 'smplx' in content: |
| 176 | smplx = content['smplx'].item() |
| 177 | as_smplx = 'smplx' |
| 178 | elif 'smpl' in content: |
| 179 | smplx = content['smpl'].item() |
| 180 | as_smplx = 'smpl' |
| 181 | elif 'smplh' in content: |
| 182 | smplx = content['smplh'].item() |
| 183 | as_smplx = 'smplh' |
| 184 | # TODO: temp solution, should be more general. But SHAPY is very special |
| 185 | elif self.__class__.__name__ == 'SHAPY': |
| 186 | smplx = {} |
| 187 | else: |
| 188 | raise KeyError('No SMPL for SMPLX available, please check keys:\n' |
| 189 | f'{content.files}') |
| 190 | |
| 191 | print('Smplx param', smplx.keys()) |
| 192 | |
| 193 | if 'lhand_bbox_xywh' in content and 'rhand_bbox_xywh' in content: |
| 194 | lhand_bbox_xywh = content['lhand_bbox_xywh'] |
nothing calls this directly
no test coverage detected