Skip to content

Null-byte-00/CaptchaReader

Repository files navigation

Ml model for Reading text captchas

Overview

This is a simple Convolutional model for classifying and reading text captchas
NOTE: For simplicity the model can only read captchas with 1 character and it's assumed that it's always a digit. Also it can only detect captchas generated by python captcha library

Model

The model is a convolutional network with 2 convolutional/maxpooling and 2 fully connected layers and a total of 4.3 million parameters

Dataset

The dataset consists of 10000 images(1000 for each digit). all of the images are of size 100x100 pixels and are all generated using python captcha library. Before training the images are normalized and converted to greyscale

training

The model is trained with binary cross entropy loss function and gradient descent optimizer. and mini-batches of size 32

running the model

First download the compiled model from release page and put it in "models" folder.
now you need a sample image. you can generate it using python captcha library

from captcha.image import ImageCaptcha

image = ImageCaptcha(width=100, height=100)
image.write("4", "test_cptcha.png")

now we have our captcha image
captcha
now run the model using following command

$ python.exe .\run_model.py .\test_captcha.png
4

as you can see the model can detect the digit in the captcha image