From e40f8d7f45df3be3fba4b85231562220db2431be Mon Sep 17 00:00:00 2001 From: litongjava Date: Sun, 28 Apr 2024 07:06:12 -1000 Subject: [PATCH] change thread --- src/main/java/com/luooqi/ocr/local/PaddlePaddleOCRV4.java | 1 - src/test/java/com/litongjava/RapidOcrTest.java | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/luooqi/ocr/local/PaddlePaddleOCRV4.java b/src/main/java/com/luooqi/ocr/local/PaddlePaddleOCRV4.java index 758baa0..878ddc5 100644 --- a/src/main/java/com/luooqi/ocr/local/PaddlePaddleOCRV4.java +++ b/src/main/java/com/luooqi/ocr/local/PaddlePaddleOCRV4.java @@ -32,6 +32,5 @@ public OcrResult ocr(File imageFile) { } public void close() { - } } diff --git a/src/test/java/com/litongjava/RapidOcrTest.java b/src/test/java/com/litongjava/RapidOcrTest.java index 4349ac8..0bfba20 100644 --- a/src/test/java/com/litongjava/RapidOcrTest.java +++ b/src/test/java/com/litongjava/RapidOcrTest.java @@ -8,10 +8,15 @@ public class RapidOcrTest { public static void main(String[] args) { + String imagePath = "C:\\Users\\Administrator\\Desktop\\01.jpg"; + + // init HardwareConfig onnxConfig = HardwareConfig.getOnnxConfig(); onnxConfig.setNumThread(2); InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4_SERVER, onnxConfig); - OcrResult ocrResult = engine.runOcr("C:\\Users\\Administrator\\Desktop\\01.jpg"); + + // run + OcrResult ocrResult = engine.runOcr(imagePath); System.out.println(ocrResult.getStrRes().trim()); } }