public class TextRecognitionModel extends Model
Constructor and Description |
---|
TextRecognitionModel(Net network)
Create Text Recognition model from deep learning network
Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
|
TextRecognitionModel(java.lang.String model)
Create text recognition model from network represented in one of the supported formats
Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
|
TextRecognitionModel(java.lang.String model,
java.lang.String config)
Create text recognition model from network represented in one of the supported formats
Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
|
Modifier and Type | Method and Description |
---|---|
static TextRecognitionModel |
__fromPtr__(long addr) |
java.lang.String |
getDecodeType()
Get the decoding method
|
java.util.List<java.lang.String> |
getVocabulary()
Get the vocabulary for recognition.
|
java.lang.String |
recognize(Mat frame)
Given the
input frame, create input blob, run net and return recognition result |
void |
recognize(Mat frame,
java.util.List<Mat> roiRects,
java.util.List<java.lang.String> results)
Given the
input frame, create input blob, run net and return recognition result |
TextRecognitionModel |
setDecodeOptsCTCPrefixBeamSearch(int beamSize)
Set the decoding method options for
"CTC-prefix-beam-search" decode usage |
TextRecognitionModel |
setDecodeOptsCTCPrefixBeamSearch(int beamSize,
int vocPruneSize)
Set the decoding method options for
"CTC-prefix-beam-search" decode usage |
TextRecognitionModel |
setDecodeType(java.lang.String decodeType)
Set the decoding method of translating the network output into string
|
TextRecognitionModel |
setVocabulary(java.util.List<java.lang.String> vocabulary)
Set the vocabulary for recognition.
|
getNativeObjAddr, predict, setInputCrop, setInputMean, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputScale, setInputSize, setInputSize, setInputSwapRB, setPreferableBackend, setPreferableTarget
public TextRecognitionModel(Net network)
network
- Net objectpublic TextRecognitionModel(java.lang.String model)
model
- Binary file contains trained weightspublic TextRecognitionModel(java.lang.String model, java.lang.String config)
model
- Binary file contains trained weightsconfig
- Text file contains network configurationpublic static TextRecognitionModel __fromPtr__(long addr)
public java.lang.String getDecodeType()
public java.util.List<java.lang.String> getVocabulary()
public java.lang.String recognize(Mat frame)
input
frame, create input blob, run net and return recognition resultframe
- The input imagepublic void recognize(Mat frame, java.util.List<Mat> roiRects, java.util.List<java.lang.String> results)
input
frame, create input blob, run net and return recognition resultframe
- The input imageroiRects
- List of text detection regions of interest (cv::Rect, CV_32SC4). ROIs is be cropped as the network inputsresults
- A set of text recognition results.public TextRecognitionModel setDecodeOptsCTCPrefixBeamSearch(int beamSize)
"CTC-prefix-beam-search"
decode usagebeamSize
- Beam size for search
only take top vocPruneSize
tokens in each search step, vocPruneSize
<= 0 stands for disable this prune.public TextRecognitionModel setDecodeOptsCTCPrefixBeamSearch(int beamSize, int vocPruneSize)
"CTC-prefix-beam-search"
decode usagebeamSize
- Beam size for searchvocPruneSize
- Parameter to optimize big vocabulary search,
only take top vocPruneSize
tokens in each search step, vocPruneSize
<= 0 stands for disable this prune.public TextRecognitionModel setDecodeType(java.lang.String decodeType)
decodeType
- The decoding method of translating the network output into string, currently supported type:
- "CTC-greedy"
greedy decoding for the output of CTC-based methods
- "CTC-prefix-beam-search"
Prefix beam search decoding for the output of CTC-based methodspublic TextRecognitionModel setVocabulary(java.util.List<java.lang.String> vocabulary)
vocabulary
- the associated vocabulary of the network.Generated on 2021-12-25 08:13:27 / OpenCV 4.5.5