MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / __call__

Method __call__

util/formatting.py:204–281  ·  view source on GitHub ↗

Call function to transform and format common fields in results. Args: results (dict): Result dict contains the data to convert. Returns: dict: The result dict contains the data that is formatted with \ default bundle.

(self, results)

Source from the content-addressed store, hash-verified

202 self.pad_val = pad_val
203
204 def __call__(self, results):
205 """Call function to transform and format common fields in results.
206
207 Args:
208 results (dict): Result dict contains the data to convert.
209
210 Returns:
211 dict: The result dict contains the data that is formatted with \
212 default bundle.
213 """
214 data_keys = [
215 'joint_img', # keypoints2d
216 'smplx_joint_img', #smplx_joint_img, # projected smplx if valid cam_param, else same as keypoints2d
217 'joint_cam', # joint_cam actually not used in any loss, # raw kps3d probably without ra
218 'smplx_joint_cam', # kps3d with body, face, hand ra
219 'smplx_pose',
220 'smplx_shape',
221 'smplx_expr',
222 'lhand_bbox_center',
223 'lhand_bbox_size',
224 'rhand_bbox_center',
225 'rhand_bbox_size',
226 'face_bbox_center',
227 'face_bbox_size',
228 'body_bbox_center',
229 'body_bbox_size',
230 'joint_valid',
231 'joint_trunc',
232 'smplx_joint_valid',
233 'smplx_joint_trunc',
234 'smplx_pose_valid',
235 'smplx_shape_valid',
236 'smplx_expr_valid',
237 'is_3D',
238 'lhand_bbox_valid',
239 'rhand_bbox_valid',
240 'face_bbox_valid',
241 'body_bbox_valid',
242 'body_bbox',
243 'lhand_bbox',
244 'rhand_bbox',
245 'face_bbox',
246 'gender',
247 'bb2img_trans',
248 'img2bb_trans',
249 'ann_idx'
250 ]
251 if 'img' in results:
252 img = results['img']
253 if self.img_to_float is True and img.dtype == np.uint8:
254 # Normally, image is of uint8 type without normalization.
255 # At this time, it needs to be forced to be converted to
256 # flot32, otherwise the model training and inference
257 # will be wrong. Only used for YOLOX currently .
258 img = img.astype(np.float32)
259 # add default meta keys
260 results = self._add_default_meta_keys(results)
261 if len(img.shape) < 3:

Callers

nothing calls this directly

Calls 2

to_tensorFunction · 0.70

Tested by

no test coverage detected