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

Method _aug_mapper

tensorpack/dataflow/image.py:210–226  ·  view source on GitHub ↗
(self, dp)

Source from the content-addressed store, hash-verified

208 self.augs.reset_state()
209
210 def _aug_mapper(self, dp):
211 dp = copy_mod.copy(dp) # always do a shallow copy, make sure the list is intact
212 copy_func = copy_mod.deepcopy if self._copy else lambda x: x # noqa
213 with self._exception_handler.catch():
214 major_image = self._index[0] # image to be used to get params. TODO better design?
215 im = copy_func(dp[major_image])
216 check_dtype(im)
217 tfms = self.augs.get_transform(im)
218 dp[major_image] = tfms.apply_image(im)
219 for idx in self._index[1:]:
220 check_dtype(dp[idx])
221 dp[idx] = tfms.apply_image(copy_func(dp[idx]))
222 for idx in self._coords_index:
223 coords = copy_func(dp[idx])
224 validate_coords(coords)
225 dp[idx] = tfms.apply_coords(coords)
226 return dp
227
228
229try:

Callers

nothing calls this directly

Calls 6

check_dtypeFunction · 0.85
validate_coordsFunction · 0.85
catchMethod · 0.80
get_transformMethod · 0.45
apply_imageMethod · 0.45
apply_coordsMethod · 0.45

Tested by

no test coverage detected