git clone https://github.com/kfengtee/crnn-license-plate-OCR.git
cd crnn-license-plate-OCR
pip install -r requirements.txt
import model.alpr as alpr
# create ALPR instance (change parameters according to needs)
lpr = alpr.AutoLPR(decoder='bestPath', normalise=True)
# load model (change parameters according to needs)
lpr.load(crnn_path='model/weights/best-fyp-improved.pth')
# inferencing
lpr.predict('path/to/image')
python test.py --crnnPath path/to/pretrained/weights --dataPath path/to/test/data --savePath path/to/save/results
Optional arguments:
- --ctcDecoder : ['bestPath' or 'beamSearch'],
- Method to decode CTC output.
- Source: https://towardsdatascience.com/beam-search-decoding-in-ctc-trained-neural-networks-5a889a3d85a7
- --normalise : boolean,
- Whether to normalise the posterior probability with prior probability or not (to avoid bias).
python train.py --dataPath path/to/training/data --savePath path/to/save/model
To know more about the tunable hyperparameters
python ./train.py --help