CaptchaCracker is an open source Python library that provides functions to create and apply deep learning models for Captcha Image recognition.
Project description
CaptchaCracker
Introduction
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.
Input
Output
023062
Installation
pip install CaptchaCracker
Dependency
pip install numpy==1.19.5 tensorflow==2.5.0
Examples
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
import CaptchaCracker as cc
# Training image data path
train_img_path_list = glob.glob("../data/train_numbers_only/*.png")
# Training image data size
img_width = 200
img_height = 50
# Creating an instance that creates a model
CM = cc.CreateModel(train_img_path_list, img_width, img_height)
# Performing model training
model = CM.train_model(epochs=100)
# Saving the weights learned by the model to a file
model.save_weights("../model/weights.h5")
Load a saved model to make predictions
import CaptchaCracker as cc
# Training image data size
img_width = 200
img_height = 50
# Training image label length
max_length = 5
# Training image label component
characters = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
# Model weight file path
weights_path = "../model/weights.h5"
# Creating a model application instance
AM = cc.ApplyModel(weights_path, img_width, img_height, max_length, characters)
# Target image path
target_img_path = "../data/target.png"
# Predicted value
pred = AM.predict(target_img_path)
print(pred)
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
CaptchaCracker-0.0.5.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for CaptchaCracker-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd225ada2728c2a8ba2c54fe8d58d0d79e8c39be82621a6881fd9e1abd61f663 |
|
MD5 | 1a05a2f142ffb8ee375b59883d976154 |
|
BLAKE2b-256 | 24d0dbd542c7585936e968f4df6189fbac705e776ccc0e40667a145956f3a886 |