def test_can_save_and_load(self): source_dataset = Dataset.from_iterable([ DatasetItem(id='1', image=np.ones((8, 8, 3)), annotations=[Label(0)] ), DatasetItem(id='2', image=np.ones((10, 10, 3)), annotations=[Label(1)] ), DatasetItem(id='3', image=np.ones((10, 10, 3)), annotations=[Label(0)] ), DatasetItem(id='4', image=np.ones((8, 8, 3)), annotations=[Label(2)] ), ], categories={ AnnotationType.label: LabelCategories.from_iterable( 'label_' + str(label) for label in range(3)), }) with TestDir() as test_dir: ImagenetConverter.convert(source_dataset, test_dir, save_images=True) parsed_dataset = ImagenetImporter()(test_dir).make_dataset() compare_datasets(self, source_dataset, parsed_dataset, require_images=True)
def test_can_detect_imagenet(self): self.assertTrue(ImagenetImporter.detect(DUMMY_DATASET_DIR))