Training the OCR Model¶
The train
script launches the end-to-end training process for a license plate OCR model, using:
- A user-defined model architecture (
model_config.yaml
) - A plate configuration (
plate_config.yaml
) - A training/validation dataset in CSV format
- Optional augmentation, loss, optimizer and callback settings
Basic Usage¶
# You can set the backend to either TensorFlow, JAX or PyTorch
KERAS_BACKEND=tensorflow fast-plate-ocr train \
--model-config-file models/cct_s_v1.yaml \
--plate-config-file config/latin_plates.yaml \
--annotations data/train.csv \
--val-annotations data/val.csv \
--epochs 150 \
--batch-size 64 \
--output-dir trained_models/
Keras Backend
Make sure you have installed a backend for training. See Backend section for more details.
Tip
Use --weights-path <path/to/model.keras>
when fine-tuning. All pre-trained models are uploaded to this
GH release > Assets.
Logging and Checkpoints¶
The script saves:
- Best model (based on monitored metric)
- Final model weights
- Training parameters and configs
- Optional TensorBoard logs
Metrics Tracked¶
The model is compiled with:
plate_acc
: Fully correct plate predictionscat_acc
: Character-level accuracytop_3_k
: Accuracy if target is in top-3 predictionsplate_len_acc
: Plate length matches
See Metrics section for more details about metrics.