18 lines
505 B
Python
18 lines
505 B
Python
from paddleocr import PaddleOCR
|
|
# 初始化 PaddleOCR 实例
|
|
ocr = PaddleOCR(
|
|
use_doc_orientation_classify=False,
|
|
use_doc_unwarping=False,
|
|
use_textline_orientation=False,
|
|
text_det_limit_side_len=736, # 设置图像边长限制
|
|
)
|
|
|
|
# 对示例图像执行 OCR 推理
|
|
result = ocr.predict(
|
|
input="./8B457A96D0F016EAB6EB6D24AD70406C.jpg")
|
|
|
|
# 可视化结果并保存 json 结果
|
|
for res in result:
|
|
res.print()
|
|
res.save_to_img("output")
|
|
res.save_to_json("output") |