CaptchaCracker is an open source Python library that provides functions to create and apply deep learning models for Captcha Image recognition. You can create a deep learning model that recognizes numbers in the Captcha Image as shown below and outputs a string of numbers, or you can try the model yourself.
pip install CaptchaCracker
pip install numpy==1.19.5 tensorflow==2.5.0
Train and save the model
Before executing model training, training data image files in which the actual value of the Captcha image is indicated in the file name should be prepared as shown below.
import glob from CaptchaCracker import CreateModel train_img_path_list = glob.glob("../data/train_numbers_only/*.png") CM = CreateModel(train_img_path_list) model = CM.train_model(epochs=100) model.save_weights("../model/weights.h5")
Load a saved model to make predictions
from CaptchaCracker import ApplyModel weights_path = "../model/weights.h5" AM = ApplyModel(weights_path) target_img_path = "../data/target.png" pred = AM.predict(target_img_path) print(pred)