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

Method __call__

PATH/core/augmentation_pos.py:187–203  ·  view source on GitHub ↗

Perform data augmentation with random scaling & rotating.

(self, results)

Source from the content-addressed store, hash-verified

185 self.rot_prob = rot_prob
186
187 def __call__(self, results):
188 """Perform data augmentation with random scaling & rotating."""
189 s = results['scale']
190
191 sf = self.scale_factor
192 rf = self.rot_factor
193
194 s_factor = np.clip(np.random.randn() * sf + 1, 1 - sf, 1 + sf)
195 s = s * s_factor
196
197 r_factor = np.clip(np.random.randn() * rf, -rf * 2, rf * 2)
198 r = r_factor if np.random.rand() <= self.rot_prob else 0
199
200 results['scale'] = s
201 results['rotation'] = r
202
203 return results
204
205class TopDownAffine:
206 """Affine transform the image to make input.

Callers

nothing calls this directly

Calls 1

clipMethod · 0.80

Tested by

no test coverage detected