update whl (#10916)
parent
23fbdab33e
commit
79fc4c5bef
ppstructure/recovery
27
paddleocr.py
27
paddleocr.py
|
@ -59,7 +59,7 @@ __all__ = [
|
|||
]
|
||||
|
||||
SUPPORT_DET_MODEL = ['DB']
|
||||
VERSION = '2.7.0.1'
|
||||
VERSION = '2.7.0.3'
|
||||
SUPPORT_REC_MODEL = ['CRNN', 'SVTR_LCNet']
|
||||
BASE_DIR = os.path.expanduser("~/.paddleocr/")
|
||||
|
||||
|
@ -616,7 +616,14 @@ class PaddleOCR(predict_system.TextSystem):
|
|||
super().__init__(params)
|
||||
self.page_num = params.page_num
|
||||
|
||||
def ocr(self, img, det=True, rec=True, cls=True, bin=False, inv=False, alpha_color=(255, 255, 255)):
|
||||
def ocr(self,
|
||||
img,
|
||||
det=True,
|
||||
rec=True,
|
||||
cls=True,
|
||||
bin=False,
|
||||
inv=False,
|
||||
alpha_color=(255, 255, 255)):
|
||||
"""
|
||||
OCR with PaddleOCR
|
||||
args:
|
||||
|
@ -784,15 +791,13 @@ def main():
|
|||
img_name = os.path.basename(img_path).split('.')[0]
|
||||
logger.info('{}{}{}'.format('*' * 10, img_path, '*' * 10))
|
||||
if args.type == 'ocr':
|
||||
result = engine.ocr(
|
||||
img_path,
|
||||
det=args.det,
|
||||
rec=args.rec,
|
||||
cls=args.use_angle_cls,
|
||||
bin=args.binarize,
|
||||
inv=args.invert,
|
||||
alpha_color=args.alphacolor
|
||||
)
|
||||
result = engine.ocr(img_path,
|
||||
det=args.det,
|
||||
rec=args.rec,
|
||||
cls=args.use_angle_cls,
|
||||
bin=args.binarize,
|
||||
inv=args.invert,
|
||||
alpha_color=args.alphacolor)
|
||||
if result is not None:
|
||||
for idx in range(len(result)):
|
||||
res = result[idx]
|
||||
|
|
|
@ -36,6 +36,8 @@ def convert_info_docx(img, res, save_folder, img_name):
|
|||
|
||||
flag = 1
|
||||
for i, region in enumerate(res):
|
||||
if len(region['res']) == 0:
|
||||
continue
|
||||
img_idx = region['img_idx']
|
||||
if flag == 2 and region['layout'] == 'single':
|
||||
section = doc.add_section(WD_SECTION.CONTINUOUS)
|
||||
|
|
Loading…
Reference in New Issue