123456789101112131415161718192021222324252627282930313233343536373839 |
- from pathlib import Path
- import time
- from new import MD, Image, Dataset, parser_path
- # config
- # 图片路径
- image_path = Path('/Users/sxkj/Desktop/测试文档/四六级/9.8/身份证/img')
- image_type = 1
- # 是否旋转
- image_rotate = True
- ocr_address = 'local' # 'local' 'test' 'sb'
- ocr_name = 'regbook' # 'cet' 'idcard' 'bankcard' 'regbook' 'schoolcert'
- md_name = 'RegBook'
- filed = 'regbook'
- # 若md_path为None 则默认使用图片父路径为markdown保存路径
- # md_path = '/Users/zeke/work/sx/OCR/HROCR/to_md/example' or image_path.parent
- md_path = None or image_path.parent
- md_file = parser_path(Path(md_path) / Path(md_name), image_rotate)
- if __name__ == '__main__':
- markdown = MD(md_file)
- dataset = Dataset(image_path, image_type, ocr_name, ocr_address, filed, image_rotate)
- print(len(dataset))
- for d in dataset():
- print(d)
- dataset.evaluate()
- print(dataset.accuracy)
- markdown.write_total_accuracy(dataset)
- markdown.write_table_accuracy(dataset)
- markdown.write_table_result(dataset)
- print(md_file)
- markdown.f.create_md_file()
|