def test_save(self): config_file = 'tests/tlt_anno_test/save_config.yaml' cfg.merge_from_file(config_file) cfg.freeze() tltAnno = TltAnno(cfg) output_data = self.get_output_data() tltAnno.save(output_data) input_data = np.loadtxt( 'tests/tlt_anno_test/input_data/labels/lena.txt', dtype=np.str, delimiter=' ') output_data = np.loadtxt( 'tests/tlt_anno_test/output_data/labels/lena.txt', dtype=np.str, delimiter=' ') print(input_data) print(output_data) res = input_data == output_data print(res) assert np.sum(res) == 15 shutil.rmtree('tests/tlt_anno_test/output_data')
def imagefolder_to_lmdb(): config_file = 'tests/att_face_to_lmdb/att_face_to_lmdb.yaml' cfg.merge_from_file(config_file) cfg.freeze() parser = build_anno(cfg.ANNO.PARSER, cfg) creator = build_anno(cfg.ANNO.CREATOR, cfg) input_data = parser.process() creator.save(input_data)
def test_process(self): config_file = 'tests/visdrone_anno_test/process_config.yaml' cfg.merge_from_file(config_file) cfg.freeze() visdroneAnno = VisDroneAnno(cfg) output_data = visdroneAnno.process() print(output_data) real_data = self.get_output_data() assert output_data == real_data
def main(): parser = default_argument_parser() args = parser.parse_args() if args.version: print('pnno: v{}'.format(get_version())) sys.exit(0) if not args.config_file: parser.print_usage() sys.exit(1) cfg.merge_from_file(args.config_file) cfg.freeze() processor = AnnoProcessor(cfg) processor.process()
def test_save(self): config_file = 'tests/yolov5_anno_test/save_config.yaml' cfg.merge_from_file(config_file) cfg.freeze() labelImgAnno = YoLoV5Anno(cfg) output_data = self.get_output_data() labelImgAnno.save(output_data) input_data = np.loadtxt( 'tests/yolov5_anno_test/input_data/labels/lena.txt', dtype=np.float, delimiter=' ') output_data = np.loadtxt( 'tests/yolov5_anno_test/output_data/labels/lena.txt', dtype=np.float, delimiter=' ') print(input_data) print(output_data) assert np.sum(input_data == output_data) == 1 shutil.rmtree('tests/yolov5_anno_test/output_data')