MCPcopy
hub / github.com/nitrain/nitrain / test_image_to_image

Method test_image_to_image

tests/test_loaders.py:157–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

155 xb,yb = next(iter(gen))
156
157 def test_image_to_image(self):
158 img = ants.image_read(ants.get_data('r16'))
159 x = [img for _ in range(10)]
160 dataset = nt.Dataset(x, x)
161 loader = nt.Loader(dataset, images_per_batch=4)
162
163 x_batch, y_batch = next(iter(loader))
164
165 self.assertTrue(x_batch.shape == (4, 256, 256, 1))
166 self.assertTrue(y_batch.shape == (4, 256, 256, 1))
167
168 loader2 = loader.to_keras()
169 x_batch, y_batch = next(iter(loader2))
170
171 self.assertTrue(x_batch.shape == (4, 256, 256, 1))
172 self.assertTrue(y_batch.shape == (4, 256, 256, 1))
173
174 gen = record_generator(loader)
175 xb,yb = next(iter(gen))
176
177 def test_multi_image_to_image(self):
178 import ants

Callers

nothing calls this directly

Calls 2

to_kerasMethod · 0.95
record_generatorFunction · 0.90

Tested by

no test coverage detected