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

Function TranslateX

PATH/core/data/transforms/pedattr_transforms.py:96–101  ·  view source on GitHub ↗
(img, v)

Source from the content-addressed store, hash-verified

94
95
96def TranslateX(img, v): # [-150, 150] => percentage: [-0.45, 0.45]
97 assert -0.45 <= v <= 0.45
98 if random.random() > 0.5:
99 v = -v
100 v = v * img.size[0]
101 return img.transform(img.size, PIL.Image.AFFINE, (1, 0, v, 0, 1, 0))
102
103
104def TranslateXabs(img, v): # [-150, 150] => percentage: [-0.45, 0.45]

Callers

nothing calls this directly

Calls 1

transformMethod · 0.45

Tested by

no test coverage detected