det模型训练之后和infer效果不一致 #13536
-
Search before asking
Bug
Environment系统 win10 Minimal Reproducible Exampleimport cv2
import time
import sys
import os
import numpy as np
parent_folder_path = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..'))
sys.path.append(parent_folder_path)
from paddleocr import PaddleOCR
from libs.utils import read_image,write_image
ocr = PaddleOCR(lang="ch",det_model_dir="ai/models/det_db_inference", show_log=False)
if len(sys.argv) >1:
img = read_image(sys.argv[1])
else:
from libs.appium_driver import driver
img = driver.getScreenshotForCv2()
start = time.time()
result = ocr.ocr(img,cls=False,rec=False)
print(f'time: {time.time()-start}')
for idx in range(len(result)):
res = result[idx]
if res is None:
continue
for line in res:
print(line)
points = np.array(line, dtype=np.int32)
cv2.polylines(img, [points], isClosed=True, color=(0, 0, 255), thickness=1)
# cv2.imshow('Image with Annotations', img)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
cv2.imwrite('1.png',img) 这是我测试的代码 效果就是第二张图片 AdditionalNo response Are you willing to submit a PR?
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
试试传参加上 |
Beta Was this translation helpful? Give feedback.
-
参考文档:https://paddlepaddle.github.io/PaddleOCR/ppocr/model_train/detection.html#5-faq |
Beta Was this translation helpful? Give feedback.
-
厉害了 问题解决 但是736确实不够 我直接设置了3000 有没有什么参数可以直接让模型不限制这个呢 |
Beta Was this translation helpful? Give feedback.
-
参考链接:https://github.com/PaddlePaddle/PaddleOCR/blob/main/doc/doc_ch/inference_args.md |
Beta Was this translation helpful? Give feedback.
试试传参加上
det_limit_side_len=736