https://github.com/hari9-9/captcha-solver
A Scalable CAPTCHA solving Solution using CNN's
https://github.com/hari9-9/captcha-solver
captcha-solver deep-neural-networks scalability tensorflow tf-lite
Last synced: 3 months ago
JSON representation
A Scalable CAPTCHA solving Solution using CNN's
- Host: GitHub
- URL: https://github.com/hari9-9/captcha-solver
- Owner: hari9-9
- Created: 2024-12-09T02:04:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-09T02:27:50.000Z (over 1 year ago)
- Last Synced: 2025-04-03T15:12:58.923Z (over 1 year ago)
- Topics: captcha-solver, deep-neural-networks, scalability, tensorflow, tf-lite
- Language: Python
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CAPTCHA Solver: A Scalable and Efficient Approach
## Overview
This project focuses on building a scalable CAPTCHA solving system capable of identifying text-based CAPTCHAs with varying character lengths (1 to 6) and diverse fonts. Using a modular approach,implemented and trained seven deep learning models: one for predicting CAPTCHA length and six specialized for CAPTCHA classification based on length.
The project emphasizes scalability by leveraging TensorFlow Lite (TFLite) for efficient deployment on resource-constrained devices like Raspberry Pi, ensuring fast and accurate CAPTCHA classification.
---
## Features
- **Scalable Design:** Utilizes a modular seven-model architecture to handle variable CAPTCHA lengths efficiently.
- **Font Robustness:** Models trained on datasets containing diverse fonts to improve generalization.
- **Efficient Deployment:** Conversion of TensorFlow models to TFLite format ensures compatibility with edge devices like Raspberry Pi.
- **High Performance:** Employs preprocessing and optimized training configurations to achieve high accuracy and efficient resource utilization.
---
## Architecture
The system is based on a **divide-and-conquer** approach, where:
1. **Length Prediction Model:** Predicts the length of the CAPTCHA.
2. **Classification Models:** Six specialized models classify CAPTCHAs for lengths 1 through 6.
### Key Components
- **Data Preprocessing:** Explored various preprocessing techniques, with the best configuration enhancing image clarity and model performance.
- **Training Models:** Each model trained on datasets specific to its target length for optimized performance.
- **Font Handling:** Included images of all font variations in training datasets to ensure robustness.
### Training Configuration
- **Epochs:** 20
- **Batch Size:** 64
- **Early Stopping:** Enabled to prevent overfitting.
### Dataset
- Generated 64,000 images for training each model (90/10 train-test split).
- Data preprocessing included thresholding and noise removal to enhance input quality.
---
## TensorFlow Lite Conversion
To ensure scalability and compatibility with resource-constrained environments:
1. **Model Conversion:** TensorFlow models were converted to TFLite format.
2. **Quantization (Optional):** Experimented with quantized models for faster inference, though with reduced accuracy.
The TFLite models were deployed on a Raspberry Pi, achieving efficient classification within acceptable time limits.
---
## Scalability
- **Local vs. Edge Computing:** Training was performed on local machines with GPU acceleration, while inference was executed on Raspberry Pi using TFLite models.
- **Performance Metrics:** The system demonstrated high computational efficiency on edge devices:
- **Classification Time:** ~900 seconds for 4,000 images.
- **Resource Utilization:** Optimal use of CPU cores and memory during inference.
---
## Results
- **Score:** 2249/4000
- **Deployment Metrics:**
- Classification time on Raspberry Pi: ~900 seconds.
- Efficient model loading and prediction pipeline reduced resource usage and processing time.
---
## Future Work
- **Optimized Multithreading:** To enhance classification speed on Raspberry Pi.
- **Advanced Preprocessing:** Explore image segmentation and additional preprocessing techniques.
- **Quantization-aware Training:** Improve TFLite model performance without significant accuracy loss.
---
## How to Use
- Run length_model training length_model_train.py
- Run cpatha_model/process.sh to automatically generate model for all six lengths
- Pi/ folder has tf to tf_lite converter and classifier files