优化文档检测

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

@@ -1,6 +1,6 @@
x-env: x-env:
&template &template
image: fcb_photo_review:1.13.2 image: fcb_photo_review:1.13.4
restart: always restart: always
services: services:

View File

@@ -0,0 +1,4 @@
from onnxruntime import InferenceSession
PADDLE_DET = InferenceSession("model/object_det_model/ppyoloe_plus_crn_l_80e_coco_w_nms.onnx",
providers=["CUDAExecutionProvider"], provider_options=[{"device_id": 0}])

View File

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