12345678910111213141516 |
- from paddleocr import PaddleOCR
- from pathlib import Path
- import time
- ocr = PaddleOCR(use_angle_cls=True, lang="ch", rec=True, use_gpu=True)
- test_dir = Path('img_test')
- count = 1
- start = time.perf_counter()
- for file in test_dir.iterdir():
- st = time.perf_counter()
- result = ocr.ocr(str(file), cls=True)
- print(f'第{count}张图片耗时:{format(time.perf_counter() - st)}')
- count += 1
- print(f'20张图片总耗时:{format(time.perf_counter() - start)}')
|