MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / get_transform

Method get_transform

tensorpack/dataflow/imgaug/paste.py:95–102  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

93 """
94
95 def get_transform(self, img):
96 img_shape = img.shape[:2]
97 assert self.background_shape[0] > img_shape[0] and self.background_shape[1] > img_shape[1]
98
99 y0 = self._rand_range(self.background_shape[0] - img_shape[0])
100 x0 = self._rand_range(self.background_shape[1] - img_shape[1])
101 l = int(x0), int(y0)
102 return TransformFactory(name=str(self), apply_image=lambda img: self._impl(img, l))
103
104 def _impl(self, img, loc):
105 x0, y0 = loc

Callers

nothing calls this directly

Calls 3

_implMethod · 0.95
TransformFactoryClass · 0.85
_rand_rangeMethod · 0.80

Tested by

no test coverage detected