Learning Center

Several methods of license plate recognition - from OCR to deep learning

Views : 1146
Update time : 2022-12-22 12:33:54

With the development of science and technology, artificial intelligence technology is more and more widely used in our life. Many scenarios such as face recognition, license plate recognition, and object recognition have been applied. It has greatly improved our quality of life, greatly improved work efficiency, and saved a lot of labor.

smart city

After years of development, license plate recognition technology has diversified technical routes. Let's introduce two of them:

1. Recognize Single Character

First of all, there is a sensor sensing area on the ground, which automatically takes pictures when a vehicle passes by. Then preprocess the photos taken, turn them into grayscale images, remove noise, etc., and remove some interfering factors. At the same time, the size of the image is reduced, which is convenient for edge extraction in the later stage.

Secondly, use edge extraction techniques, such as canny operator and sobel operator, to extract the image contour. According to the aspect ratio of the license plate is about 1:2.5, most of the unsuspected ones are removed. Then, the characters are cut out by using the projection of the gray value of the image in the horizontal direction and the vertical direction.

Finally, use template matching or a trained deep learning model for recognition, recognize each character individually and concatenate them to obtain the entire license plate number.

The bottleneck of this method is how to accurately cut out each character. This involves many image processing techniques, such as Gaussian blur, image sharpening, image dilation, gamma change, affine transformation and so on. At present, the recognition accuracy of English characters and numbers is about 99%, and the accuracy of Chinese character recognition is about 98%.

2. Recognize entire license plate

First, like the first type of license plate recognition, the sensor is used for vehicle sensing, and the entire vehicle is photographed.

Secondly, use the trained license plate detection algorithm, such as the YOLO algorithm or other target detection algorithms to detect the license plate. In order to improve the accuracy of license plate recognition, image preprocessing technology can be used to process the image and reduce the interference items.

Finally, use the trained deep learning model to recognize the entire license plate. Such as LPRNet, Darknet, etc.

3. License plate recognition technology implementation

## The First Recognition method - Pytesseract

pytesseract is an OCR recognition tool. The accuracy of using this tool directly for recognition is still a bit low, and the desired effect cannot be achieved. It needs to be trained with license plate data before it can be used.


## The Second Recognition method - PaddleOCR

PaddleOCR is an OCR module under Baidu paddle. You can use it to recognize license plates. You can directly download the pre-trained model for recognition. It has a good accuracy rate for numbers and mother-in-law, but the effect for Chinese recognition is not ideal. You need your own data set Do retraining.

To use this model to train license plate recognition, a large amount of license plate data is required. Manual collection not only takes a long time, but also requires a relatively large cost to involve the license plates of each province.

## The third method - LPRNet

Since it takes a lot of time to collect data that satisfies deep learning, one way is to generate a large number of simulated data sets through data generation.

Next, we can use the LPRNet algorithm for license plate recognition. There are two versions of tensorflow and torch downloaded from GitHub.

1. To generate a blue license plate dataset
2. To modify the image name and put it in the designated folder according to the algorithm model requirements
3. Model training and testing