Exemple #1
0
    def test_can_save_dataset_with_cyrillic_and_spaces_in_filename(self):
        dataset = Dataset.from_iterable([
            DatasetItem(id='кириллица с пробелом', image=np.ones((4, 2, 3))),
        ])

        with TestDir() as test_dir:
            check_save_and_load(self,
                                dataset,
                                ImageDirConverter.convert,
                                test_dir,
                                importer='image_dir')
Exemple #2
0
    def test_relative_paths(self):
        dataset = Dataset.from_iterable([
            DatasetItem(id='1', image=np.ones((4, 2, 3))),
            DatasetItem(id='subdir1/1', image=np.ones((2, 6, 3))),
            DatasetItem(id='subdir2/1', image=np.ones((5, 4, 3))),
        ])

        with TestDir() as test_dir:
            check_save_and_load(self,
                                dataset,
                                ImageDirConverter.convert,
                                test_dir,
                                importer='image_dir')
Exemple #3
0
    def test_can_load(self):
        dataset = Dataset.from_iterable([
            DatasetItem(id=1, image=np.ones((10, 6, 3))),
            DatasetItem(id=2, image=np.ones((5, 4, 3))),
        ])

        with TestDir() as test_dir:
            check_save_and_load(self,
                                dataset,
                                ImageDirConverter.convert,
                                test_dir,
                                importer='image_dir',
                                require_images=True)
Exemple #4
0
    def test_can_save_and_load_image_with_arbitrary_extension(self):
        dataset = Dataset.from_iterable([
            DatasetItem(id='q/1',
                        image=Image(path='q/1.JPEG', data=np.zeros(
                            (4, 3, 3)))),
            DatasetItem(id='a/b/c/2',
                        image=Image(path='a/b/c/2.bmp',
                                    data=np.zeros((3, 4, 3)))),
        ])

        with TestDir() as test_dir:
            check_save_and_load(self,
                                dataset,
                                ImageDirConverter.convert,
                                test_dir,
                                importer='image_dir',
                                require_images=True)
Exemple #5
0
 def _test_save_and_load(self,
                         source_dataset,
                         converter,
                         test_dir,
                         target_dataset=None,
                         importer_args=None,
                         **kwargs):
     return check_save_and_load(self,
                                source_dataset,
                                converter,
                                test_dir,
                                importer='mot_seq',
                                target_dataset=target_dataset,
                                importer_args=importer_args,
                                **kwargs)
Exemple #6
0
 def _test_save_and_load(self,
                         source_dataset,
                         converter,
                         test_dir,
                         target_dataset=None,
                         importer_args=None,
                         **kwargs):
     kwargs.setdefault('dimension', Dimensions.dim_3d)
     return check_save_and_load(self,
                                source_dataset,
                                converter,
                                test_dir,
                                importer='kitti_raw',
                                target_dataset=target_dataset,
                                importer_args=importer_args,
                                **kwargs)
Exemple #7
0
 def _test_save_and_load(self,
                         source_dataset,
                         converter,
                         test_dir,
                         target_dataset=None,
                         importer_args=None,
                         compare=compare_datasets_strict,
                         **kwargs):
     return check_save_and_load(self,
                                source_dataset,
                                converter,
                                test_dir,
                                importer='datumaro',
                                target_dataset=target_dataset,
                                importer_args=importer_args,
                                compare=compare,
                                **kwargs)