Coder Social home page Coder Social logo

kelvinks / captchacracker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wooiljeong/captchacracker

0.0 0.0 0.0 8.42 MB

Open source Python Deep Learning low-code library for generating captcha image recognition models

License: MIT License

Python 100.00%

captchacracker's Introduction

Open source Python Deep Learning low-code library for generating captcha image recognition models
πŸš€pip install CaptchaCracker --upgrade

PyPI Latest Release Downloads

ν•œκ΅­μ–΄ λ¬Έμ„œ


CaptchaCracker

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

png

Output

023062

Web Demo

Integrated into Huggingface Spaces πŸ€— using Gradio. Try out the Web Demo: Hugging Face Spaces


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.

png

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

  • input: image file path
import CaptchaCracker as cc

# Target image data size
img_width = 200
img_height = 50
# Target image label length
max_length = 6
# Target 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)

Load a saved model to make predictions

  • input: image bytes object
import CaptchaCracker as cc

# Target image data size
img_width = 200
img_height = 50
# Target image label length
max_length = 6
# Target 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)

# Predicted value
target_img_bytes = "..."
pred = AM.predict_from_bytes(target_img_bytes)
print(pred)

References


Contributors


captchacracker's People

Contributors

wooiljeong avatar ak391 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.