MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / get_transform

Method get_transform

tensorpack/dataflow/imgaug/base.py:239–257  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

237 a.reset_state()
238
239 def get_transform(self, img):
240 check_dtype(img)
241 assert img.ndim in [2, 3], img.ndim
242
243 from .transform import LazyTransform, TransformList
244 # The next augmentor requires the previous one to finish.
245 # So we have to use LazyTransform
246 tfms = []
247 for idx, a in enumerate(self.augmentors):
248 if idx == 0:
249 t = a.get_transform(img)
250 else:
251 t = LazyTransform(a.get_transform)
252
253 if isinstance(t, TransformList):
254 tfms.extend(t.tfms)
255 else:
256 tfms.append(t)
257 return TransformList(tfms)
258
259 def __str__(self):
260 repr_each_aug = ",\n".join([" " + repr(x) for x in self.augmentors])

Callers

nothing calls this directly

Calls 4

check_dtypeFunction · 0.85
LazyTransformClass · 0.85
TransformListClass · 0.85
appendMethod · 0.80

Tested by

no test coverage detected