Skip to content
English
  • There are no suggestions because the search field is empty.

7. Improving Trained Models (Retraining)

Improving a trained custom model, also known as retraining, is important to improve its accuracy and adapt it to new or more diverse data.

When to Retrain a Model

Retraining allows you to build on the foundation of an existing model without starting from scratch, saving time and resources. This is particularly useful for improving the model's performance on specific document types and handwriting styles. Retraining is beneficial in the following scenarios:

  • The model performs well but struggles with specific documents or handwriting styles.
  • You have new training data that represents additional scenarios or variations.
  • You aim to specialise a general model for niche use cases, such as rare scripts or complex document structures.
  • The model's Character Error Rate (CER) is higher than acceptable for your requirements.

Training multiple models is a normal part of the process, and each attempt brings you closer to your ideal result. This article will walk you through the steps of retraining and improving your model.

Simply correcting transcriptions in the document editor does not improve the model. Accuracy increases only by training new model versions with updated Ground Truth.

How to Retrain a Model

Step 1: Prepare new training data

  1. Create more Ground Truth data: Recognise and correct pages with your model v1.0 to create more Ground Truth data or collect more diverse GT data. 
    Ensure this data includes images with accurate transcriptions that address the areas where the model struggles.
  2. Verify the quality of the data: Poorly labelled or inconsistent data can lower the model’s performance.

    Generally, we recommend adding at least 20 pages of Ground Truth every time you retrain a smaller model or between 50 and 100 new pages with larger models. However, it may be good to experiment by adding different amounts of Ground Truth and see which is most effective for your model.

  3. Collect all Ground Truth data: Once you have found or created additional GT material you can add this data to the material you used to train your first model on.

You can also set up a Dataset and collect your old and new Ground Truth material there, here is an explanation of how you can use Datasets to create different versions for model setup and training: Managing Datasets.

Step 2: Set up the new training job

  1. You can start the training either by using Datasets or directly from the collection or document(s) you've been working on. 
  2. To do the latter, simply mark the transcribed or corrected pages, then click on the "Selected" button in the bar above the images. There click on "Train Model" and select "Text Recognition Model".
    Find detailed instructions and information here: Model Setup and Training
  3. Start training of model v2.0. 

Note: Existing models can be used as starting points (base model) to reduce the required amount of new data. However, smaller models or your earlier versions of the same model can reduce the accuracy instead of improving it. For this reason, we recommend using a large, general model trained on a writing style similar to your own material, as base models.

Step 3: Evaluate the retrained model

Once retraining is complete:

    • Check the Learning Curve: 
      A consistent downward trend in training and validation loss indicates improvement.
    • Test the Model: 
      Apply the model to documents not used in training.
      Compare its performance to the original version by reviewing and computing the Character Error Rate (CER): Computing Character Error Rate
    • Repeat if necessary:
      If performance is unsatisfactory, add more ground truth data and retrain. Repeat retraining the custom model until accuracy stops improving.

Tips for Retraining a Model

  • Use a diverse dataset that represents all scenarios the model needs to handle.
  • Prioritise high-quality Ground Truth to ensure the model learns correctly.
  • Keep validation data separate from training data to avoid biased evaluations.
  • Monitor the CER and learning curve for signs of overfitting or underperformance.

For a more detailed explanation, you can also have a look at this Blog on How to retrain a model in Transkribus.

Until November 2022, Transkribus supported another text recognition engine called HTR+. Because of its discontinuation within the platform, HTR+ models can neither be trained nor be applied anymore.

If you have trained an HTR+ model in the past, you can easily retrain it with PyLaia, using the above steps.