trainOCR
Syntax
Description
Training
trains a new OCR model by fine-tuning a pretrained base model using the hyperparameters
specified in modelFileName
= trainOCR(trainingData
,modelName
,baseModel
,ocrOptions
)ocrOptions
.
[
returns a structure that contains information on training progress, such as the training
root mean squared error (RMSE) and learning rate for each iteration, using the input
arguments from the previous syntax. For a list of the returned error rates, see the modelFileName output
argument.modelFileName
,info
] = trainOCR(___)
Resume training
[
resumes training from an OCR training checkpoint. Use this syntax to improve the accuracy
of your OCR model by using additional training data or to perform more training
iterations.modelFileName
,info
] = trainOCR(trainingData
,modelName
,checkpoint
,ocrOptions
)
Examples
Input Arguments
Output Arguments
Limitations
Training OCR models with right-to-left scripts such as Arabic and Hebrew are not supported.
Algorithms
The
trainOCR
function creates a temporary folder, "<modelName
>Training/
, where <modelName> is the value of themodelName
argument, in the location specified by theOutputLocation
property of theocrTrainingOptions
object. The folder contains training artifacts. If the folder does not already exist before you run thetrainOCR
function, the function deletes it at the end of training. If the folder already exists prior to training, the function does not delete the folder.Images read from
trainingData
must contain text of at least one-word length and up to a maximum of one-line length. ThetrainOCR
function does not support images that contain multiple lines of text.The
trainOCR
function does not support on-the-fly data augmentation using a datastore transform. All the image data is read once from the training datastores at the start of training.
Version History
Introduced in R2023a