优化文档检测

This commit is contained in:
2024-08-28 10:53:37 +08:00
parent e794002d28
commit d0f3f783ce
3 changed files with 7 additions and 6 deletions

View File

@@ -3,8 +3,8 @@ from collections import defaultdict
import cv2
import numpy as np
from onnxruntime import InferenceSession
from paddle_detection import PADDLE_DET
from paddle_detection.deploy.third_engine.onnx.infer import PredictConfig
from paddle_detection.deploy.third_engine.onnx.preprocess import Compose
from util import image_util, util
@@ -30,14 +30,11 @@ def predict_image(infer_config, predictor, img_path):
def detect_image(img_path):
onnx_file = "model/object_det_model/ppyoloe_plus_crn_x_80e_coco_w_nms.onnx"
infer_cfg = "model/object_det_model/infer_cfg.yml"
# load predictor
predictor = InferenceSession(onnx_file)
# load infer config
infer_config = PredictConfig(infer_cfg)
return predict_image(infer_config, predictor, img_path)
return predict_image(infer_config, PADDLE_DET, img_path)
def get_book_areas(image):