This project is designed to automatically detect and recognize license plates from vehicle images. It utilizes a combination of image processing techniques and a convolutional neural network (CNN) for character recognition. The end-to-end process involves extracting the number plate, segmenting the characters, training a model to recognize these characters, and predicting the plate number.
The system performs the following tasks:
- Extracting the Number Plate: Detect the number plate from a vehicle image using OpenCV.
- Character Segmentation: Identify individual characters on the plate by finding contours and drawing rectangles around each character.
- Model Training: A CNN model is trained on a dataset containing 36 classes ('A'-'Z' and '0'-'9').
- Character Recognition: The trained model predicts the characters from the segmented license plate and the results are compared to the actual characters on the plate.
- Keras: For designing and training the CNN model.
- TensorFlow: Backend engine for Keras.
- Matplotlib: For generating images of the number plates and character segments for visualization.
- OpenCV: Used for image processing tasks such as contour detection.
- NumPy: For handling high-level mathematical functions and array operations.
- Pandas: Used occasionally for data manipulation and analysis, though its use is minor in this project.
The system achieved 94% accuracy on the test dataset, demonstrating its effectiveness in recognizing varied license plates under different conditions.
To make the license plate recognition system more accessible and user-friendly, a Streamlit web interface has been integrated. Users can upload images of vehicles, and the system will display the detected number plate along with the recognized characters.
- Image Upload: Users can upload images in JPEG, PNG, or JPG format.
- Real-time Results Display: After processing the uploaded image, the interface displays the original image, the image with the detected license plate highlighted, and the recognized characters.
- Responsive Feedback: The interface provides feedback on the processing stages and outputs the recognized number plate text.
To run this project locally, follow these steps:
-
Clone the repository to your local machine.
-
Ensure you have Python installed, and set up a virtual environment.
-
Install the required dependencies using the following command:
pip install -r requirements.txt
-
Run the Streamlit application:
streamlit run prediction.py
-
Navigate to
http://localhost:8501
in your web browser to interact with the application.
This License Plate Recognition System showcases the power of machine learning and image processing to solve real-world problems in an interactive and user-friendly manner. The addition of the Streamlit interface allows for easy demonstration and real-time use of the system.
Feel free to contribute to the project by submitting pull requests or suggesting enhancements through the issues tab.