License plate recognition method and system based on attention distillation and storage medium

By using attention distillation, the global attention knowledge of the transformer decoder is passed to the CNN student model to build a deep neural network, which solves the accuracy and robustness problems of low-quality license plate image recognition and achieves faster and more accurate license plate recognition.

CN118865348AActive Publication Date: 2024-10-29ANHUI TSINGLINK INFORMATION TECH

Patent Information

Application Number
CN202410889633.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-29
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

Existing license plate recognition technologies lack accuracy and robustness in low-quality license plate images (such as low resolution, color cast, faded or missing characters, blurred edges, and tilted characters), affecting overall performance.

Method used

We employ an attention distillation-based approach to distill global attention knowledge from a heavyweight transformer-based teacher model and pass it to a CNN-based student model, constructing a deep neural network with both local and global attention mechanisms for license plate recognition.

Benefits of technology

It improves the accuracy and robustness of license plate recognition, enabling faster and more accurate identification of low-quality license plate images with color cast, dirt, adhesion, missing characters, etc., reducing sources of error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865348A_ABST
    Figure CN118865348A_ABST
Patent Text Reader

Abstract

The invention discloses a license plate recognition method and system based on attention distillation and a storage medium, and relates to the technical field of license plate recognition, and the method comprises the steps: preprocessing a license plate image, and inputting the preprocessed license plate image into a trained deep neural network model to output a license plate recognition result; the deep neural network model comprises a feature extraction module, a main branch bottleneck module, an auxiliary branch bottleneck module and a prediction module, after the main branch bottleneck module and the auxiliary branch bottleneck module are connected in parallel, the input end is connected with the output end of the feature extraction module, and the output end is connected to the input end of the prediction module; the feature extraction module inputs the preprocessed license plate image, and the prediction module outputs a license plate recognition result; according to the license plate recognition method and system and the storage medium, the core global attention knowledge of a heavy-weight teacher model based on a transformer decoder is distilled, the teacher model is taught and transmitted to a CNN-based student model, and the recognition accuracy and robustness are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of license plate recognition technology, and in particular to a license plate recognition method, system and storage medium based on attention distillation. Background Art

[0002] License plate recognition is the core technology of intelligent transportation, which includes two parts: license plate position detection and license plate recognition. Among them, license plate recognition is the most important part of the whole technology. The quality of license plate recognition engine directly determines the overall performance of license plate recognition technology.

[0003] License plate recognition refers to the accurate and complete identification of multiple information of a license plate in an image with a known license plate position, such as license plate color, license plate type, license plate characters, license plate character position, etc.

[0004] License plate color recognition mainly converts the image from RGB color space to HSV color space, and then recognizes the license plate color based on color histogram distribution or color-based classifier.

[0005] License plate type recognition is mainly achieved by classifying the appearance features of the license plate (such as color, size, and character layout), usually using machine learning or deep learning methods.

[0006] License plate character position recognition refers to accurately locating each single character in an image with a known license plate position. There are mainly the following methods:

[0007] (1) A method based on vertical projection: This method obtains the vertical projection curve of the license plate characters and obtains the edge position of each character according to the peak and trough positions of the curve.

[0008] (2) A method based on connected region analysis: This method first binarizes the license plate image, uses the feature that individual characters are simply connected regions for analysis, and finally obtains the position of the characters.

[0009] (3) Machine learning-based methods, such as "Chinese Patent Publication No. CN103207998A (A License Plate Character Segmentation Method Based on Support Vector Machine)", which obtains the layout characteristics of the license plate, uses a classifier for training and learning, and finally completes the license plate character segmentation.

[0010] License plate character recognition refers to identifying the true meaning of individual characters that have been accurately segmented. Commonly used methods include the following:

[0011] (1) Global features: This type of features uses global transformation to obtain the overall features of the characters, and uses ordered overall features or subset features to form feature vectors. Common features include GABOR transformation features, moment features, projection features, stroke density features, HARR features, HOG features, etc. The advantages of these features are that they are insensitive to local changes and have strong anti-interference capabilities; their disadvantages are that they are easy to ignore some important local features and cannot distinguish similar characters.

[0012] (2) Local features: This type of feature calculates the corresponding features in multiple local areas of a character and uses the serialized ordered local features to form the final feature vector. The main features include local grayscale histogram features, LBP features, threading features, SIFT features, etc. The advantage of this type of feature is its strong ability to distinguish characters; its disadvantage is that it pays too much attention to the local features of the characters and often misclassifies characters with noise interference.

[0013] The above technologies can achieve very good results for clear license plate images. However, the license plate images collected in the actual environment often have low resolution, color cast, some characters are lighter or missing, edges are blurred, characters are tilted, etc., which makes it difficult to accurately recognize license plates, and even fails, which seriously affects the overall performance of license plate recognition. Therefore, how to accurately and robustly recognize license plates is still a difficulty for domestic license plate recognition systems.

[0014] In recent years, transformer technology has gained wide attention and application in various fields due to its global attention mechanism, which enables accurate nonlinear prediction of global receptive fields and captures global long-distance dependencies. However, the disadvantage of this technology is that the model consumes a lot of memory and requires a lot of computation, so it requires a lot of memory and computing power. Summary of the invention

[0015] Based on the technical problems existing in the background technology, the present invention proposes a license plate recognition method, system and storage medium based on attention distillation, which improves the recognition accuracy and robustness.

[0016] The present invention proposes a license plate recognition method based on attention distillation, which pre-processes the license plate image and then inputs it into a trained deep neural network model to output the license plate recognition result;

[0017] The deep neural network model includes a feature extraction module, a main branch bottleneck module, an auxiliary branch bottleneck module and a prediction module. The input end of the main branch bottleneck module and the auxiliary branch bottleneck module connected in parallel is connected to the output end of the feature extraction module, and the output end is connected to the input end of the prediction module. The feature extraction module inputs the preprocessed license plate image, and the prediction module outputs the license plate recognition result.

[0018] The main branch bottleneck module abstracts the license plate image features based on the CNN network structure to obtain the main feature map; the auxiliary branch bottleneck module is based on the transformer decoder network structure, through the self-attention mechanism and the global attention mechanism, it abstracts the global and local features of the license plate image to obtain the auxiliary feature map.

[0019] Furthermore, the feature extraction module is used to obtain a high-level feature map of the license plate image with high abstraction and rich expression ability; the feature extraction module includes a convolution layer conv0, a maximum pooling layer maxpool0, a first residual module, a second residual module, a merging layer eltsum0, a merging layer eltsum1 and a convolution layer conv1;

[0020] The convolutional layer conv0 inputs the license plate image, and the convolutional layer conv0, the maximum pooling layer maxpool0, and the first residual module are connected in sequence and then connected to the input of the merging layer eltsum0;

[0021] The output of the merging layer eltsum0 is connected to the input of the merging layer eltsum1 and the input of the second residual module respectively. The output of the second residual module is connected to the input of the merging layer eltsum1. The output of the merging layer eltsum1 is connected to the input of the convolution layer conv1. The convolution layer conv1 outputs a high-level feature map.

[0022] Furthermore, the first residual module includes convolutional layers rconv0, rconv1 and rconv2, and the second residual module includes convolutional layers rconv3 and rconv4;

[0023] The convolutional layer rconv0 and the convolutional layer rconv1 are connected in series and then connected in parallel with the convolutional layer rconv2. The parallel input is connected to the output of the maximum pooling layer maxpool0, and the parallel output is connected to the input of the merging layer eltsum0.

[0024] The input of the convolution layer rconv3 and the convolution layer rconv4 are connected in series to the output of the merging layer eltsum0, and the concatenated output is connected to the input of the merging layer eltsum1.

[0025] Furthermore, the main branch bottleneck module includes a convolutional layer main_conv, a feature map size transformation layer main_reshape, and a fully connected layer main_fc connected in sequence, and the convolutional layer main_conv inputs a high-level feature map;

[0026] The feature map size transformation layer main_reshape is used to adjust the input feature map size to meet the needs of subsequent feature layer operations; the fully connected layer main_fc is used to adjust the number of channels of the output feature to output the main feature map.

[0027] Furthermore, the auxiliary branch bottleneck module includes an M-layer decoder structure, the license plate feature query vector output by the previous layer decoder structure is used as the input of the current layer decoder structure, and the M-th layer decoder structure outputs an auxiliary feature map;

[0028] Each layer of the decoder structure is based on the self-attention mechanism and the global attention mechanism to abstract the global and local features of the license plate image. The current layer of the decoder structure includes a multi-head self-attention layer, a first additive normalization layer, a multi-head global attention layer, a fully connected layer, a second additive normalization layer, and a third additive normalization layer;

[0029] The license plate feature query vector output by the decoder structure of the previous layer is input into the multi-head self-attention layer of the current layer. After being processed by the self-attention mechanism, the intermediate layer features are obtained through the first additive normalization layer.

[0030] The intermediate layer features and the license plate feature query vector output by the previous decoder structure are added pixel by pixel as the query Q of the multi-head global attention layer. The high-level feature map and the position encoding feature map corresponding to the high-level feature map are added pixel by pixel as the key K of the multi-head global attention layer. The high-level feature map is used as the value V of the multi-head global attention layer. The attention features output by the multi-head global attention layer and the intermediate layer features are obtained through the second addition normalization layer to obtain the added features. The added features pass through the fully connected layer and then enter the third addition normalization layer to be added and normalized again with the added features. The current layer outputs the license plate feature query vector through the third addition normalization layer.

[0031] Furthermore, the prediction module includes a feature channel splitting layer split and a fully connected layer fc;

[0032] The feature channel splitting layer split splits the input main feature map or auxiliary feature map into multiple sub-feature maps according to the channel dimension. The sub-feature maps pass through the fully connected layer fc to obtain the license plate recognition result. The number of the fully connected layers fc corresponds to the number of sub-feature maps.

[0033] Further, a supervision function is set for the deep neural network model, wherein the supervision function includes a main supervision function main_loss and an auxiliary supervision function aux_loss, wherein the auxiliary branch bottleneck module is only used for auxiliary training and is not used for the execution process after the deep neural network model training is completed;

[0034] The main supervision function is used to supervise the training of license plate recognition related tasks. The license plate character recognition task uses the ctc loss function, the license plate color recognition task and the license plate type recognition task both use the cross entropy loss function, and the license plate character position positioning task uses the mean square error loss function;

[0035] The auxiliary supervision function is used to distill the knowledge of the auxiliary branch bottleneck module, and then teach the training of the main branch bottleneck module. The auxiliary supervision function uses the KD divergence loss function.

[0036] Furthermore, the training process of the deep neural network model is as follows:

[0037] Collect license plate images in various scenes, various lights and various angles, use the license plate character segmentation method to obtain the license plate character local area image, and mark the license plate information in each license plate character local area image, the license plate information includes license plate color, license plate type, license plate character, and license plate character center position, so as to construct a training sample image;

[0038] Input the training sample images into the constructed deep neural network model to train the deep neural network model;

[0039] Train the teacher model, ignore the main branch bottleneck module, and train the feature extraction module, auxiliary branch bottleneck module, and prediction module based on the main supervision function main_loss;

[0040] Train the student model, ignore the auxiliary branch bottleneck module, freeze the feature extraction module and the prediction module, and train the main branch bottleneck module based on the main supervision function main_loss;

[0041] Comprehensive supervised training, freezing the auxiliary branch bottleneck module, training the feature extraction module, the main branch bottleneck module and the prediction module based on the main supervision function main_loss, and at the same time, auxiliary training of the feature extraction module and the main branch bottleneck module based on the auxiliary supervision function aux_loss.

[0042] A license plate recognition system based on attention distillation, which pre-processes the license plate image and inputs it into a trained deep neural network model to output the license plate recognition result;

[0043] The deep neural network model includes a feature extraction module, a main branch bottleneck module, an auxiliary branch bottleneck module and a prediction module. The input end of the main branch bottleneck module and the auxiliary branch bottleneck module connected in parallel is connected to the output end of the feature extraction module, and the output end is connected to the input end of the prediction module. The feature extraction module inputs the preprocessed license plate image, and the prediction module outputs the license plate recognition result.

[0044] The main branch bottleneck module abstracts the license plate image features based on the CNN network structure to obtain the main feature map; the auxiliary branch bottleneck module is based on the transformer decoder network structure, through the self-attention mechanism and the global attention mechanism, it abstracts the global and local features of the license plate image to obtain the auxiliary feature map.

[0045] A computer-readable storage medium stores a plurality of programs, wherein the plurality of programs are used to be called by a processor and execute the license plate recognition method as described above.

[0046] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0047] The advantages of the license plate recognition method, system and storage medium based on attention distillation provided by the present invention are: with the help of knowledge distillation technology, a heavyweight teacher model based on transformer decoder is distilled to its core global attention knowledge, and the knowledge is passed to the student model based on CNN, and finally, a deep neural network model with local attention mechanism and global attention mechanism is obtained, which directly completes the recognition of multiple license plate tasks and outputs the overall optimal license plate recognition result. Multiple license plate recognition tasks can be completed with only one deep neural network model, with faster recognition speed, fewer error sources, more accurate recognition results, and stronger robustness for low-quality license plate images with color cast, stains, adhesion, missing characters, and inaccurate positioning. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a structural schematic diagram of the present invention;

[0049] Figure 2 This is the structural diagram of the feature extraction module;

[0050] Figure 3 This is the main branch bottleneck module structure diagram;

[0051] Figure 4 This is the auxiliary branch bottleneck module structure diagram;

[0052] Figure 5 It is the structure diagram of the prediction module;

[0053] The letters and numbers next to each module graphic represent the name of the current feature layer and the feature map size of the current feature layer, that is, feature map height × feature map width × number of feature map channels. DETAILED DESCRIPTION

[0054] Below, the technical solution of the present invention is described in detail through specific embodiments. Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific implementation disclosed below.

[0055] like Figures 1 to 5 As shown, the present invention proposes a license plate recognition method based on attention distillation, which pre-processes the license plate image and then inputs it into a trained deep neural network model to output the license plate recognition result;

[0056] The deep neural network model includes a feature extraction module, a main branch bottleneck module, an auxiliary branch bottleneck module and a prediction module, the input end of the main branch bottleneck module and the input end of the auxiliary branch bottleneck module are both connected to the output end of the feature extraction module, the output end of the main branch bottleneck module and the output end of the auxiliary branch bottleneck module are both connected to the input end of the prediction module, the feature extraction module inputs the preprocessed license plate image, and the prediction module outputs the license plate recognition result;

[0057] The main branch bottleneck module abstracts the license plate image features based on the CNN network structure to obtain the main feature map; the auxiliary branch bottleneck module is based on the transformer decoder network structure, through the self-attention mechanism and the global attention mechanism, it abstracts the global and local features of the license plate image to obtain the auxiliary feature map.

[0058] This embodiment uses knowledge distillation technology to distill the core global attention knowledge of a heavyweight teacher model based on transformer decoder, and teaches it to the student model based on CNN. Finally, a deep neural network model with local attention mechanism and global attention mechanism is obtained, which can directly complete the recognition of multiple license plate tasks and output the overall optimal license plate recognition result. Multiple license plate recognition tasks can be completed with only one deep neural network model, with faster recognition speed, fewer sources of error, more accurate recognition results, and stronger robustness for low-quality license plate images with color cast, stains, adhesions, missing characters, and inaccurate positioning. The following is a detailed explanation.

[0059] The method proposed by the present invention is applicable to the recognition of any standard license plate, and only a partial image of the entire license plate needs to be obtained. In order to facilitate the description of the present invention, this embodiment takes Chinese license plates (including: single-layer blue plates, single-layer yellow plates, double-layer yellow plates, military and police plates, school license plates, and new energy license plates) as an example for description.

[0060] A license plate recognition method based on attention distillation includes the following steps:

[0061] S1. Design a deep neural network model. The deep neural network model designed in this embodiment mainly relies on a deep neural network teacher model based on a transformer decoder. Through the knowledge distillation technology, the advantages of the global attention and global vision of the transformer decoder are passed to the deep neural network student model based on CNN, which directly assists in completing the recognition of various feature tasks of license plates, including license plate color, license plate type, license plate character position, license plate character recognition, etc., and outputs the overall optimal license plate recognition result. Since the steps of license plate position correction, license plate character segmentation, and license plate character recognition are no longer deliberately distinguished, the entire license plate character recognition speed is faster, the error sources are fewer, and the recognition accuracy is higher. This embodiment uses a convolutional neural network (CNN) and a transformer structure to design a deep neural network model. In order to facilitate the description of the present invention, some terms are defined: feature map resolution refers to feature map height × feature map width, feature map size refers to feature map height × feature map width × number of feature map channels, kernel size refers to kernel width × kernel height, span refers to width direction span × height direction span, and each convolution layer is followed by a batch normalization layer and a nonlinear activation layer. Figure 1 As shown, the specific design steps are as follows:

[0062] S11. Design a feature extraction module backbone. The feature extraction module is mainly used to obtain high-level feature maps with high abstraction and rich expression capabilities of the input license plate image. The quality of high-level feature map extraction directly affects the performance of subsequent license plate recognition. This embodiment uses an improved ResNet classic network as the feature extraction network, such as Figure 2 As shown, the feature extraction module includes a convolutional layer conv0, a maximum pooling layer maxpool0, a first residual module, a second residual module, a merging layer eltsum0, a merging layer eltsum1 and a convolutional layer conv1; the convolutional layer conv0 inputs a license plate image, and the convolutional layer conv0, the maximum pooling layer maxpool0 and the first residual module are sequentially connected and then connected to the input of the merging layer eltsum0; the output of the merging layer eltsum0 is respectively connected to the input of the merging layer eltsum1 and the input of the second residual module, the output of the second residual module is connected to the input of the merging layer eltsum1, the output of the merging layer eltsum1 is connected to the input of the convolutional layer conv1, and the convolutional layer conv1 outputs a high-level feature map.

[0063] In addition, the first residual module includes a convolutional layer rconv0, a convolutional layer rconv1 and a convolutional layer rconv2, and the second residual module includes a convolutional layer rconv3 and a convolutional layer rconv4; the convolutional layer rconv0 and the convolutional layer rconv1 are connected in series and then arranged in parallel with the convolutional layer rconv2, the input after parallel connection is connected to the output of the maximum pooling layer maxpool0, and the output after parallel connection is connected to the input of the merging layer eltsum0; the input of the convolutional layer rconv3 and the convolutional layer rconv4 after being arranged in series is connected to the output of the merging layer eltsum0, and the output after series connection is connected to the input of the merging layer eltsum1.

[0064] The input image of the feature extraction module is a 3-channel RGB image with an image resolution of 224×72; conv0 is a convolutional layer with a kernel size of 3x3 and a stride of 2x2, maxpool0 is a maximum pooling layer with a kernel size of 2x2 and a stride of 2x2; rconv2 is a convolutional layer with a kernel size of 1x1 and a stride of 2x2, rconv0 and rconv3 are convolutional layers with a kernel size of 1x1 and a stride of 1x1, rconv1 is a convolutional layer with a kernel size of 3x3 and a stride of 2x2, rconv4 and conv1 are both convolutional layers with a kernel size of 3x3 and a stride of 1x1, eltsum0 and eltsum1 are merging layers, which add and merge multiple input feature maps into an output feature map according to corresponding elements; the output of the feature extraction network module is the high-level feature map featuremap.

[0065] S12. Design the main branch bottleneck module main_neck. The main branch bottleneck module further abstracts the license plate image features based on the CNN network structure based on the high-level feature map output by the feature extraction module. The specific network structure is shown in Figure 3. The main branch bottleneck module main_neck includes a convolutional layer main_conv, a feature map size transformation layer main_reshape, and a fully connected layer main_fc connected in sequence. The convolutional layer main_conv inputs the high-level feature map; the feature map size transformation layer main_reshape is used to adjust the input feature map size to meet the needs of subsequent feature layer operations; the fully connected layer main_fc is used to adjust the number of channels of the output feature to output the main feature map.

[0066] feature map represents the high-level feature map output by the feature extraction module. main_conv is a convolutional layer with a kernel size of 3x3 and a stride of 2x2. main_reshape is a feature map size transformation layer, which mainly adjusts the input feature map size to meet the needs of subsequent feature layer operations. main_fc is a fully connected layer used to adjust the number of channels of the output feature.

[0067] S13. Design the auxiliary branch bottleneck module aux_neck. The auxiliary branch bottleneck module is mainly based on the high-level feature map output by the feature extraction module. Based on the transformer decoder network structure, it further abstracts the global and local features of the license plate image through the self-attention mechanism and the global attention mechanism. The specific network structure is shown in Figure 4. The auxiliary branch bottleneck module includes an M-layer decoder structure. The license plate feature query vector output by the previous layer decoder structure is used as the input of the current layer decoder structure. The M-th layer decoder structure outputs an auxiliary feature map.

[0068] Each layer of the decoder structure is based on the self-attention mechanism and the global attention mechanism to abstract the global and local features of the license plate image. The current layer of the decoder structure includes a multi-head self-attention layer, a first additive normalization layer, a multi-head global attention layer, a fully connected layer, a second additive normalization layer, and a third additive normalization layer; the license plate feature query vector output by the previous layer of the decoder structure is input into the multi-head self-attention layer of the current layer, and after being processed by the self-attention mechanism, the intermediate layer features are obtained through the first additive normalization layer; the intermediate layer features are combined with the license plate features output by the previous layer of the decoder structure. The feature query vector is added pixel by pixel as the query Q of the multi-head global attention layer, the high-level feature map and the position encoding feature map corresponding to the high-level feature map are added pixel by pixel as the key K of the multi-head global attention layer, the high-level feature map is used as the value V of the multi-head global attention layer, the attention features output by the multi-head global attention layer and the intermediate layer features are obtained by the second addition normalization layer, the addition features pass through the fully connected layer and enter the third addition normalization layer for re-addition and normalization with the addition features, and the current layer outputs the license plate feature query vector through the third addition normalization layer.

[0069] feature map represents the high-level feature map output by the feature extraction module; feature pos represents the position encoding feature map corresponding to the feature map, which is used to represent the spatial positions of different pixels in the feature map feature map. The resolution of the position encoding feature map is the same as the resolution of the high-level feature map output by the feature extraction module. The specific feature values ​​of each position in the feature pos position encoding feature map are obtained through network training and learning; multi-head attention, multi-head self-attention, FFN, add&norm represent the multi-head global attention layer, multi-head self-attention layer, fully connected layer, and additive normalization layer, respectively. The specific meanings are consistent with the definitions in the ViT (AN IMAGE IS WORTH 16X16WORDS: TRANSFORMERS FORIMAGE RECOGNITION AT SCALE (an image is equivalent to 16X16 words: transformers for large-scale image recognition)) module; V, K, and Q represent the input components of the attention layer respectively; + represents the pixel-by-pixel addition layer of two input feature layers; aux feature queries are license plate feature query vectors, which are used to define the encoded feature vectors that the decoding module needs to output. The specific feature values ​​in the queries are obtained through network training and learning; the decoder structure will be repeatedly executed multiple times (M times). During the first execution, the input auxfeature queries of the decoding module are derived from the initial target query identification vector. During subsequent repeated executions, the input auxfeature queries of the decoding module are all derived from the aux feature queries outputted from the previous execution; M represents the number of repeated executions. In this embodiment, M=4.

[0070] S14, design prediction module predict_head, the prediction module is mainly based on the license plate feature expression vector obtained in step S12 or step S13 (S12 obtains the main feature map, S13 obtains the auxiliary feature map), predicts the output results of multiple tasks. The specific network structure is shown in 5, main / aux feature map represents the main feature map output by the main branch bottleneck module or the auxiliary feature map output by the auxiliary branch bottleneck module; the split layer is a feature channel splitting layer, which is used to split the input feature map into multiple sub-feature maps according to the channel dimension, feature0, feature1, feature2, feature3 all represent the sub-feature maps after the feature channel splitting layer splits, fc0, fc1, fc2, fc3 layers are all fully connected layers, feature0 and fc0 are mainly used for the recognition task of license plate characters, feature1 and fc1 are mainly used for the recognition task of license plate colors, feature2 and fc2 are mainly used for the recognition task of license plate types, and feature3 and fc3 are mainly used for the positioning task of the center position of license plate characters.

[0071] S15. Design the supervision function. The supervision function of this embodiment includes two parts, namely the main supervision function main_loss and the auxiliary supervision function aux_loss. The main supervision function is used to supervise the training of license plate recognition related tasks. The license plate character recognition task uses the ctc loss function (ctc loss), which is the most effective training loss function for identifying language sentences with contextual information relationships; the license plate color recognition task and the license plate type recognition task both use the cross entropy loss function; the license plate character position positioning task uses the mean square error (MSE) loss function. The auxiliary supervision function is mainly used to distill the knowledge of the auxiliary branch bottleneck module, and then teach the training of the main branch bottleneck module. The auxiliary supervision function uses the KD divergence loss function, which is the most commonly used supervision function for knowledge distillation.

[0072] S2. Training the deep neural network model mainly involves optimizing the parameters of the deep neural network model through a large amount of labeled training sample data, so that the recognition performance of the deep neural network model is optimal. The specific steps are as follows:

[0073] S21. Obtain training sample images, mainly collecting license plate images in various scenes, various lights, and various angles, using existing license plate character segmentation methods to obtain license plate character local area images, and then annotate the information of each license plate, including license plate color, license plate type, license plate characters, and license plate character center position.

[0074] S22, training the deep neural network model, mainly sending the labeled license plate sample image set into the defined deep neural network model to learn the relevant model parameters. This embodiment includes two supervision functions. In order to speed up the training speed of the model and improve the training effect, the following steps are specifically used for training:

[0075] S221. Train the teacher model, mainly ignoring the main branch bottleneck module, and training the feature extraction module, the auxiliary branch bottleneck module and the prediction module based on the main supervision function main_loss.

[0076] S222. Train the student model, mainly ignoring the auxiliary branch bottleneck module, freezing the feature extraction module and the prediction module, and training the main branch bottleneck module based on the main supervision function main_loss.

[0077] S223, comprehensive supervision training, mainly freezes the auxiliary branch bottleneck module, trains the feature extraction module, the main branch bottleneck module and the prediction module based on the main supervision function main_loss, and at the same time, assists in training the feature extraction module and the main branch bottleneck module based on the auxiliary supervision function aux_loss.

[0078] S3. Use the deep neural network model. After training the deep neural network model, the next step is to use the model in the actual environment. It should be noted that the auxiliary branch bottleneck module aux_neck is only used to assist training. When the deep neural network model is needed, the auxiliary branch bottleneck module aux_nec is ignored. For any given partial license plate image, send it to the trained deep neural network model and output the license plate recognition result. The specific steps are as follows:

[0079] S31, detect the partial license plate image, mainly in the whole image, detect the location of the license plate, extract the partial license plate image from the whole image through cropping operation, and normalize the image size. The main method is to use the existing mature method, which will not be described here.

[0080] S32. To recognize license plates, the main method is to send the normalized local license plate image into the trained deep neural network model, and the final output result is the optimal license plate recognition result.

[0081] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A license plate recognition method based on attention distillation, characterized in that: After preprocessing the license plate image, it is input into the trained deep neural network model to output the license plate recognition result; The deep neural network model includes a feature extraction module, a main branch bottleneck module, an auxiliary branch bottleneck module and a prediction module. The input end of the main branch bottleneck module and the auxiliary branch bottleneck module connected in parallel is connected to the output end of the feature extraction module, and the output end is connected to the input end of the prediction module. The feature extraction module inputs the preprocessed license plate image, and the prediction module outputs the license plate recognition result. The main branch bottleneck module abstracts the license plate image features based on the CNN network structure to obtain the main feature map; the auxiliary branch bottleneck module is based on the transformer decoder network structure, through the self-attention mechanism and the global attention mechanism, it abstracts the global and local features of the license plate image to obtain the auxiliary feature map.

2. The license plate recognition method based on attention distillation according to claim 1 is characterized in that: The feature extraction module is used to obtain a high-level feature map of the license plate image with high abstraction and rich expression ability; the feature extraction module includes a convolution layer conv0, a maximum pooling layer maxpool0, a first residual module, a second residual module, a merging layer eltsum0, a merging layer eltsum1 and a convolution layer conv1; The convolutional layer conv0 inputs the license plate image, and the convolutional layer conv0, the maximum pooling layer maxpool0, and the first residual module are connected in sequence and then connected to the input of the merging layer eltsum0; The output of the merging layer eltsum0 is connected to the input of the merging layer eltsum1 and the input of the second residual module respectively. The output of the second residual module is connected to the input of the merging layer eltsum1. The output of the merging layer eltsum1 is connected to the input of the convolution layer conv1. The convolution layer conv1 outputs a high-level feature map.

3. The license plate recognition method based on attention distillation according to claim 2 is characterized in that: The first residual module includes convolutional layers rconv0, rconv1 and rconv2, and the second residual module includes convolutional layers rconv3 and rconv4; The convolutional layer rconv0 and the convolutional layer rconv1 are connected in series and then connected in parallel with the convolutional layer rconv2. The parallel input is connected to the output of the maximum pooling layer maxpool0, and the parallel output is connected to the input of the merging layer eltsum0. The input of the convolution layer rconv3 and the convolution layer rconv4 are connected in series to the output of the merging layer eltsum0, and the concatenated output is connected to the input of the merging layer eltsum1.

4. The license plate recognition method based on attention distillation according to claim 2 is characterized in that: The main branch bottleneck module includes a convolutional layer main_conv, a feature map size transformation layer main_reshape, and a fully connected layer main_fc connected in sequence, and the convolutional layer main_conv inputs a high-level feature map; The feature map size transformation layer main_reshape is used to adjust the input feature map size to meet the needs of subsequent feature layer operations; the fully connected layer main_fc is used to adjust the number of channels of the output feature to output the main feature map.

5. The license plate recognition method based on attention distillation according to claim 2 is characterized in that: The auxiliary branch bottleneck module includes an M-layer decoder structure, the license plate feature query vector output by the previous layer decoder structure is used as the input of the current layer decoder structure, and the M-th layer decoder structure outputs an auxiliary feature map; Each layer of the decoder structure is based on the self-attention mechanism and the global attention mechanism to abstract the global and local features of the license plate image. The current layer of the decoder structure includes a multi-head self-attention layer, a first additive normalization layer, a multi-head global attention layer, a fully connected layer, a second additive normalization layer, and a third additive normalization layer; The license plate feature query vector output by the decoder structure of the previous layer is input into the multi-head self-attention layer of the current layer. After being processed by the self-attention mechanism, the intermediate layer features are obtained through the first additive normalization layer. The intermediate layer features and the license plate feature query vector output by the previous decoder structure are added pixel by pixel as the query Q of the multi-head global attention layer. The high-level feature map and the position encoding feature map corresponding to the high-level feature map are added pixel by pixel as the key K of the multi-head global attention layer. The high-level feature map is used as the value V of the multi-head global attention layer. The attention features output by the multi-head global attention layer and the intermediate layer features are obtained through the second addition normalization layer to obtain the added features. The added features pass through the fully connected layer and then enter the third addition normalization layer to be added and normalized again with the added features. The current layer outputs the license plate feature query vector through the third addition normalization layer.

6. The license plate recognition method based on attention distillation according to claim 1 is characterized in that: The prediction module includes a feature channel splitting layer split and a fully connected layer fc; The feature channel splitting layer split splits the input main feature map or auxiliary feature map into multiple sub-feature maps according to the channel dimension. The sub-feature maps pass through the fully connected layer fc to obtain the license plate recognition result. The number of the fully connected layers fc corresponds to the number of sub-feature maps.

7. The license plate recognition method based on attention distillation according to claim 1 is characterized in that: A supervision function is set for the deep neural network model, wherein the supervision function includes a main supervision function main_loss and an auxiliary supervision function aux_loss, wherein the auxiliary branch bottleneck module is only used for auxiliary training and is not used for the execution process after the deep neural network model training is completed; The main supervision function is used to supervise the training of license plate recognition related tasks. The license plate character recognition task uses the ctc loss function, the license plate color recognition task and the license plate type recognition task both use the cross entropy loss function, and the license plate character position positioning task uses the mean square error loss function; The auxiliary supervision function is used to distill the knowledge of the auxiliary branch bottleneck module, and then teach the training of the main branch bottleneck module. The auxiliary supervision function uses the KD divergence loss function.

8. The license plate recognition method based on attention distillation according to claim 7 is characterized in that: The training process of the deep neural network model is as follows: Collect license plate images in various scenes, various lights and various angles, use the license plate character segmentation method to obtain the license plate character local area image, and mark the license plate information in each license plate character local area image, the license plate information includes license plate color, license plate type, license plate character, and license plate character center position, so as to construct a training sample image; Input the training sample images into the constructed deep neural network model to train the deep neural network model; Train the teacher model, ignore the main branch bottleneck module, and train the feature extraction module, auxiliary branch bottleneck module, and prediction module based on the main supervision function main_loss; Train the student model, ignore the auxiliary branch bottleneck module, freeze the feature extraction module and the prediction module, and train the main branch bottleneck module based on the main supervision function main_loss; Comprehensive supervised training, freezing the auxiliary branch bottleneck module, training the feature extraction module, the main branch bottleneck module and the prediction module based on the main supervision function main_loss, and at the same time, auxiliary training of the feature extraction module and the main branch bottleneck module based on the auxiliary supervision function aux_loss.

9. A license plate recognition system based on attention distillation, characterized in that: After preprocessing the license plate image, it is input into the trained deep neural network model to output the license plate recognition result; The deep neural network model includes a feature extraction module, a main branch bottleneck module, an auxiliary branch bottleneck module and a prediction module. The input end of the main branch bottleneck module and the auxiliary branch bottleneck module connected in parallel is connected to the output end of the feature extraction module, and the output end is connected to the input end of the prediction module. The feature extraction module inputs the preprocessed license plate image, and the prediction module outputs the license plate recognition result. The main branch bottleneck module abstracts the license plate image features based on the CNN network structure to obtain the main feature map; the auxiliary branch bottleneck module is based on the transformer decoder network structure, through the self-attention mechanism and the global attention mechanism, it abstracts the global and local features of the license plate image to obtain the auxiliary feature map.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of programs, and the plurality of programs are used to be called by a processor and execute the license plate recognition method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Deep convolutional neural network self-distillation method based on image knowledge review

    CN114022727A

  • Vehicle model identification method and device, computer equipment and storage medium

    CN114742223A

  • License plate detection and identification method based on knowledge distillation guided by key foreground features

    CN115861997A

  • Knowledge distillation-based coal gangue detection method and device

    CN116012635A

  • Non-motor vehicle and rider attribute identification method based on teacher-student learning

    CN116311375A

Cited By

  • Incremental semantic segmentation method and automatic driving image semantic segmentation method

    CN119863796A