Class OnnxRecognitionPredictorProperties
java.lang.Object
com.itextpdf.pdfocr.onnxtr.recognition.OnnxRecognitionPredictorProperties
Properties for configuring text recognition ONNX models.
It contains a path to the model, model input properties and a model output post-processor.
-
Constructor Summary
ConstructorsConstructorDescriptionOnnxRecognitionPredictorProperties
(String modelPath, OnnxInputProperties inputProperties, IRecognitionPostProcessor postProcessor) Creates new text recognition predictor properties. -
Method Summary
Modifier and TypeMethodDescriptioncrnnMobileNetV3
(String modelPath) Creates a new text recognition properties object for existing pre-trained CRNN models with a MobileNet V3 backbone, stored on disk.Creates a new text recognition properties object for existing pre-trained CRNN models with a VGG-16 backbone, stored on disk.boolean
Returns the ONNX model input properties.Returns the path to the ONNX model.Returns the ONNX model output post-processor.int
hashCode()
Creates a new text recognition properties object for existing pre-trained MASTER models, stored on disk.Creates a new text recognition properties object for existing pre-trained PARSeq models, stored on disk.parSeq
(String modelPath, Vocabulary vocabulary, int additionalTokens) Creates a new text recognition properties object for existing pre-trained PARSeq models, stored on disk.Creates a new text recognition properties object for existing pre-trained SAR models, stored on disk.toString()
Creates a new text recognition properties object for existing pre-trained ViTSTR models, stored on disk.
-
Constructor Details
-
OnnxRecognitionPredictorProperties
public OnnxRecognitionPredictorProperties(String modelPath, OnnxInputProperties inputProperties, IRecognitionPostProcessor postProcessor) Creates new text recognition predictor properties.- Parameters:
-
modelPath
- path to the ONNX model to load -
inputProperties
- ONNX model input properties -
postProcessor
- ONNX model output post-processor
-
-
Method Details
-
crnnVgg16
Creates a new text recognition properties object for existing pre-trained CRNN models with a VGG-16 backbone, stored on disk. This is the default text recognition model in OnnxTR.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model - Returns:
- a new text recognition properties object for a CRNN model with a VGG-16 backbone
-
crnnMobileNetV3
Creates a new text recognition properties object for existing pre-trained CRNN models with a MobileNet V3 backbone, stored on disk.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model - Returns:
- a new text recognition properties object for a CRNN model with a MobileNet V3 backbone
-
master
Creates a new text recognition properties object for existing pre-trained MASTER models, stored on disk.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model - Returns:
- a new text recognition properties object for a MASTER model
-
parSeq
Creates a new text recognition properties object for existing pre-trained PARSeq models, stored on disk.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model - Returns:
- a new text recognition properties object for a PARSeq model
-
parSeq
public static OnnxRecognitionPredictorProperties parSeq(String modelPath, Vocabulary vocabulary, int additionalTokens) Creates a new text recognition properties object for existing pre-trained PARSeq models, stored on disk.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model -
vocabulary
- vocabulary used for the model output (without special tokens) -
additionalTokens
- amount of additional tokens in the total vocabulary after the end-of-string token - Returns:
- a new text recognition properties object for a PARSeq model
-
sar
Creates a new text recognition properties object for existing pre-trained SAR models, stored on disk.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model - Returns:
- a new text recognition properties object for a SAR model
-
viTstr
Creates a new text recognition properties object for existing pre-trained ViTSTR models, stored on disk.This can be used to load the following models from OnnxTR:
- Parameters:
-
modelPath
- path to the pre-trained model - Returns:
- a new text recognition properties object for a ViTSTR model
-
getModelPath
Returns the path to the ONNX model.- Returns:
- the path to the ONNX model
-
getInputProperties
Returns the ONNX model input properties.- Returns:
- the ONNX model input properties
-
getPostProcessor
Returns the ONNX model output post-processor.- Returns:
- the ONNX model output post-processor
-
equals
-
hashCode
public int hashCode() -
toString
-