Captchas are used to verify whether the entity accessing a particular webpage is a human or a computer.
Ususally they look like this,
I made this application just for fun to see if captchas can be beaten by the power of CV and DL. The verdict? I think so :P
- Run
create_train_data.py
This will parse through all the images of captchas in data folder and use opencv to detect individual symbols and crop them separately while giving them lables (which is the name of the image file). Thus we'll get our dataset. - Run
train.py
This has the model definition (simple 4 layer CNN) and training script. As dataset is limited and model is small, training shouldn't take much time. - Run
test.py
This will run inference on some random images from dataset and use ground truth to give accuracy.
When creating the dataset, it reads every image where the name of the image is the ground truth. It then separates the 5 symbols in each image using CV techniques like:
Original captcha:
Erosion and morphology to smoothen the image:
Contours detection to detect the symbols:
The symbols are cropped and supplied as training set.
After model has been trained, it is used for inference after doing same process as above.
P.S. If someone has more labelled data of captchas please email me.