itqop
5923b469bf
Updated the `README.md` to include: - Comprehensive project overview. - Detailed setup and usage instructions. - Information on system architecture. - Guidance for real-time recognition, static image testing, and CRNN training. - License information. This update ensures clarity for users and contributors, improving the overall documentation quality. |
||
---|---|---|
img | ||
models | ||
.gitignore | ||
LICENSE | ||
README.md | ||
__init__.py | ||
config.py | ||
license_plate_recognizer.py | ||
main.py | ||
model.py | ||
requirements.txt | ||
static-test.ipynb | ||
train_crnn.ipynb |
README.md
License Plate Recognition System
A robust and efficient real-time license plate recognition system using YOLO for plate detection and CRNN for text recognition. The system is specifically designed for Russian license plates and provides high accuracy in both detection and character recognition.
🚀 Features
- Real-time license plate detection and recognition
- Support for both real-time webcam input and static image batch processing
- Support for Russian license plate format
- High-accuracy YOLO-based plate detection
- Advanced CRNN-based text recognition with CTC loss
- Real-time visualization with OpenCV
- Multi-stage pipeline with separate detection and recognition components
- Built-in data augmentation for robust training
- Support for both real-time webcam input and static image processing
🛠️ Technical Architecture
The system consists of two main components:
-
License Plate Detection (YOLO)
- Uses YOLO (You Only Look Once) for real-time object detection
- Trained specifically for license plate detection
- Provides bounding box coordinates for detected plates
-
Text Recognition (CRNN)
- Convolutional Recurrent Neural Network architecture
- CNN backbone for feature extraction
- Bidirectional LSTM for sequence modeling
- CTC loss for end-to-end training
- Supports the specific character set used in Russian license plates
📊 Performance
- CRNN Text Recognition Accuracy: ~97% on validation set
- Real-time processing capability on CPU
- Support for various lighting conditions and angles through data augmentation
🔧 Requirements
numpy==1.26.3
pillow==10.2.0
opencv-python==4.10.0.84
scikit-learn==1.5.2
scipy==1.13.1
matplotlib==3.9.2
tqdm
ultralytics
torch==2.0.1
torchvision==0.15.2
💻 Installation
- Clone the repository:
git clone https://git.itqop.pw/itqop/number-plate.git
cd number-plate
- Create and activate a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the required packages:
pip install -r requirements.txt
🚗 Usage
Real-time Recognition (Webcam)
To run the system with webcam input:
python main.py
The application will open a window showing the webcam feed with detected license plates and their recognized text. Press 'q' or 'ESC' to exit.
Static Image Processing
To process a batch of images:
- Place your images in the
img
folder - Open
static-test.ipynb
- Run the static test script
The script will:
- Process all images in the specified folder
- Display results with bounding boxes and recognized text
- Show results in a matplotlib window for each image
Training the CRNN Model
The CRNN model can be trained using the provided Jupyter notebook:
- Open
train_crnn.ipynb
- Configure the training parameters if needed
- Run all cells to start training
- The best models will be saved based on validation loss and accuracy
📁 Project Structure
├── img/ # Directory to store images for static tests
├── models/ # Directory to store YOLO and CRNN weights
├── config.py # Configuration for character mappings and model paths
├── license_plate_recognizer.py # Main class for license plate detection and recognition
├── main.py # Script for real-time license plate recognition
├── model.py # CRNN model definition
├── requirements.txt # Project dependencies
├── static-test.ipynb # Notebook for testing inference on static images
├── train_crnn.ipynb # Notebook for training the CRNN model
└── README.md # Project documentation
🧬 Model Architecture
CRNN Architecture
- CNN Layers: Multiple convolutional layers with max pooling and batch normalization
- RNN Layers: Bidirectional LSTM for sequence modeling
- Dense Layers: Final classification layers
- Input Size: 32x128 grayscale images
- Output: Character sequence predictions
📝 License Plate Format
The system is designed to recognize Russian license plates with the following character set:
- Letters: A, B, E, K, M, H, O, P, C, T, Y, X
- Numbers: 0-9
- Special characters: - (hyphen)
⚙️ Configuration
Key parameters can be modified in config.py
:
ALPHABET
: Supported charactersNUM_CLASSES
: Number of character classesYOLO_WEIGHTS_PATH
: Path to YOLO model weightsCRNN_WEIGHTS_PATH
: Path to CRNN model weights
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software as per the terms of the MIT License. For detailed terms, see the LICENSE
file included in this repository.