- 🎯 98%+ character accuracy on synthetic CAPTCHAs
- ⚡ GPU-accelerated training with mixed precision
- 🔄 End-to-end pipeline from data generation to deployment
- 🧠 Full CTC evaluation
- 🎨 Synthetic data generation - no manual labeling required
Get up and running in minutes:
pip install tensorflow tensorflow-addons omegaconf hydra-core tqdm matplotlib captcha pillowpython generate_synthetic_dataset.py -n 20000Creates 20,000 synthetic CAPTCHA images like ABC123_001.png
python train.pyAuto-detects GPU based on TensorFlow, trains with mixed precision, saves best model
python evaluate.py
python predict.py path/to/your/captcha.pngOur CRNN (Convolutional Recurrent Neural Network) combines three powerful components:
📸 CAPTCHA Image → 🔍 CNN Feature Extractor → 🔄 Bidirectional LSTM → 📝 CTC Decoder → ✨ Text Output
- ResNet-inspired feature extractor
- Batch normalization + ReLU activation
- Progressive max pooling for spatial reduction
- Converts images to rich feature representations
- Bidirectional LSTM layers capture left-to-right AND right-to-left context
- Handles variable-length sequences automatically
- Dropout prevents overfitting
- Connectionist Temporal Classification eliminates need for character-level alignment
- Handles variable-length outputs elegantly
- Proper decoding removes duplicates and blank tokens
❌ Traditional Approach:
Requires: [A][B][C][1][2][3] ← Exact alignment needed
✅ CTC Approach:
Handles: [A][A][_][B][C][_][1][2][3][3][_] ← Automatic alignment
↓ CTC Decoding ↓
Output: ABC123
| Metric | Score | Description |
|---|---|---|
| Character Accuracy | 99.3% | Individual character recognition |
| Sequence Accuracy | 97.9% | Complete CAPTCHA solved correctly |
| Training Time | <1 hour | On RTX 3050 (mixed precision) |
| Inference Speed | ~10ms | Per image on GPU |
Training Performance:
- Dataset: 20,000 synthetic CAPTCHAs
- Convergence: 20-40 epochs (early stopping)
- Memory Usage: ~2GB GPU memory
- Speed: 40% faster with mixed precision
The model typically shows:
- Rapid initial learning (epochs 1-10)
- Gradual improvement (epochs 10-30)
- Convergence with early stopping
Common Issues:
-
CUDA out of memory:
# Reduce batch size in config.yaml batch_size: 64 # or 32
-
Mixed precision errors:
# Disable for older GPUs mixed_precision: false
This project is licensed under the MIT License - see LICENSE.txt for details.
TL;DR: Use it freely for educational and commercial purposes! 🎉