Limited scene-free license plate detection method based on improved attention mechanism

By introducing the combination of attention mechanism and deformable convolution in license plate detection, the problem of inaccurate extraction of license plate features in complex scenes is solved, and the accuracy of license plate detection is significantly improved, especially on rotated and distorted license plates.

CN118570786APending Publication Date: 2024-08-30QINGDAO SONLI SOFTWARE INFORMATION TECH

Patent Information

Application Number
CN202410512299.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-26
Publication Date
2024-08-30

Smart Images

  • Figure CN118570786A
    Figure CN118570786A
Patent Text Reader

Abstract

The invention belongs to the technical field of license plate detection, and relates to an unlimited scene license plate detection method based on an improved attention mechanism, which improves the license plate feature information extraction capability of a backbone network by introducing an attention mechanism module, and flexibly inserts the attention mechanism module into a classical detection network, and has the characteristic of light weight. Moreover, the structure is redesigned, feasible variable convolution is introduced, and a feature extraction network suitable for extracting license plate information is proposed, so that the retention capability of license plate features is improved while position information and channel relationships are captured, information loss is reduced, and the accuracy of license plate recognition is improved. The performance of the detection method based on the convolutional neural network on rotation and distortion of the license plate target is greatly improved on the basis of increasing few operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of license plate detection, and in particular relates to an unrestricted scene license plate detection method based on an improved attention mechanism. Background Art

[0002] With the rapid development of technologies such as artificial intelligence, the Internet of Things, and 5G, smart transportation has played an important role in smart cities, and license plate detection and recognition technology has played an important role in smart transportation systems. The detection accuracy of traditional Chinese license plate detection methods is greatly affected by the environment. It is difficult to show strong robustness in the face of complex scenes such as license plate distortion and rotation, and the detection accuracy is often low, which is far from meeting application requirements.

[0003] Most of the early license plate recognition algorithms were based on machine learning algorithms, using manually selected features to locate and identify license plates. In recent years, with the advent of the big data era and the improvement of computer computing power, deep learning has made major breakthroughs in license plate recognition. The introduction of deep learning algorithms such as Faster R-CNN, YOLO, and DBNet has enabled new developments in license plate positioning and recognition. Existing license plate recognition technology is mainly used in specific environments, such as toll parking entrances and exits, highway ETC channels, etc. Under the conditions of such a straight-on detection perspective and a fixed detection area, the accuracy of license plate recognition technology can be very high, but the recognition effect is poor in complex scenarios.

[0004] License plate detection in complex scenes may cause the license plate to rotate or distort due to tilted views. Existing methods use convolutional neural networks based on deep learning for feature extraction, which are mainly divided into two types: (1) License plate detection methods based on horizontal rectangular frames will introduce a large amount of background information when detecting tilted or deformed license plates, resulting in inaccurate subsequent license plate recognition and positioning; (2) Segmentation-based methods generate differentiable binary images when detecting license plates, expand the license plates pixel by pixel, and finally achieve license plate positioning and subsequent recognition. In the license plate detection process of the above two types of methods, on the one hand, most of the existing license plate detection algorithms directly use CNN to extract license plate features, that is, the feature extraction network cannot focus on the license plate information, resulting in some license plate information being randomly forgotten during the transmission process, so this simple CNN cannot handle the license plate detection task well; on the other hand, the license plate information extraction is incomplete. The license plate image in the unconstrained scene contains rich semantic information. Whether the complete semantic information can be extracted and utilized to the maximum extent is the guarantee for the efficient and accurate completion of the subsequent license plate detection task. It can be seen that for unconstrained scenarios, the existing license plate detection technology has the technical problem of low detection accuracy, and more effective methods are urgently needed for feature enhancement. Summary of the invention

[0005] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides an unrestricted scene license plate detection method based on an improved attention mechanism. By combining the attention mechanism with deformable convolution, the enhancement of license plate features is achieved, and the problem of misalignment of deep features of tilted or distorted license plates is solved. It can be used in license plate detection and recognition tasks in unrestricted scenes, and can efficiently realize license plate detection correction.

[0006] To achieve the above purpose, the specific process of the present invention to realize license plate detection in unrestricted scenes is as follows:

[0007] (1) Dataset construction: Collect images containing regular, tilted, and distorted license plates from traffic surveillance and side parking lots, construct a dataset with no less than a certain number of license plates, annotate the locations of the license plates, and divide the dataset into training, validation, and test sets.

[0008] (2) Deep convolution feature extraction: The image is input into the feature extraction network with ResNet-50 as the backbone network, and the feature map {P 1 ,P 2 ,P 3 ,P 4 ,P 5} as the input feature of step (3);

[0009] (3) Train the detection network to increase weight: {P 1 ,P 2 ,P 3 ,P 4 ,P 5} is input into the BiFPN network, and the weights are continuously learned using the training network to improve the network's ability to judge the importance of different features. At the same time, the top-down and bottom-up multi-scale feature fusion is repeatedly used to generate the feature map {C 1 ,C 2 ,C 3 ,C 4 ,C 5}, then multi-scale fusion is performed to obtain the feature map I, and the Sigmoid function is used to normalize I to the range of 0-1 to obtain the segmentation map, and the segmentation image is binarized using an adaptive threshold to obtain a binary map, in which the license plate pixel is 1 and the background pixel is 0;

[0010] (4) License plate detection: Use the scale-by-scale expansion algorithm to distinguish the license plate area on the generated binary image and obtain the license plate detection result;

[0011] (5) Train the network structure to obtain a trained network model: Use ResNet-50 as the backbone network to train the network model. After pre-training, two training processes are adopted to obtain a trained network model.

[0012] As a further technical solution of the present invention, the specific process of step (2) is:

[0013] (2-1) The attention mechanism module is embedded in the residual module of the ResNet-50 layer. The size of the feature map x input into the residual module changes with the number of ResNet layers and is uniformly set to C×H×W, where C is the number of feature map channels, H and W correspond to the height and width of the feature map, respectively. To extract the channel information and position information of the license plate feature map, a pooling kernel of size H×1 and 1×W is used to encode along the horizontal and vertical coordinate directions. The vertical coordinate encoding of each channel is the position information of the feature. Therefore, the output feature with the number of channels C and the height H is expressed as The output feature with the number of channels C and width W is expressed as

[0014] (2-2) Features and The feature map is expanded, and the corresponding positions of the expanded feature map are summed pixel by pixel to obtain a feature map of size C×H×W. The channel and position information are generated on the same feature map, which is specifically expressed as

[0015] (2-3) The feature map generated in step (2-2) is subjected to a feasible variable convolution operation, and the processed feature map is fused with the input feature map x to generate a new feature map X: X = x c (i,j)+y c (i, j), the feature map X is input into the ResNet-50 backbone network to generate the feature map {P 1 ,P 2 ,P 3 ,P 4 ,P 5} as the input feature of step (3).

[0016] As a further technical solution of the present invention, the specific process of step (5) is:

[0017] (51) The detector was first trained for 600 epochs using the training images, and then the model was fine-tuned for 1200 epochs on each benchmark dataset. All models were trained with a batch size of 16 on four NVIDIA Tesla V100 GPUs. The SGD optimizer was used in all training processes with a momentum of 0.9 and a poly learning rate strategy based on DBNet, where the learning rate for each iteration was equal to the initial learning rate multiplied by When the initial learning rate is set to 0.007, the momentum is 0.9, and max_iter represents the maximum number of iterations, whose value depends on the maximum epoch;

[0018] (52) The data of the training set was augmented, including random rotation with an angle range of [-10°, 10], random image flipping, and random image cropping. The training images were resized to 640×640. During the training process, the aspect ratio of the training images was maintained, and the input image size of each benchmark was adjusted by setting the appropriate height. The model with a batch size of 1 was tested on a single NVIDIA1080Ti GPU using a single thread.

[0019] Compared with the prior art, the present invention has the following beneficial effects:

[0020] The present invention extracts the spatial position information of the license plate features, splits the feature map into aggregated features in two spatial directions and fuses them with the original license plate feature information. While maintaining the long-range dependency between channels, it can capture the accurate license plate feature position information to obtain complete license plate feature information. Adding deformable convolution can better concentrate the recognition receptive field around the object and reduce the interference of background information. Therefore, the fused features are further enhanced by deformable convolution. In the CCPD license plate detection rotation (Rotate) data set, the accuracy is improved from 94.7% to 98.8%. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a network structure diagram used by the present invention to implement license plate detection.

[0022] Figure 2 This is a workflow diagram of the attention mechanism module described in the present invention.

[0023] Figure 3 This is a flowchart of the license plate detection method provided by the present invention. DETAILED DESCRIPTION

[0024] The present invention will be further described below by way of embodiments in conjunction with the accompanying drawings, but the scope of the present invention is not limited in any way.

[0025] Example:

[0026] like Figure 1-3 As shown, this embodiment provides an unrestricted scene license plate detection method based on an improved attention mechanism. By combining the attention mechanism with deformable convolution, the license plate features are enhanced, and the problem of misalignment of the depth features of tilted or distorted license plates is solved. The specific implementation includes the following steps:

[0027] (1) Dataset construction:

[0028] Collect images containing regular, tilted, and distorted license plates from scenes such as traffic monitoring and side parking lots, build a dataset with no less than a certain number of license plates, mark the positions of the license plates, and divide the dataset into training, validation, and test sets.

[0029] (2) Deep convolution feature extraction:

[0030] The input image is fed into the feature extraction network with ResNet-50 as the backbone network. The attention mechanism module is embedded in the residual module of the ResNet-50 network. The feature map x input into the residual module is averaged and pooled using convolution kernels of sizes H×1 and 1×W to generate one-dimensional features of sizes C×1×W and C×H×1. The two one-dimensional features are expanded horizontally and vertically respectively to obtain two feature maps of the same size. The two feature maps are summed pixel by pixel to obtain a feature map of size C×H×W. The linear rectification function is then used for transformation. The newly generated feature map is then normalized. Finally, a deformable convolution is used to generate a new feature map that is fused with the residual module input x to generate a feature map of size C×H×W as the output of the residual module. The feature map is processed by the ResNet-50 backbone network to generate a feature map {P 1 ,P 2 ,P 3 ,P 4 ,P 5}, as the input features for the next step, specifically:

[0031] (21): The feature map input to the residual module is set to x, and its size changes with the number of ResNet layers. In this embodiment, it is uniformly set to C×H×W: C is the number of feature map channels, H and W correspond to the height and width of the feature map, respectively. In order to extract the channel information and position information of the license plate feature map, a pooling kernel with a size of H×1 and 1×W is used here to encode along the horizontal and vertical coordinate directions, and the vertical coordinate encoding of each channel is obtained as the position information of the feature. Therefore, the output feature with a channel number of C and a height of H can be expressed as: The output features with C channels and W width can be expressed as:

[0032] (22): In order to obtain the accurate position information of the license plate features and the set of channel relationship information, the two features are expanded, and the corresponding positions of the expanded feature maps are summed pixel by pixel to obtain a feature map of size C×H×W. The channel and position information are generated on the same feature map, which can be specifically expressed as:

[0033] (23) In order to better preserve the captured position information and the relationship information between channels, the newly generated feature map is subjected to a feasible variable convolution operation to further enhance the two types of license plate feature information, and the processed feature map is fused with x to generate a new feature map, which can be specifically expressed as: X = x c (i,j)+y c (i, j), where X is the newly generated feature map after fusion, which is input into the ResNet-50 backbone network to enter the next stage of processing.

[0034] (3) Training the detection network to increase weights:

[0035] {P 1 ,P 2 ,P 3 ,P 4 ,P 5} is input into the BiFPN network, and the weights are continuously learned using the training network to improve the network's ability to judge the importance of different features. At the same time, the top-down and bottom-up multi-scale feature fusion is repeatedly used to generate the feature map {C 1 ,C 2 ,C 3 ,C 4 ,C 5}, then multi-scale fusion is performed to obtain the feature map I, and the Sigmoid function is used to normalize I to the range of 0-1 to obtain the segmentation map, and the segmentation image is binarized using an adaptive threshold, where the license plate pixel is 1 and the background pixel is 0.

[0036] (4) License plate detection:

[0037] The generated binary image is subjected to a scale-by-scale expansion algorithm to distinguish the license plate area, and finally the license plate detection result is obtained.

[0038] (5) Train the network structure and obtain the trained model parameters.

[0039] For all models, ResNet-50 was used as the backbone network, which was pre-trained and trained in two ways. The detector was first trained for 600 epochs using the training images, and then the model was fine-tuned for 1200 epochs on each benchmark dataset. All models were trained on 4 NVIDIA Tesla V100 GPUs with a batch size of 16. The SGD optimizer was used in all training processes with a momentum of 0.9 and a poly learning rate strategy based on DBNet, where the learning rate for each iteration is equal to the initial learning rate multiplied by When the initial learning rate is set to 0.007, the momentum is 0.9, and max_iter represents the maximum number of iterations, whose value depends on the maximum epoch.

[0040] Data augmentation for training data includes: (1) random rotation with an angle range of [-10°, 10]; (2) random flipping of images; and (3) random cropping of images. To improve training efficiency, training images are resized to 640×640. During inference, test images maintain their aspect ratio and the input image size of each benchmark is adjusted by setting the appropriate height. The model is tested on a single NVIDIA 1080Ti GPU using a single thread with a batch size of 1.

[0041] This embodiment introduces an attention mechanism module to improve the ability of the backbone network to extract license plate feature information. The attention mechanism module is inserted into the classic detection network, which has the characteristics of lightweight. Based on this module, the structure is redesigned to introduce feasible variable convolution to propose a feature extraction network suitable for extracting license plate information, and the ResNet network is redesigned with ResNet-50 as the backbone network. The attention mechanism module is combined with the residual module. While capturing position information and channel relationships, the ability to retain license plate features is improved and information loss is reduced. The performance of the detection method based on convolutional neural network on rotated and distorted license plate targets is greatly improved on the basis of adding very few operations.

[0042] It should be noted that the purpose of publishing the embodiments is to help further understand the present invention, but those skilled in the art can understand that various substitutions and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the contents disclosed in the embodiments, and the scope of protection claimed by the present invention shall be subject to the scope defined in the claims.

Claims

1. A license plate detection method for unrestricted scenes based on improved attention mechanism, It is characterized in that The specific process is: (1) Dataset construction: Collect images containing regular, tilted, and distorted license plates from traffic surveillance and side parking lots, construct a dataset with no less than a certain number of license plates, annotate the locations of the license plates, and divide the dataset into training, validation, and test sets. (2) Deep convolution feature extraction: The image is input into the feature extraction network with ResNet-50 as the backbone network, and the feature map {P 1 ,P 2 ,P 3 ,P 4 ,P 5 } as the input feature of step (3); (3) Training the detection network to increase weight: {P 1 ,P 2 ,P 3 ,P 4 ,P 5 } is input into the BiFPN network, and the weights are continuously learned using the training network to improve the network's ability to judge the importance of different features. At the same time, the top-down and bottom-up multi-scale feature fusion is repeatedly used to generate the feature map {C 1 ,C 2 ,C 3 ,C 4 ,C 5 }, then multi-scale fusion is performed to obtain the feature map I, and the Sigmoid function is used to normalize I to the range of 0-1 to obtain the segmentation map, and the segmentation image is binarized using an adaptive threshold to obtain a binary map, in which the license plate pixel is 1 and the background pixel is 0; (4) License plate detection: Use the scale-by-scale expansion algorithm to distinguish the license plate area on the generated binary image and obtain the license plate detection result; (5) Train the network structure to obtain a trained network model: Use ResNet-50 as the backbone network to train the network model. After pre-training, two training processes are adopted to obtain a trained network model.

2. According to the unrestricted scene license plate detection method based on the improved attention mechanism according to claim 1, It is characterized in that The specific process of step (2) is as follows: (2-1) The attention mechanism module is embedded in the residual module of the ResNet-50 layer. The size of the feature map x input into the residual module changes with the number of ResNet layers and is uniformly set to C×H×W, where C is the number of feature map channels, H and W correspond to the height and width of the feature map, respectively. To extract the channel information and position information of the license plate feature map, a pooling kernel of size H×1 and 1×W is used to encode along the horizontal and vertical coordinate directions. The vertical coordinate encoding of each channel is the position information of the feature. Therefore, the output feature with the number of channels C and the height H is expressed as The output feature with the number of channels C and width W is expressed as (2-2) Features and The feature map is expanded, and the corresponding positions of the expanded feature map are summed pixel by pixel to obtain a feature map of size C×H×W. The channel and position information are generated on the same feature map, which is specifically expressed as (2-3) The feature map generated in step (2-2) is subjected to a feasible variable convolution operation, and the processed feature map is fused with the input feature map x to generate a new feature map X: X = x c (i,j)+y c (i,j) feature map X is input into the ResNet-50 backbone network to generate feature map {P 1 ,P 2 ,P 3 ,P 4 ,P 5 } as the input feature of step (3).

3. According to the unrestricted scene license plate detection method based on the improved attention mechanism according to claim 2, It is characterized in that The specific process of step (5) is as follows: (51) The detector was first trained for 600 epochs using the training images, and then the model was fine-tuned for 1200 epochs on each benchmark dataset. All models were trained with a batch size of 16 on four NVIDIA Tesla V100 GPUs. The SGD optimizer was used in all training processes with a momentum of 0.9 and a poly learning rate strategy based on DBNet, where the learning rate for each iteration was equal to the initial learning rate multiplied by When the initial learning rate is set to 0.007, the momentum is 0.9, and max_iter represents the maximum number of iterations, whose value depends on the maximum epoch; (52) The training set data was augmented, including random rotation with an angle range of *-10°, 10+, random image flipping, and random image cropping. The training images were resized to 640×640. During training, the aspect ratio of the training images was maintained, and the input image size of each benchmark was adjusted by setting the appropriate height. The model was tested with a batch size of 1 on a single NVIDIA 1080Ti GPU using a single thread.

Citation Information

Patent Citations

  • Structured identification method for medical laboratory sheet

    CN114429542A

  • Unmanned aerial vehicle moving target detection method based on attention mechanism

    CN115331127A

  • Method for improving accurate positioning of license plate

    CN115713756A

  • Pedestrian re-identification method based on coordinate attention and soft pooling

    CN116631061A

  • License plate recognition method and system based on cloud and mist collaboration framework

    CN117011840A

Cited By

  • Rotating convolutional neural network optimization method based on low-power-consumption Internet of Things monitoring

    CN119580071A