Views
No views yet
1// detection
2IDetectionPredictor detection = OnnxDetectionPredictor.paddleOcr(PATH_TO_DETECTION_MODEL); // e.g. "PP-OCRv5_mobile_det_infer.onnx"
3// recognition
4IRecognitionPredictor recognition = OnnxRecognitionPredictor.paddleOcr(PATH_TO_RECOGNITION_MODEL); // your recognition ONNX model
5// combine into an engine
6try(OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, recognition);) {
7 /* Your OCR processing here */
8}1IDetectionPredictor detection = OnnxDetectionPredictor.paddleOcr(PATH_TO_DETECTION_MODEL);
2IRecognitionPredictor recognition = OnnxRecognitionPredictor.paddleOcr(PATH_TO_RECOGNITION_MODEL);
3// orientation predictor (MobileNetV3 variant)
4OnnxOrientationPredictor orientation = OnnxOrientationPredictor.mobileNetV3(PATH_TO_ORIENTATION_MODEL);
5OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, orientation, recognition);
6try(OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, orientation, recognition)) {
7 /* Your OCR processing here */
8}1OcrPdfCreator ocrPdfCreator = new OcrPdfCreator(ocrEngine);
2ocrPdfCreator.createPdfFile(Collections.singletonList(new File(imagePath)), new File(outPdfFile))