1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- '''
- Author: zeke-chin zeke-chin@icloud.com
- Date: 2022-09-28 20:28:41
- LastEditors: zeke-chin zeke-chin@icloud.com
- LastEditTime: 2022-10-12 21:15:26
- FilePath: /to_md/HR_OCR/to_md/use.py
- Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- '''
- from pathlib import Path
- from tkinter import image_types
- from new import MD, Image, Dataset, parser_path
- # config
- # 图片路径
- image_path = Path('/Users/sxkj/Desktop/1/img')
- image_type = 1
- # 是否旋转
- image_rotate = False
- ocr_address = 'local' # 'local' 'TXtest' 'TXsb' 'DXtest' 'DXsb'
- ocr_name = 'regbook' # 'cet' 'idcard' 'bankcard' 'regbook' 'schoolcert' 'business_license'
- md_name = 'RE_1.7'
- filed = 'regbook' # 'cet' 'idcard' 'bankcard' 'regbook_0' 'regbook_1' 'schoolcert' 'business_license'
- # 若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_path.stem), 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()
|