コード例 #1
0
 def test_images_from_bytes_example_stream_convert_l(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source2'),
                              color_mode='L')
     s1, s2 = list(zip(*list(stream.get_epoch_iterator())))
     actual_s2_gen = (reorder_axes(s) for s in self.shapes[3:])
     actual_s2 = set((1, ) + s[1:] for s in actual_s2_gen)
     s2_shape = set(s.shape for s in s2)
     assert actual_s2 == s2_shape
コード例 #2
0
 def test_images_from_bytes_example_stream_convert_rgb(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source1'),
                              color_mode='RGB')
     s1, s2 = list(zip(*list(stream.get_epoch_iterator())))
     actual_s1_gen = (reorder_axes(s) for s in self.shapes[:3])
     actual_s1 = set((3, ) + s[1:] for s in actual_s1_gen)
     s1_shape = set(s.shape for s in s1)
     assert actual_s1 == s1_shape
コード例 #3
0
ファイル: test_image.py プロジェクト: Afrik/fuel
 def test_images_from_bytes_example_stream_convert_l(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source2'),
                              color_mode='L')
     s1, s2 = list(zip(*list(stream.get_epoch_iterator())))
     actual_s2_gen = (reorder_axes(s) for s in self.shapes[3:])
     actual_s2 = set((1,) + s[1:] for s in actual_s2_gen)
     s2_shape = set(s.shape for s in s2)
     assert actual_s2 == s2_shape
コード例 #4
0
ファイル: test_image.py プロジェクト: Afrik/fuel
 def test_images_from_bytes_example_stream_convert_rgb(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source1'),
                              color_mode='RGB')
     s1, s2 = list(zip(*list(stream.get_epoch_iterator())))
     actual_s1_gen = (reorder_axes(s) for s in self.shapes[:3])
     actual_s1 = set((3,) + s[1:] for s in actual_s1_gen)
     s1_shape = set(s.shape for s in s1)
     assert actual_s1 == s1_shape
コード例 #5
0
 def test_axis_labels(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source2', ))
     assert stream.axis_labels['source1'] == ('bytes', )
     assert stream.axis_labels['source2'] == ('channel', 'height', 'width')
     bstream = ImagesFromBytes(self.batch_stream,
                               which_sources=('source1', ))
     assert bstream.axis_labels['source1'] == ('batch', 'channel', 'height',
                                               'width')
     assert bstream.axis_labels['source2'] == ('batch', 'bytes')
コード例 #6
0
 def test_images_from_bytes_example_stream(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source1', 'source2'),
                              color_mode=None)
     s1, s2 = list(zip(*list(stream.get_epoch_iterator())))
     s1_shape = set(s.shape for s in s1)
     s2_shape = set(s.shape for s in s2)
     actual_s1 = set(reorder_axes(s) for s in self.shapes[:3])
     actual_s2 = set(reorder_axes(s) for s in self.shapes[3:])
     assert actual_s1 == s1_shape
     assert actual_s2 == s2_shape
コード例 #7
0
ファイル: test_image.py プロジェクト: Afrik/fuel
 def test_images_from_bytes_example_stream(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source1', 'source2'),
                              color_mode=None)
     s1, s2 = list(zip(*list(stream.get_epoch_iterator())))
     s1_shape = set(s.shape for s in s1)
     s2_shape = set(s.shape for s in s2)
     actual_s1 = set(reorder_axes(s) for s in self.shapes[:3])
     actual_s2 = set(reorder_axes(s) for s in self.shapes[3:])
     assert actual_s1 == s1_shape
     assert actual_s2 == s2_shape
コード例 #8
0
 def test_bytes_type_exception(self):
     stream = ImagesFromBytes(self.example_stream,
                              which_sources=('source2', ))
     assert_raises(TypeError, stream.transform_source_example, 54321,
                   'source2')