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

Method test_augmentors

tensorpack/dataflow/imgaug/imgaug_test.py:94–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

92 ])
93
94 def test_augmentors(self):
95 augmentors = self._get_augs()
96
97 img = _rand_image()
98 orig = img.copy()
99 tfms = augmentors.get_transform(img)
100
101 # test printing
102 print(augmentors)
103 print(tfms)
104
105 newimg = tfms.apply_image(img)
106 print(tfms) # lazy ones will instantiate after the first apply
107
108 newimg2 = tfms.apply_image(orig)
109 self.assertTrue(np.allclose(newimg, newimg2))
110 self.assertEqual(newimg2.shape[0], 30)
111
112 coords = np.asarray([[0, 0], [10, 12]], dtype="float32")
113 tfms.apply_coords(coords)
114
115 def test_legacy_usage(self):
116 augmentors = self._get_augs()

Callers

nothing calls this directly

Calls 5

_get_augsMethod · 0.95
_rand_imageFunction · 0.85
get_transformMethod · 0.45
apply_imageMethod · 0.45
apply_coordsMethod · 0.45

Tested by

no test coverage detected