MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / __call__

Method __call__

PATH/core/data/transforms/pose_transforms.py:384–434  ·  view source on GitHub ↗
(self, results)

Source from the content-addressed store, hash-verified

382 self.use_udp = use_udp
383
384 def __call__(self, results):
385 image_size = results['ann_info']['image_size']
386
387 img = results['image']
388 joints_3d = results['joints_3d']
389 joints_3d_visible = results['joints_3d_visible']
390 c = results['center']
391 s = results['scale']
392 r = results['rotation']
393
394 if self.use_udp:
395 trans = get_warp_matrix(r, c * 2.0, image_size - 1.0, s * 200.0)
396 if not isinstance(img, list):
397 img = cv2.warpAffine(
398 img,
399 trans, (int(image_size[0]), int(image_size[1])),
400 flags=cv2.INTER_LINEAR)
401 else:
402 img = [
403 cv2.warpAffine(
404 i,
405 trans, (int(image_size[0]), int(image_size[1])),
406 flags=cv2.INTER_LINEAR) for i in img
407 ]
408
409 joints_3d[:, 0:2] = \
410 warp_affine_joints(joints_3d[:, 0:2].copy(), trans)
411
412 else:
413 trans = get_affine_transform(c, s, r, image_size)
414 if not isinstance(img, list):
415 img = cv2.warpAffine(
416 img,
417 trans, (int(image_size[0]), int(image_size[1])),
418 flags=cv2.INTER_LINEAR)
419 else:
420 img = [
421 cv2.warpAffine(
422 i,
423 trans, (int(image_size[0]), int(image_size[1])),
424 flags=cv2.INTER_LINEAR) for i in img
425 ]
426 for i in range(results['ann_info']['num_joints']):
427 if joints_3d_visible[i, 0] > 0.0:
428 joints_3d[i, 0:2] = affine_transform(joints_3d[i, 0:2], trans)
429
430 results['image'] = img
431 results['joints_3d'] = joints_3d
432 results['joints_3d_visible'] = joints_3d_visible
433
434 return results
435
436
437class ToTensor:

Callers

nothing calls this directly

Calls 4

get_warp_matrixFunction · 0.90
warp_affine_jointsFunction · 0.90
get_affine_transformFunction · 0.90
affine_transformFunction · 0.90

Tested by

no test coverage detected