-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from litongjava/rapidocr-onnx
Rapidocr onnx
- Loading branch information
Showing
2 changed files
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
import io.github.mymonstercat.Model; | ||
import io.github.mymonstercat.ocr.InferenceEngine; | ||
import io.github.mymonstercat.ocr.config.HardwareConfig; | ||
|
||
/** | ||
* Created by [email protected] on 11/23/2023_2:09 AM | ||
|
@@ -21,14 +22,15 @@ public enum PaddlePaddleOCRV4 { | |
|
||
// noting not to do.but init | ||
public static void init() { | ||
engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4_SERVER); | ||
HardwareConfig onnxConfig = HardwareConfig.getOnnxConfig(); | ||
onnxConfig.setNumThread(2); | ||
engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4_SERVER, onnxConfig); | ||
} | ||
|
||
public OcrResult ocr(File imageFile) { | ||
return engine.runOcr(imageFile.getAbsolutePath()); | ||
} | ||
|
||
public void close() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters