def test_main_process(self): # pull test data from gitlab config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '2b588582c1ad5b901f6b4cc1c8f81e15/dyda.config' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '41ed033f30b132a0a48d7ba214f75c41/00000015.json' input_data = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '73b6ab545229971f1149ade93dc1ca8f/00000015.json' output_data = lab_tools.pull_json_from_gitlab(output_url) # initialization determinator_ = DeterminatorConfidenceThreshold(dyda_config) # run determinator determinator_.reset() determinator_.metadata[0] = tools.remove_extension( input_data["filename"], 'base-only') determinator_.input_data.append(input_data) determinator_.run() # compare results with reference ref_path = output_data tar_path = determinator_.results report = dict_comparator.get_diff(ref_path, tar_path) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '065d9f508fafe96da77d4e02fbd4fc12/dyda.config.IrConverter' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '25ddbb2fc6e6dfc0d6375b6d568f7c56/input_data.temp' input_data = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '473956c9bdadd7847795d423b172e78b/output_data.json' output_data = lab_tools.pull_json_from_gitlab(output_url) # initialization converter_ = IrConverter(dyda_config_path=dyda_config) # run converter converter_.reset() converter_.input_data.append(input_data) converter_.run() # compare results with reference ref_data = output_data tar_data = list(converter_.output_data) diff = [(ref_data[i] - tar_data[i]) for i in range( len(ref_data))] diff_sum = sum(sum(diff)) self.assertEqual(diff_sum, 0.0)
def test_main_process(self): # pull test data from gitlab config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "dbd906035055b99da05308aa927b9f4a/DetectorYOLO.config") dyda_config = lab_tools.pull_json_from_gitlab(config_url) ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "6ce02b726d96edaf4cb4e4108fb9ba9f/DetectorYOLO_output.json") ref_data = lab_tools.pull_json_from_gitlab(ref_url) detector_yolo = DetectorYOLO(dyda_config_path=dyda_config) input_path = '/home/shared/DT42/test_data/test_detector/dog.jpg' detector_yolo.input_data = [image.read_img(input_path)] detector_yolo.run() tar_data = detector_yolo.results[0] report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) # Since the filename depending on time stamp, it wont match anyway for mis_match in report['mismatch_val']: for tar_key in mis_match['tar_key']: if tar_key == 'filename': continue else: self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): config_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'bb1bfe0785760aa7308f139a16bc4e76/' 'path_label_converter_dyda.config') dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' '7ad69fd8e0674843c74382f4d2ef6a16/' 'path_label_converter_input.json') input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'c2317edcab9d460e193827f1eb213568/' 'path_label_converter_results.json') # initialization converter_ = PathLabelConverter(dyda_config) converter_.reset() converter_.input_data = {'data_path': input_list} converter_.run() ref_data = lab_tools.pull_json_from_gitlab(output_url) tar_data = converter_.results if not ref_data == [] and not tar_data == []: report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '2f4b1e105fad5d935e83fa8e608c395e/'\ 'dyda.config.TimeScaleShiftConverter' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'a25e50ea3b063d3e57aed402de9d0d25/input_list.json' input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '4e8e4849534e68152507bdf3640d5bd1/output.json' output_list = lab_tools.pull_json_from_gitlab(output_url) # initialization converter_ = TimeScaleShiftConverter(dyda_config) for i in range(len(input_list)): # run converter converter_.reset() converter_.input_data.append( tools.parse_json(input_list[i])) converter_.run() # compare results with reference ref_data = output_list[i] tar_data = converter_.results if not ref_data == [] and not tar_data == []: report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): config_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' '99e8dae78033b647562b72835aa84f5e/' 'dyda.config.validator') dyda_config = lab_tools.pull_json_from_gitlab(config_url) output_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'e9d7eea7eff43a67ac4c8f9bae3ec3ee/' 'ref_results_validator.json') label_txt_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/' 'uploads/f1cf0a5cacb0e6dca35f0b400f9ce9e6/labels.txt') labels = lab_tools.pull_json_from_gitlab(label_txt_url) results_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/' 'uploads/6350c824e163ead49f4849145a3d116d/' 'classification.txt') classification_results = lab_tools.pull_json_from_gitlab(results_url) # initialization validator = ClassificationValidator(dyda_config) validator.reset() validator.input_data = [classification_results, labels] validator.run() ref_data = lab_tools.pull_json_from_gitlab(output_url) tar_data = validator.results if not ref_data == [] and not tar_data == []: report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): config_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'a38ca41418635e32dcbc82a46a25937f/' 'DetectionValidator.config') dyda_config = lab_tools.pull_json_from_gitlab(config_url) ref_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'b5b1692ae296653840758710304fb17f/ref_data.json') ref_data = lab_tools.pull_json_from_gitlab(ref_url) gt_url = ( 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' '66fbbb03bdc4be60e78a3385a457dfc5/ground_truth_data_all.json') gt = lab_tools.pull_json_from_gitlab(gt_url) det_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'bd96dfe182f45acc7c1034d1fdc11c9c/prediction_data_all.json') det = lab_tools.pull_json_from_gitlab(det_url) # initialization validator = DetectionValidator(dyda_config) validator.reset() validator.input_data = [det, gt] validator.run() tar_data = validator.results report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '06e852b64cd24cdb017a56c540e195db/FrameSelectorDownsampleFirst_input_list.json' input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '6ce81dd346759aef1d8f4cc81675662e/FrameSelectorDownsampleFirst_output_list.json' output_list = lab_tools.pull_json_from_gitlab(output_url) # initialization frame_selector_ = FrameSelectorDownsampleFirst() for i in range(len(input_list)): # run frame_selector frame_selector_.reset() frame_selector_.metadata[0] = tools.remove_extension( input_list[i]['filename'], 'base-only') frame_selector_.run() # compare results with reference ref_data = output_list[i] tar_data = frame_selector_.results report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab img_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'd2ebc6170f05578273b934cfb6ed7344/pict000301.jpg' json_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'c8457db3f0d2b1ddb1fd7f6730168b9c/metadata_pic301.json' result_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '952964ae5dbdb06eec74d716d7636576/pict000301_result.json' img = lab_tools.pull_img_from_gitlab(img_url) meta_data = lab_tools.pull_json_from_gitlab(json_url) ref_data = lab_tools.pull_json_from_gitlab(result_url) # initialization data = [img, meta_data] data_preprocessor_ = preprocessor.LabelMeDataPreProcessor() data_preprocessor_.meta_data = meta_data data_preprocessor_.input_data = data data_preprocessor_.run() tar_data = data_preprocessor_.results ref_data['data_path'] = [] report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/" "uploads/6bd42ac664cecf4fdc29a4ed894874d2/" "dyda.config.ClassifierAoiCornerAvg") dyda_config = lab_tools.pull_json_from_gitlab(config_url) img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "697de0fe3c7d5a530674ddd996a0129a/NG_TYPE2_0063.png") ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "1cd293379a63b3a843bfe47e754e495f/" "test_ClassifierAoiCornerAvg.json") img = lab_tools.pull_img_from_gitlab(img_url) ref_data = lab_tools.pull_json_from_gitlab(ref_url)[2]["results"][0] classifier = ClassifierAoiCornerAvg(dyda_config_path=dyda_config) classifier.input_data = [img] classifier.run() tar_data = classifier.results[0] report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '8710dfd057501758190778cb056e4449/dyda.config' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'a9324bdf32ed5a1e237be94fbc74c5d5/input.json' input_data = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '0f801ae6692bcc168ba1c5045b806c78/res.json' output_data = lab_tools.pull_json_from_gitlab(output_url) # initialization determinator_ = DeterminatorByRoi(dyda_config_path=dyda_config) # run determinator determinator_.reset() determinator_.input_data.append(input_data) determinator_.run() # compare results with reference ref_data = output_data tar_data = determinator_.results report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '79187835280b7adc8149e5e9a8e6ec9c/DeterminatorTargetLabel.config' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '4cdb639a0f0862f504e3223713da1c49/'\ 'DeterminatorTargetLabel_input.json' input_data = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'fd45424cee6c68c7de28fc16f6af734d/'\ 'DeterminatorTargetLabel_output.json' output_data = lab_tools.pull_json_from_gitlab(output_url) # initialization determinator_ = DeterminatorTargetLabel(dyda_config_path=dyda_config) # run determinator determinator_.reset() determinator_.metadata[0] = tools.remove_extension( input_data["filename"], 'base-only') determinator_.input_data.append(input_data) determinator_.run() # compare results with reference ref_path = output_data tar_path = determinator_.results[0] report = dict_comparator.get_diff(ref_path, tar_path) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'b7abe78697075dc2e47de5327c9f2de3/cv_classifier_input_list.json' input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'c9c8c98992abdf43036eed69d0e5fc3f/cv_output_list.json' output_list = lab_tools.pull_json_from_gitlab(output_url) # initialization classifier_ = ClassifierSimpleCV() classifier_.param["bkg_ref_path"] = '/home/shared/DT42/test_data/'\ 'test_demo_app_with_calibration/ref_bkg.png' image_list = [] for i in range(len(input_list)): image_list.append(image.read_img(input_list[i])) # run classifier classifier_.reset() classifier_.input_data = image_list classifier_.run() # compare results with reference for j in range(len(classifier_.results)): ref_data = output_list[j]['annotations'][0]['label'] tar_data = classifier_.results[j]['annotations'][0]['label'] self.assertEqual(ref_data, tar_data)
def compare(out_path=None, ref_path=None, tar_path=None, show=True, precision=2, ignore_keys=[]): """ compare two json file """ if ref_path is None: from dyda_utils import lab_tools ref_url = ('https://gitlab.com/DT42/galaxy42/dt42-lab-lib/uploads/' '5a82dca00757a21c82c681d7c8a8b773/cls_ref.json') ref_path = '/tmp/cls_ref.json' _ref = lab_tools.pull_json_from_gitlab(ref_url, save_to=ref_path) else: ref_path = ref_path if tar_path is None: from dyda_utils import lab_tools tar_url = ('https://gitlab.com/DT42/galaxy42/dt42-lab-lib/uploads/' '8c755ccdc97494bab294e5706ca738f7/cls_tar.json') tar_path = '/tmp/cls_tar.json' _tar = lab_tools.pull_json_from_gitlab(tar_url, save_to=tar_path) else: tar_path = tar_path report = get_diff(ref_path, tar_path, precision, ignore_keys) if show: show_report(report) else: pass if out_path is not None: tools.write_json(report, out_path) else: pass
def test_main_process(self): # pull test data from gitlab config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads" "/b6fec0ae2bc4c0913e3e765c2a87b135/" "dyda.config.inceptionv3_unittest") dyda_config = lab_tools.pull_json_from_gitlab(config_url) img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "4fa6b8a454f9b4041bdde316bac85a27/IMAG1450.jpg") ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "1ca61414f75fa6b93e09944a3bf1b66b/" "ref_json.json.inceptionv3_unittest") img = lab_tools.pull_img_from_gitlab(img_url) ref_data = lab_tools.pull_json_from_gitlab(ref_url) classifier = ClassifierInceptionv3(dyda_config_path=dyda_config) classifier.input_data = [img] classifier.run() tar_data = classifier.results[0] report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "abf5cf6f40a4b31216b0dabbe81a6863/" "dyda.config.mobilenet_unittest") dyda_config = lab_tools.pull_json_from_gitlab(config_url) img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "4fa6b8a454f9b4041bdde316bac85a27/IMAG1450.jpg") ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "8ea9ac61e3403981eca23c658b2cdac7/" "ref_results.json.mobilenet") img = lab_tools.pull_img_from_gitlab(img_url) ref_data = lab_tools.pull_json_from_gitlab(ref_url) classifier = ClassifierMobileNet(dyda_config_path=dyda_config) classifier.input_data = [img] classifier.run() tar_data = classifier.results[0] report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab tar_url = "https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"\ "3111a2fd3690b775e7e088aa97d26330/labelme_example.tar.gz" golden1_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '572998d818f6bceb5bf89346427243b7/golden_pic303.json' golden2_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '64d34d53518c44a68b7904ed4c1b8265/golden_pic301.json' output_list = list() output_list.append(lab_tools.pull_json_from_gitlab(golden1_url)) output_list.append(lab_tools.pull_json_from_gitlab(golden2_url)) # download tar.gz file self.pull_gz_from_gitlab(tar_url) # unzip the tar.gz file targz_path = os.path.basename(tar_url) tar = tarfile.open(targz_path, "r") tar.extractall() # get the all the image path in the folder unzip_folder = os.path.basename(tar_url)[:-7] img_paths = image.find_images(unzip_folder) # initialization data_reader_ = reader.LabelMeDataReader() for idx, img_path in enumerate(img_paths): data_reader_.reset_results() data_reader_.img_path = img_path data_reader_.run() # compare results with reference ref_data = output_list[idx] tar_data = data_reader_.results ref_data['folder'] = ref_data['folder'].replace('/home/hki541/dt42-dyda/tests', os.getcwd()) report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): config_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' '07478873045e3731eb2336445f87e080/dyda.config') dyda_config = lab_tools.pull_json_from_gitlab(config_url) output_url = ('https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/' 'a9fb65dbb1684979b5b3f6f8bce1784b/' 'uncertainty_unit_test_results.json') # initialization analyzer_ = UncertaintyAnalyzerSimple(dyda_config) analyzer_.reset() analyzer_.run() ref_data = lab_tools.pull_json_from_gitlab(output_url)[0] tar_data = analyzer_.results[0] if not ref_data == [] and not tar_data == []: report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads" "/418f17cdcdb4c9ee7555ef467e042a8c/dyda.config") dyda_config = lab_tools.pull_json_from_gitlab(config_url) cwd = os.getcwd() filename = ".testing_img.jpg" local_path = os.path.join(cwd, filename) img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "4fa6b8a454f9b4041bdde316bac85a27/IMAG1450.jpg") img = lab_tools.pull_img_from_gitlab(img_url, save_to=local_path) ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/" "4d57dd72be420cda1acea39f7665d76c/" "ref_data.json.framereader_unittest") ref_data = lab_tools.pull_json_from_gitlab(ref_url) reader = FrameReader(dyda_config_path=dyda_config) reader.input_data = [local_path] reader.run() tar_data = reader.results report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) # Since the filepath depending on cwd, the folder wont match anyway for mis_match in report['mismatch_val']: for tar_key in mis_match['tar_key']: if isinstance(tar_key, list) and tar_key[0] == 'data_path': _tar_val = os.path.basename(mis_match['tar_val']) _ref_val = os.path.basename(mis_match['ref_val']) self.assertEqual(_tar_val, _ref_val) else: self.assertEqual(report['mismatch_val'], []) os.remove(local_path)
def test_main_process(self): # pull test data from gitlab config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'abc67841cfb173c22cc13087fdd4d7b2/dyda.config' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '83db1facaef1bc83efc2b9ed25256ad1/park_input_list.json' input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '775252d8456257f3364f788556bb553c/park_output_list.json' output_list = lab_tools.pull_json_from_gitlab(output_url) frame_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'aa4675a8057f3ae79bf5c0153cdfc69e/'\ 'DeterminatorParkingLotStatus_frame_list.json' frame_list = lab_tools.pull_json_from_gitlab(frame_url) # initialization determinator_ = DeterminatorParkingLotStatus( dyda_config_path=dyda_config) # run determinator for i in range(len(output_list)): # run determinator determinator_.reset() determinator_.input_data.append([image.read_img(frame_list[i])]) determinator_.input_data.append(input_list[i][0]) determinator_.input_data.append(input_list[i][1]) determinator_.input_data.append(input_list[i][2]) determinator_.run() # compare results with reference if not determinator_.results == []: ref_data = output_list[i][0] tar_data = determinator_.results[0] report = dict_comparator.get_diff(ref_data, tar_data) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '36356e92cad4a608d4c84bba769c0d53/'\ 'dyda.config.DeterminatorCharacter' dyda_config = lab_tools.pull_json_from_gitlab(config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '521feb8def6e63d6e187622b171b7233/input_list.json' input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '9f25865b93a133bdec459ace16de8ccd/output_list.json' output_list = lab_tools.pull_json_from_gitlab(output_url) # initialization determinator_ = DeterminatorCharacter(dyda_config_path=dyda_config) # run determinator for i in range(len(input_list)): # run determinator determinator_.reset() determinator_.input_data.append(image.read_img(input_list[i])) determinator_.input_data.append( tools.parse_json(tools.replace_extension( input_list[i], 'json'))) determinator_.run() # compare results with reference if not determinator_.results == []: ref_data = output_list[i] tar_data = determinator_.results for j in range(len(ref_data)): for k in range(len(ref_data[j])): report = dict_comparator.get_diff( ref_data[j][k], tar_data[j][k]) self.assertEqual(report['extra_field'], []) self.assertEqual(report['missing_field'], []) self.assertEqual(report['mismatch_val'], [])
def test_main_process(self): # pull test data from gitlab input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'b7abe78697075dc2e47de5327c9f2de3/cv_classifier_input_list.json' input_list = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '01fd55515c6373ced2541f0aec287f44/ref_bkg.jpg' ref_output = lab_tools.pull_img_from_gitlab(output_url) # initialization learner_ = LearnerSimpleCV() image_list = [] for i in range(len(input_list)): image_list.append(image.read_img(input_list[i])) # run classifier learner_.reset() learner_.input_data = image_list learner_.run() diff = tinycv.l1_norm_diff_cv2(learner_.output_data, ref_output) self.assertEqual(sum(sum(diff)), 0.0)
import cv2 import unittest from dyda_utils import tools from dyda_utils import tinycv from dyda_utils import lab_tools from dyda_utils import dict_comparator from dyda.components.image_processor import ResizeImageProcessor # pull test data from gitlab print('[Test_ResizeImageProcessor] INFO: Pull 18 KB files from gitlab. ') input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '05e15e0a9133b30f5bfbe6c02d6847a4/input_img.png.0' input_data = lab_tools.pull_img_from_gitlab(input_url) config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '89e5f0abb7fc8a8f1591a45a105e6fca/dyda.config.ResizeImageProcessor' dyda_config_ResizeImageProcessor = lab_tools.pull_json_from_gitlab(config_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '42a4b5bc1dc5f0ec8aad0ac58abdb699/TestResizeImageProcessor_simple.bmp.0' output_ResizeImageProcessor = lab_tools.pull_img_from_gitlab(output_url) results_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'd291d335efe85ca594207fb4ff301a7b/TestResizeImageProcessor_simple.json' results_ResizeImageProcessor = lab_tools.pull_json_from_gitlab(results_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '42a4b5bc1dc5f0ec8aad0ac58abdb699/TestResizeImageProcessor_simple.bmp.0' output_ResizeImageProcessor = lab_tools.pull_img_from_gitlab(output_url) class TestResizeImageProcessor_simple(unittest.TestCase): """ Test simple case. """ def test_main_process(self): """ Main process of unit test. """
print('[Test_MergeImageProcessor] INFO: Pull 44 KB files from gitlab. ') input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '93cae1cc3aa4d6e1dcf9b9c052b1bc3b/00000001.png.0' input_data_0 = lab_tools.pull_img_from_gitlab(input_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '1bcd5ac6691702dbbe445e2712f0f59f/00000370.png.0' input_data_1 = lab_tools.pull_img_from_gitlab(input_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '4d471f2dd9750d9ebedfb90f0a8d7d3e/00000290.png.0' input_data_2 = lab_tools.pull_img_from_gitlab(input_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '10a38fd6449a7838689a30f2fcea0d88/00000030.png.0' input_data_3 = lab_tools.pull_img_from_gitlab(input_url) config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '7b0fb06a326646bd696fee48722b3f12/MergeImageProcessor.config' dyda_config_MergeImageProcessor = lab_tools.pull_json_from_gitlab(config_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '11c4450c29fbc111daa115e55c48100f/TestMergeImageProcessor_simple.bmp.0' output_MergeImageProcessor = lab_tools.pull_img_from_gitlab(output_url) class TestMergeImageProcessor_simple(unittest.TestCase): """ Test simple case. """ def test_main_process(self): """ Main process of unit test. """ # initialization comp = MergeImageProcessor( dyda_config_path=dyda_config_MergeImageProcessor) # run component
import cv2 import unittest from dyda_utils import tools from dyda_utils import tinycv from dyda_utils import lab_tools from dyda_utils import dict_comparator from dyda.components.image_processor import CalibrateImageProcessor # pull test data from gitlab print('[Test_CalibrateImageProcessor] INFO: Pull 189 KB files from gitlab. ') config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '6ad6cb384843092a563a6f3b20a86672/dyda.config.CalibrateImageProcessor' dyda_config_CalibrateImageProcessor = lab_tools.pull_json_from_gitlab( config_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '63ee0fac22eb43882dcefa3ec154df54/frame_781.jpg.0' input_data_calibrate = lab_tools.pull_img_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'f3dc2a06bef9759fb92549f1d0491a5e/TestCalibrateImageProcessor_simple.bmp.0' output_CalibrateImageProcessor = lab_tools.pull_img_from_gitlab(output_url) class TestCalibrateImageProcessor_simple(unittest.TestCase): """ Test simple case. """ def test_main_process(self): """ Main process of unit test. """ # initialization comp = CalibrateImageProcessor(
from dyda_utils import tinycv from dyda_utils import lab_tools from dyda_utils import dict_comparator from dyda.components.image_processor import CropRoiImageProcessor # pull test data from gitlab print('[Test_CropRoiImageProcessor] INFO: Pull 34 KB files from gitlab. ') input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '05e15e0a9133b30f5bfbe6c02d6847a4/input_img.png.0' input_data = lab_tools.pull_img_from_gitlab(input_url) input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '63ee0fac22eb43882dcefa3ec154df54/frame_781.jpg.0' input_data_calibrate = lab_tools.pull_img_from_gitlab(input_url) config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '78a5e35b2802ddbee8614aefbceb2fdb/dyda.config.CropRoiImageProcessor' dyda_config_CropRoiImageProcessor = lab_tools.pull_json_from_gitlab(config_url) metadata_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'ddc0b4970202e99c3a1248c5af66480e/TestResizeImageProcessor_metadata.json' metadata_CropRoiImageProcessor = lab_tools.pull_json_from_gitlab(metadata_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'c8c952e97929e1e3f47c15740f2b7dc4/TestCropRoiImageProcessor_simple.bmp.0' output_CropRoiImageProcessor = lab_tools.pull_img_from_gitlab(output_url) results_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '473726f1c287475360e7a177dbb2b4aa/TestCropRoiImageProcessor_simple.json' results_CropRoiImageProcessor = lab_tools.pull_json_from_gitlab(results_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'a9bf448d4c9831559053bde0dea0c595/TestCropRoiImageProcessor_metadata.bmp.0' output_CropRoiImageProcessor_m = lab_tools.pull_img_from_gitlab(output_url) results_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'eafb01647855d671bfa3e1c19596f9d7/TestCropRoiImageProcessor_metadata.json' results_CropRoiImageProcessor_m = lab_tools.pull_json_from_gitlab(results_url)
import cv2 import unittest from dyda_utils import tools from dyda_utils import tinycv from dyda_utils import lab_tools from dyda_utils import dict_comparator from dyda.components.determinator import DeterminatorLastingSec # pull test data from gitlab input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '987dd2321e3770967f452faefbb2e2fc/TestDeterminatorLastingSec_simple_input.json' input_data = lab_tools.pull_json_from_gitlab(input_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'e4bf8e156bd8804bf71021901e02951a/DeterminatorLastingSec_Simple_output.json' output_DeterminatorLastingSec = lab_tools.pull_json_from_gitlab(output_url) class TestDeterminatorLastingSec_simple(unittest.TestCase): """ Test simple case. """ def test_main_process(self): """ Main process of unit test. """ # initialization comp = DeterminatorLastingSec() # run component for i in range(len(input_data)): comp.reset() comp.input_data = input_data[i] comp.run()
import cv2 import unittest from dyda_utils import tools from dyda_utils import tinycv from dyda_utils import lab_tools from dyda_utils import dict_comparator from dyda.components.image_processor import BGR2GrayImageProcessor # pull test data from gitlab print('[Test_BGR2GrayImageProcessor] INFO: Pull 9 KB files from gitlab. ') input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '05e15e0a9133b30f5bfbe6c02d6847a4/input_img.png.0' input_data = lab_tools.pull_img_from_gitlab(input_url) config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ '886e16adbfb8d630ead9ab74e88d113c/BGR2GrayImageProcessor.config' dyda_config_BGR2GrayImageProcessor = lab_tools.pull_json_from_gitlab( config_url) output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\ 'baf7b36e1aff5a1abfb623af7fbf09a7/TestBGR2GrayImageProcessor_simple.bmp.0' output_BGR2GrayImageProcessor = lab_tools.pull_img_from_gitlab(output_url) class TestBGR2GrayImageProcessor_simple(unittest.TestCase): """ Test simple case. """ def test_main_process(self): """ Main process of unit test. """ # initialization comp = BGR2GrayImageProcessor( dyda_config_path=dyda_config_BGR2GrayImageProcessor) # run component