Skip to content

EninDmitriy96/CAPTCHA_recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CAPTCHA Recognition Project

This project focuses on developing a robust CAPTCHA recognition system using deep learning techniques. Two approaches were implemented: a single model approach that processes the entire CAPTCHA image and a multiple classifiers approach, where separate classifiers are trained for each character position. Both methods utilize a ResNet50 architecture. A Streamlit application integrated with FastAPI was also developed to provide an interactive demonstration of the system's capabilities. The project underscores the effectiveness of deep learning in CAPTCHA recognition and provides a flexible, scalable solution for text-based CAPTCHAs.


Features

  1. Two Recognition Approaches:
  • One-go Recognition: Recognizes the entire CAPTCHA image in one step.

  • Sequential Recognition: Divides the CAPTCHA into individual characters and uses five classifiers to recognize each character sequentially.

  1. Frontend and Backend:
  • Streamlit Frontend: Provides an interface to upload CAPTCHA images and view recognition results.

  • FastAPI Backend: Handles predictions and model interaction.

  1. Custom Dataset Training:
  • Users can train the models on their own datasets by configuring paths, CAPTCHA length, and alphabet.
  1. Preprocessing Tools:
  • A script (preprocess.py) to clean the dataset by removing corrupted files.

Installation and Setup

  1. Clone the repository:
git clone https://github.com/EninDmitriy96/CAPTCHA_recognition
cd <path_to_the_project>
  1. Install required dependencies:
pip install -r requirements.txt
  1. Ensure your dataset is prepared in the proper format:

CAPTCHA filenames should correspond to their decryption (e.g., abc12.png for CAPTCHA abc12).

Place CAPTCHA images in the data/ directory or configure paths for your dataset.

Usage

Running the Application

  1. Start both the frontend and backend:
python run_all.py
  1. Access the applications:
  1. Terminate both processes by pressing Enter in the terminal.

Using the Frontend

  1. Upload a CAPTCHA image:
  • Use examples from the data/ folder for best results (same dataset used for training).
  1. View Predictions:
  • The results from both approaches (one-go and sequential recognition) are displayed.

Training on Your Dataset

  1. Update the following parameters in the code:
  • Dataset Paths: Ensure paths to your dataset are correct.

  • Sequential Classifiers: Set the number of classifiers according to the CAPTCHA length.

  • Alphabet: Define the alphabet used in your CAPTCHAs.

  1. Run the training script (code/models/notebooks):

Preprocessing the Dataset

To remove corrupted files from your dataset, run:

python code/datasets/preprocess.py

Future Improvements

  • Add support for more CAPTCHA formats.

  • Improve accuracy for custom datasets.

  • Extend frontend for additional functionalities (e.g., batch processing).

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.


About

A machine learning project for recognizing CAPTCHA images using ResNet-50 with Streamlit frontend and FastAPI backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors