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')
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 = '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 setUpClass(cls): cls.template_file = f'model_templates/{problem_name}/{model_name}/template.yaml' cls.ann_file = ann_file cls.img_root = img_root cls.work_dir = tempfile.mkdtemp() cls.dependencies = get_dependencies(cls.template_file) cls.epochs_delta = 2 cls.total_epochs = get_epochs(cls.template_file) + cls.epochs_delta download_if_not_yet(cls.work_dir, cls.dependencies['snapshot'])
def setUpClass(cls): cls.template_file = f'model_templates/{problem_name}/{model_name}/template.yaml' cls.work_dir = tempfile.mkdtemp() cls.dependencies = get_dependencies(cls.template_file) download_if_not_yet(cls.work_dir, cls.dependencies['snapshot']) cls.test_export_thr = 0.031 run_through_shell( f'cd {os.path.dirname(cls.template_file)};' f'/opt/intel/openvino/bin/setupvars.sh;' f'python {cls.dependencies["export"]}' f' --load-weights {os.path.join(cls.work_dir, os.path.basename(cls.dependencies["snapshot"]))}' f' --save-model-to {os.path.join(cls.work_dir, "export")}')
def setUp(self): self.model_name = model_name if snapshot_name is None: self.snapshot_name = f'{self.model_name}.pth' else: self.snapshot_name = snapshot_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'./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) self.test_export_thr = 0.01