def setUp(self):
            super().setUp()

            assert replace_text_in_file(self.configuration_file,
                                        'data/WIDERFace', '../../data/airport')
            assert replace_text_in_file(self.configuration_file, 'val.json',
                                        'annotation_faces_train.json')
    def setUp(self):
        self.model_name = 'person-vehicle-bike-detection-crossroad-1016'
        self.snapshot_name = 'person_vehicle_bike_sd512_mb2_clustered_epoch_21.pth'

        self.data_folder = '../../data'
        self.work_dir = os.path.join('/tmp', self.model_name)
        os.makedirs(self.work_dir, exist_ok=True)
        self.configuration_file = f'./configs/{self.model_name}.py'
        os.system(f'cp {self.configuration_file} {self.work_dir}/')
        self.configuration_file = os.path.join(
            self.work_dir, os.path.basename(self.configuration_file))
        self.ote_url = 'https://download.01.org/opencv/openvino_training_extensions'
        self.url = f'{self.ote_url}/models/object_detection/{self.snapshot_name}'
        download_if_not_yet(self.work_dir, self.url)

        assert replace_text_in_file(self.configuration_file, 'total_epochs =',
                                    'total_epochs = 25#')
        assert replace_text_in_file(
            self.configuration_file, 'work_dir =',
            f'work_dir = "{os.path.join(self.work_dir, "outputs")}" #')
        assert replace_text_in_file(
            self.configuration_file, 'load_from = None',
            f'load_from = "{os.path.join(self.work_dir, self.snapshot_name)}"')
        assert replace_text_in_file(self.configuration_file,
                                    'annotation_example_train.json',
                                    'annotation_example_val.json')
        assert replace_text_in_file(self.configuration_file, '/train', '/val')
        def setUp(self):
            super().setUp()

            assert replace_text_in_file(
                self.configuration_file, 'data/text-dataset/',
                '../../data/horizontal_text_detection/')
            assert replace_text_in_file(self.configuration_file,
                                        'IC13TEST.json', 'annotation.json')
Ejemplo n.º 4
0
        def setUp(self):
            self.model_name = model_name

            self.data_folder = '../../data'
            self.work_dir = os.path.join('/tmp/', self.model_name)
            os.makedirs(self.work_dir, exist_ok=True)
            self.configuration_file = f'./face-detection/{self.model_name}/config.py'
            run_through_shell(f'cp {self.configuration_file} {self.work_dir}/')
            self.configuration_file = os.path.join(
                self.work_dir, os.path.basename(self.configuration_file))
            self.ote_url = 'https://download.01.org/opencv/openvino_training_extensions'
            self.url = f'{self.ote_url}/models/object_detection/v2/{self.model_name}.pth'
            download_if_not_yet(self.work_dir, self.url)

            assert replace_text_in_file(self.configuration_file,
                                        'samples_per_gpu=',
                                        'samples_per_gpu=1 ,#')
            assert replace_text_in_file(self.configuration_file,
                                        'total_epochs = 70',
                                        'total_epochs = 75')
            assert replace_text_in_file(self.configuration_file,
                                        'data/WIDERFace', '../../data/airport')
            assert replace_text_in_file(
                self.configuration_file, 'work_dir =',
                f'work_dir = "{os.path.join(self.work_dir, "outputs")}" #')
            assert replace_text_in_file(self.configuration_file, 'train.json',
                                        'annotation_faces_train.json')
            assert replace_text_in_file(self.configuration_file, 'val.json',
                                        'annotation_faces_train.json')
            assert replace_text_in_file(
                self.configuration_file, 'resume_from = None',
                f'resume_from = "{os.path.join(self.work_dir, self.model_name)}.pth"'
            )
        def setUp(self):
            self.model_name = model_name

            self.data_folder = '../../data/horizontal_text_detection'
            self.work_dir = os.path.join('/tmp', self.model_name)
            os.makedirs(self.work_dir, exist_ok=True)
            self.configuration_file = f'./horizontal-text-detection/{self.model_name}/config.py'
            run_through_shell(f'cp {self.configuration_file} {self.work_dir}/')
            self.configuration_file = os.path.join(
                self.work_dir, os.path.basename(self.configuration_file))
            self.ote_url = 'https://download.01.org/opencv/openvino_training_extensions'
            self.url = f'{self.ote_url}/models/object_detection/v2/{self.model_name}.pth'
            download_if_not_yet(self.work_dir, self.url)

            assert replace_text_in_file(self.configuration_file,
                                        'total_epochs = 25',
                                        'total_epochs = 35')
            assert replace_text_in_file(
                self.configuration_file, 'work_dir =',
                f'work_dir = "{os.path.join(self.work_dir, "outputs")}" #')
            assert replace_text_in_file(
                self.configuration_file, 'resume_from = None',
                f'resume_from = "{os.path.join(self.work_dir, self.model_name)}.pth"'
            )
            assert replace_text_in_file(
                self.configuration_file, 'data/text-dataset/',
                '../../data/horizontal_text_detection/')
            assert replace_text_in_file(
                self.configuration_file,
                'IC13TRAIN_IC15_IC17_IC19_MSRATD500_COCOTEXT.json',
                'annotation.json')
            assert replace_text_in_file(self.configuration_file,
                                        'IC13TEST.json', 'annotation.json')