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

Method __call__

PATH/core/augmentation_pos.py:67–91  ·  view source on GitHub ↗

Perform data augmentation with random image flip.

(self, results)

Source from the content-addressed store, hash-verified

65 self.flip_prob = flip_prob
66
67 def __call__(self, results):
68 """Perform data augmentation with random image flip."""
69 img = results['image']
70 joints_3d = results['joints_3d']
71 joints_3d_visible = results['joints_3d_visible']
72 center = results['center']
73
74 # A flag indicating whether the image is flipped,
75 # which can be used by child class.
76 flipped = False
77 if np.random.rand() <= self.flip_prob:
78 flipped = True
79 img = img[:, ::-1, :]
80 joints_3d, joints_3d_visible = fliplr_joints(
81 joints_3d, joints_3d_visible, img.shape[1],
82 results['ann_info']['flip_pairs'])
83 center[0] = img.shape[1] - center[0] - 1
84
85 results['image'] = img
86 results['joints_3d'] = joints_3d
87 results['joints_3d_visible'] = joints_3d_visible
88 results['center'] = center
89 results['flipped'] = flipped
90
91 return results
92
93class TopDownHalfBodyTransform:
94 """Data augmentation with half-body transform. Keep only the upper body or

Callers

nothing calls this directly

Calls 1

fliplr_jointsFunction · 0.90

Tested by

no test coverage detected