itext-EasyOCR-cyrillic_g2
These are machine learning models designed to detect and recognize text within images. They analyze visual input, identify regions containing text, and convert that text into a machine-readable format. We integrate these models into our iText PdfOCR ONNX engine to enable efficient and accurate extraction of textual content from scanned documents and image-based PDFs. For seamless integration, they are converted into ONNX format, ensuring compatibility with the iText PdfOCR engine.
Model overview
- Source: https://github.com/JaidedAI/EasyOCR/releases/download/v1.6.1/cyrillic_g2.zip
- Conversion: ONNX version generated by running the following script: https://github.com/itext/itext-pdfocr-java/tree/develop/easyOcr_to_onnx_export
- What it does: Detects text (handwritten, vertical, rotated, curved) in many languages (Simplified/Traditional Chinese, English, Japanese) with a good speed accuracy trade off for mobile class hardware.
- iText support: Available from pdfOCR 5.0.0 onward.
Getting started with iText pdfOCR
Simple OCR engine (detection + recognition)
java (but is also available in .NET)
// detection
IDetectionPredictor easyDetectionPredictor = OnnxDetectionPredictor.easyOcr(PATH_TO_DETECTION_MODEL); // e.g. "itext-EasyOCR-craft_mlt_25k.onnx"
// recognition
IRecognitionPredictor recognition = OnnxRecognitionPredictor.easyOcr(PATH_TO_RECOGNITION_MODEL, EasyOcrMapper.LATIN_G2); // your recognition ONNX model + appropriate mapper
// combine into an engine
try(OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, recognition);) {
/* Your OCR processing here */
}
OCR engine with orientation handling
java (but is also available in .NET)
IDetectionPredictor easyDetectionPredictor = OnnxDetectionPredictor.easyOcr(PATH_TO_DETECTION_MODEL);
IRecognitionPredictor recognition = OnnxRecognitionPredictor.easyOcr(PATH_TO_RECOGNITION_MODEL, EasyOcrMapper.LATIN_G2);
// orientation predictor (MobileNetV3 variant)
OnnxOrientationPredictor orientation = OnnxOrientationPredictor.mobileNetV3(PATH_TO_ORIENTATION_MODEL);
try(OnnxOcrEngine ocrEngine = new OnnxOcrEngine(detection, orientation, recognition)) {
/* Your OCR processing here */
}
The created ocrEngine can be passed to the standard iText pdfOCR API, e.g.:
OcrPdfCreator ocrPdfCreator = new OcrPdfCreator(ocrEngine);
ocrPdfCreator.createPdfFile(Collections.singletonList(new File(imagePath)), new File(outPdfFile))
Sample projects
The following example files illustrate complete usage patterns:
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support