Solving captcha using CRNN + CTC loss
The model has been trained on 3500 examples which look like this:
They've been binarized to remove background noise:
Augmentations used: random small-angle rotations and piecewise affine transformation - to simulate distortions in captcha images.
The model shows about 76% accuracy on the validation set.
https://drive.google.com/open?id=1lNa_exTn7C2fZklHfWCyE-7eftVIkHyT
To use:
python inference.py --model_path ./netCRNN_trained.pth --image_path ./image.jpg
- Move your data to
train
andtest
dirs. To handle the problem of images with the same texts, your files should be named as<captcha_text>_<index>.png
, for exampleveq4n_2949.png
- Run
tool/create_dataset.py
for train and test and specify directory for output lmdb dataset - You can specify your character set in
alphabets.py
- You can change learning parameters in
params.py
Use inference.py
to predict your captcha images. Specify plot_needed
parameter to visualize output of the model.
For example, for given image:
we can visualize output probability distributions for channels s
, 4
, d
, 7
and -
(empty):