In this project, we want to perform license plate recognition using pre-trained YoloV7 model training on the dataset of cars with Iranian and foreign license plates. Then, using the trained model and OCR, we recognize the license plate and the text in it in three modes: photo, video and webcam.
- Iranian car license plate recognition using YoloV7
- Table of Contents
- How To Run
- Results
- License
- Contact
- In the first step, to train the model on Google Colb, follow the steps below:
- Mount Google Drive
from google.colab import drive
drive.mount('/content/gdrive')
- Clone the yolov7 github
!git clone https://github.com/augmentedstartups/yolov7.git
- Go to the project directory
- Install requirements by running
!pip install -r requirements.txt
!pip install roboflow
- In the second step, to run the Yolov7_IRPD_OCR.py script in order to identify the license plate and its text, do the following steps.
- It is suggested to create a conda environment.
conda create -n [your-env-name] python=3.8
- Clone the yolov7 github
!git clone https://github.com/augmentedstartups/yolov7.git
- Go to the project directory
- Install requirements by running
!pip install -r requirements.txt
!pip install easyocr
!pip install deep-sort-realtime
-
To train the pre-trained YoloV7 model on the new dataset, run the Yolov7_IRPD_Train.ipynb notebook cells in order.
-
To recognize the license plate and its text and numbers, run the Yolov7_IRPD_OCR.py script. To choose license plate recognition from the content of photo or video or webcam, uncomment the corresponding lines of code at the end of the script.
Please read the file in the report folder before running the codes in order to learn how to set the path of the files and variables.
- The result of detecting an Iranian car license plate with a high confidence score:
- The result of license plate detection along with its text identification:
- The easyocr method used to recognize Persian text and number has a little error.
This project is licensed under the MIT License.
If you have any questions about the implementation of the project, you can send your questions to this email: [email protected]