A license plate character recognition method and device
Patent Information
- Application Number
- CN202510172713.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2026-08-18
AI Technical Summary
[0003]然而,在月台场景中,车辆多为倒车入库,需要识别单双行的车牌号码;且由于摄像头位置较高导致拍摄的车牌图像的像素较低;且由于车辆装卸作业时间较短,对车牌识别的实时性具有较高要求;且不同转运中心的车牌差异较大,需要车牌字符识别模型具有较强的泛化性,并且,由于计算资源有限,需要部署较小参数量的车牌字符识别模型
[0052]上述发明中的一个实施例具有如下优点或有益效果:本发明实施例提供的车牌字符识别模型的训练方法,首先获取第一车牌数据集,利用第一车牌数据集训练得到车牌检测模型;然后从第一车牌数据集中筛选出第二车牌数据集,利用知识蒸馏的方式,将车牌检测模型作为教师模型,利用第二车牌数据集,训练学生模型,得到车牌字符识别模型。该方法利用小规模数据集,通过训练得到的泛化性较强且识别精度高的车牌检测模型,采用知识蒸馏的方式,得到车牌字符识别模型,该车牌字符识别模型具有轻量化特点,且计算复杂度低、在特定地区表现效果更好,利用该车牌字符识别模型进行车牌字符识别能够提升车牌字符识别的效率、准确率和精度。
Smart Images

Figure CN122598149A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for recognizing license plate characters. Background Technology
[0002] License plate character recognition identifies license plate numbers from vehicle images. In the platform scenarios of various logistics transfer centers, accurately recording the license plate numbers of vehicles corresponding to each platform allows for analysis of vehicle status and platform usage, thereby optimizing vehicle scheduling and improving logistics efficiency.
[0003] However, in platform scenarios, vehicles often reverse into parking spaces, requiring the identification of license plate numbers for both single and double lanes. Furthermore, the high position of the cameras results in lower resolution license plate images. The short loading and unloading times also necessitate high real-time performance for license plate recognition. Additionally, the significant differences in license plates across different transfer centers necessitate a license plate character recognition model with strong generalization capabilities. Moreover, limited computing resources necessitate deploying a license plate character recognition model with a small parameter set. Currently, no license plate character recognition model has been found that meets the requirements of these complex scenarios while maintaining high accuracy and efficiency. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a license plate character recognition method and apparatus, which can obtain a lightweight license plate character recognition model with low computational complexity and good performance in specific scenarios, thereby improving the efficiency and accuracy of license plate character recognition.
[0005] To achieve the above objectives, according to one aspect of the present invention, a method for training a license plate character recognition model is provided, comprising:
[0006] Obtain a first license plate dataset, which includes multiple first license plate data and a first label data corresponding to each first license plate data. The first label data includes the category and position of each character in the first license plate data.
[0007] A license plate detection model was trained based on the first license plate dataset.
[0008] The second license plate dataset is selected from the first license plate dataset;
[0009] Using knowledge distillation, the license plate detection model is used as the teacher model, and a license plate character recognition model is trained based on the second license plate dataset and the teacher model to obtain a license plate character recognition model as the student model.
[0010] Optionally, after training the license plate detection model based on the first license plate dataset, the method further includes:
[0011] Obtain the third license plate data to be identified;
[0012] The third license plate data is input into the license plate detection model to obtain the third predicted label data corresponding to the third license plate data;
[0013] Obtain the third label data after fine-tuning the third predicted label data;
[0014] The third license plate data and the third tag data are added to the first license plate dataset to update the first license plate dataset;
[0015] The license plate detection model was fine-tuned using the updated first license plate dataset.
[0016] Optionally, the second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data; the license plate character recognition model, trained as a student model based on the second license plate dataset and the teacher model, includes:
[0017] The second license plate data is input into the teacher model to obtain the second predicted label data of the second license plate data;
[0018] The second license plate data is input into the student model to obtain the fourth predicted label data of the second license plate data;
[0019] Construct a target loss function based on the second predicted label data, the fourth predicted label data, and the second label data;
[0020] The student model is trained by knowledge distillation based on the target loss function to obtain the license plate character recognition model.
[0021] Optionally, a target loss function is constructed based on the second predicted label data, the fourth predicted label data, and the second label data, including:
[0022] A first loss function is constructed based on the second predicted label data and the fourth predicted label data;
[0023] A second loss function is constructed based on the fourth predicted label data and the second label data;
[0024] The target loss function is constructed based on the first loss function and the second loss function.
[0025] Optionally, the second predicted label data includes a second predicted character category, a second predicted character position, and a second predicted character confidence level; the fourth predicted label data includes a fourth predicted character category, a fourth predicted character position, and a fourth predicted character confidence level. A first loss function is constructed based on the second predicted label data and the fourth predicted label data, including:
[0026] Calculate the character category loss based on the second predicted character category and the fourth predicted character category;
[0027] Calculate the character position loss based on the second predicted character position and the fourth predicted character position;
[0028] Calculate the character confidence loss based on the second predicted character confidence and the fourth predicted character confidence;
[0029] The first loss function is constructed based on the character category loss, the character position loss, and the character confidence loss, and their respective weight coefficients.
[0030] Optionally, a second license plate dataset is selected from the first license plate dataset, including:
[0031] From each set of first tag data, select a first preset number of first tag data with a preset character category and a second preset number of first tag data without the preset character category;
[0032] The second license plate dataset is constructed based on the selected first label data and its corresponding first license plate data.
[0033] According to another aspect of the present invention, a license plate character recognition method is provided, comprising:
[0034] Obtain the target license plate data to be identified;
[0035] The target license plate data is input into the license plate character recognition model to obtain the target label data corresponding to the target license plate data. The target label data includes the category and position of each character in the target license plate data.
[0036] The license plate character recognition model is trained using the license plate character recognition model training method according to an embodiment of the present invention.
[0037] According to another aspect of the present invention, a training apparatus for a license plate character recognition model is provided, comprising:
[0038] The first acquisition module acquires a first license plate dataset, which includes multiple first license plate data and first label data corresponding to each first license plate data. The first label data includes the category and position of each character in the first license plate data.
[0039] The first training module trains a license plate detection model based on the first license plate dataset.
[0040] The second acquisition module filters out a second license plate dataset from the first license plate dataset. The second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data.
[0041] The second training module employs knowledge distillation, using the license plate detection model as the teacher model, and trains a license plate character recognition model as the student model based on the second license plate dataset and the teacher model.
[0042] According to another aspect of the present invention, a license plate character recognition device is provided, comprising:
[0043] The third acquisition module acquires the target license plate data to be identified;
[0044] The determination module inputs the target license plate data into the license plate character recognition model to obtain target label data of the target license plate data. The target label data includes the category and position of each character in the target license plate data.
[0045] The license plate character recognition model is trained using the vehicle character recognition model training method according to an embodiment of the present invention.
[0046] According to another aspect of the present invention, an electronic device is provided, comprising:
[0047] One or more processors;
[0048] Storage device for storing one or more programs.
[0049] When the one or more programs are executed by the one or more processors, the one or more processors implement the training method or license plate character recognition method of the license plate character recognition model provided by the present invention.
[0050] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the training method for the license plate character recognition model or the license plate character recognition method provided by the present invention.
[0051] According to another aspect of the present invention, a computer program product is provided, including a computer program that, when executed by a processor, implements the training method for the license plate character recognition model or the license plate character recognition method provided by the present invention.
[0052] One embodiment of the above invention has the following advantages or beneficial effects: The training method for the license plate character recognition model provided in this embodiment of the invention first obtains a first license plate dataset and trains a license plate detection model using the first license plate dataset; then, a second license plate dataset is selected from the first license plate dataset, and using knowledge distillation, the license plate detection model is used as the teacher model, and the second license plate dataset is used to train the student model to obtain the license plate character recognition model. This method utilizes a small-scale dataset, and through the license plate detection model with strong generalization and high recognition accuracy obtained through training, a license plate character recognition model is obtained using knowledge distillation. This license plate character recognition model is lightweight, has low computational complexity, and performs better in specific regions. Using this license plate character recognition model for license plate character recognition can improve the efficiency, accuracy, and precision of license plate character recognition.
[0053] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0054] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0055] Figure 1 This is a schematic diagram of the main flow of a training method for a license plate character recognition model according to an embodiment of the present invention;
[0056] Figure 2 This is a flowchart illustrating a data pre-labeling method according to an embodiment of the present invention;
[0057] Figure 3 This is a flowchart illustrating the training process of a license plate character recognition model according to an embodiment of the present invention.
[0058] Figure 4 This is a schematic diagram of the main process of a license plate character recognition method according to an embodiment of the present invention;
[0059] Figure 5 This is a schematic diagram of the main modules of the training device for the license plate character recognition model according to an embodiment of the present invention;
[0060] Figure 6 This is a schematic diagram of the main modules of a license plate character recognition device according to an embodiment of the present invention;
[0061] Figure 7This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0062] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0063] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0064] Figure 1 This is a schematic diagram illustrating the main flow of a training method for a license plate character recognition model according to an embodiment of the present invention, as shown below. Figure 1 As shown, the training method for this license plate character recognition model includes the following steps:
[0065] Step S101: Obtain the first license plate dataset, which includes multiple first license plate data and the first label data corresponding to each first license plate data. The first label data includes the category and position of each character in the first license plate data.
[0066] Step S102: Train a license plate detection model based on the first license plate dataset;
[0067] Step S103: Filter out the second license plate dataset from the first license plate dataset;
[0068] Step S104: Using knowledge distillation, the license plate detection model is used as the teacher model, and a license plate character recognition model is trained based on the second license plate dataset and the teacher model to obtain the license plate character recognition model as the student model.
[0069] In this embodiment of the invention, when training the license plate character recognition model, a first license plate dataset is first obtained. The first license plate dataset includes multiple first license plate data and first label data corresponding to each first license plate data. The first license plate data can be a first license plate image captured by a camera. The first label data can include the annotation results of the license plate characters in the first license plate image, which can be manually annotated results. The first label data can include the category and position of each license plate character in the first license plate image. The category of each license plate character is a specific Chinese character, letter, or number. The position of each license plate character can include the coordinates of the rectangle corresponding to the license plate character. The first label data can also include the confidence level corresponding to the category of the license plate character. For example, the category of the license plate character in the first label data is "X", and the confidence level is 1.
[0070] In this embodiment of the invention, a license plate detection model is trained using a first license plate dataset. That is, a license plate detection model is trained using multiple first license plate datasets and the first label data corresponding to each first license plate dataset. The model result of the license plate detection model is a large parameter model, which is a model with a large number of parameters. A model with a large number of parameters is a model with a deep number of layers and a wide width. Recognizing license plate characters using a license plate detection model with a large number of parameters can improve the accuracy and precision of license plate character recognition.
[0071] In this embodiment of the invention, after training the license plate detection model based on the first license plate dataset, the method further includes:
[0072] Obtain the third license plate data to be identified;
[0073] The third license plate data is input into the license plate detection model to obtain the third predicted label data corresponding to the third license plate data;
[0074] Obtain the third label data after fine-tuning the third predicted label data;
[0075] Add the third license plate data and the third label data to the first license plate dataset to update the first license plate dataset;
[0076] The license plate detection model was fine-tuned using the updated first license plate dataset.
[0077] In this embodiment of the invention, the first license plate dataset can be a small amount of manually labeled license plate data. To further improve the recognition accuracy and precision of the vehicle detection model, it is necessary to fine-tune the vehicle detection model using a large amount of license plate data from complex scenarios. However, manually labeling a large amount of license plate data is too time-consuming and inefficient. To reduce the cost of manual labeling, the third license plate data to be identified can be used. The third license plate data is input into the license plate detection model, and the license plate detection model is used to pre-label the third license plate data to obtain third predicted label data. The third predicted label data is then fine-tuned manually, which can efficiently obtain high-quality labeled data. Then, the third license plate data and the fine-tuned third label data are added to the first license plate dataset to update the first license plate dataset. The updated first license plate dataset is then used to fine-tune the license plate detection model. This process is repeated continuously. As the amount of data in the first license plate dataset gradually increases, the performance of the vehicle detection model also continuously improves, thereby increasing the accuracy of the pre-labeling of the license plate detection model and significantly reducing the time cost of manual fine-tuning. By using a vehicle detection model to pre-label the third license plate data to be identified, the time required for manual labeling is significantly reduced, the manual cost increased due to labeled data during model iteration is reduced, and the labeling efficiency is improved.
[0078] Figure 2 This is a flowchart illustrating the data pre-labeling method according to an embodiment of the present invention. A license plate detection model is trained using a first license plate dataset. Then, the license plate detection model is used to pre-label the data of a third license plate to be identified. The pre-labeling results are then manually fine-tuned. The third license plate data and the fine-tuned pre-labeling results are added to the first license plate dataset, updating the first license plate dataset. The updated first license plate dataset is then used to train the license plate detection model, fine-tuning the model to improve the accuracy of pre-labeling, reduce the time cost of manual fine-tuning, and efficiently obtain high-quality labeled data.
[0079] In this embodiment of the invention, selecting a second license plate dataset from a first license plate dataset includes: selecting a first preset number of first label data with a preset character category and a second preset number of first label data without a preset character category from each first label data; and constructing a second license plate dataset based on the selected first label data and its corresponding first license plate data.
[0080] In this embodiment of the invention, the second license plate dataset is a small-scale dataset. It is obtained by filtering the first license plate dataset, and the smaller dataset is used to train the license plate character recognition model. The license plate character recognition model is a small-parameter model, meaning it has a small number of parameters (shallow layers and narrow width). Large-parameter and small-parameter models can be obtained by using models with the same structure but different parameter numbers. Using the YOLOv5 model structure, YOLOv5x (a large-parameter model) can be used to train a vehicle detection model, while YOLOv5s (a small-parameter model) can be used to train a vehicle character recognition model. Large-parameter models have higher accuracy, while small-parameter models have higher inference speed. By training the small-parameter model using knowledge distillation, the resulting small-parameter model, i.e., the vehicle character recognition model, can achieve high recognition efficiency and accuracy.
[0081] The second license plate dataset can be selected from the first license plate dataset according to a preset ratio, which can be customized. To further improve the recognition accuracy and precision of the license plate character model, since there are significant differences in license plate characters across different regions, the first license plate dataset includes first license plate data and their first label data for various scenarios and regions. The first license plate dataset can be filtered according to the region where the license plate character recognition model is deployed.
[0082] Specifically, the first label data in the first license plate dataset is grouped according to a preset character category. That is, first label data with the preset character category is grouped into one group, and first label data without the preset character category is grouped into another. Then, a first preset number of first label data with the preset character category and a second preset number of first label data without the preset character category are selected from these groups. The preset character category is set according to the deployment area of the license plate character recognition model. The first and second preset numbers can be customized to increase the number of first label data with the preset character category in the second license plate dataset. For example, the data volume of the second license plate dataset and the proportion of first label data with the preset character category can be set, thereby calculating the first and second preset numbers. The second license plate dataset is then constructed based on the selected first label data and their corresponding first license plate data. Because the proportion of license plate data from other non-deployment areas is reduced in the second license plate dataset, training the license plate character recognition model using the second license plate dataset can reduce model iteration time and enable the model to perform well in the deployment area, improving the model's recognition accuracy.
[0083] In this embodiment of the invention, the second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data; a license plate character recognition model, trained as a student model based on the second license plate dataset and the teacher model, includes:
[0084] The second license plate data is input into the teacher model to obtain the second predicted label data of the second license plate data;
[0085] The second license plate data is input into the student model to obtain the fourth predicted label data for the second license plate data;
[0086] Construct a target loss function based on the second predicted label data, the fourth predicted label data, and the second label data;
[0087] The student model is trained by knowledge distillation based on the objective loss function to obtain the license plate character recognition model.
[0088] In this embodiment of the invention, after obtaining the second license plate dataset, a knowledge distillation method is used. The license plate detection model is used as the teacher model, and the second license plate dataset is used to train the student model. After training, a license plate character recognition model is obtained. Specifically, the second license plate data is input into both the license plate detection model and the student model to obtain the second and fourth predicted label data corresponding to the second license plate data. A target loss function is constructed using the second and fourth predicted label data and the second label data. The student model is then trained using knowledge distillation based on the target loss function to obtain the license plate character recognition model. During training, the student model is continuously backpropagated to minimize the target loss function, while the teacher model does not participate in backpropagation. Training ends when the decrease in the target loss function is less than or equal to a preset value, resulting in a lightweight license plate character recognition model. Training the student model using knowledge distillation improves the model's performance.
[0089] In this embodiment of the invention, constructing a target loss function based on the second predicted label data, the fourth predicted label data, and the second label data includes: constructing a first loss function based on the second predicted label data and the fourth predicted label data; constructing a second loss function based on the fourth predicted label data and the second label data; and constructing a target loss function based on the first loss function and the second loss function.
[0090] In this embodiment of the invention, a first loss function is constructed using the second predicted label data and the fourth predicted label data. The first loss function represents the loss between the label data predicted by the teacher model and the label data predicted by the student model. Then, the product of the first loss function and the preset weight coefficients is calculated. A second loss function is constructed using the fourth predicted label data and the second label data. The second loss function represents the loss between the label data predicted by the student model and the actual label data. Then, the sum of the product and the second loss function is used as the target loss function. For example, equation (1) is the expression for the target loss function.
[0091] (1)
[0092] In equation (1), Let be the target loss function. For the second loss function, For the first loss function, These are the weighting coefficients of the first loss function.
[0093] In this embodiment of the invention, the second predicted label data includes a second predicted character category, a second predicted character position, and a second predicted character confidence level; the fourth predicted label data includes a fourth predicted character category, a fourth predicted character position, and a fourth predicted character confidence level. A first loss function is constructed based on the second predicted label data and the fourth predicted label data, including:
[0094] Calculate the character category loss based on the second and fourth predicted character categories;
[0095] Calculate the character position loss based on the second and fourth predicted character positions;
[0096] Calculate the character confidence loss based on the confidence scores of the second and fourth predicted characters;
[0097] The first loss function is constructed based on the character category loss, character position loss, and character confidence loss, and their respective weight coefficients.
[0098] In this embodiment of the invention, when constructing the first loss function, it is necessary to calculate the character class loss, character position loss, and confidence loss separately. The first loss function is constructed based on these losses. The second predicted label data includes the second predicted character category, the second predicted character position, and the second predicted character confidence; the fourth predicted label data includes the fourth predicted character category, the fourth predicted character position, and the fourth predicted character confidence. The character class loss, character position loss, and character confidence loss are calculated between the label data predicted by the teacher model and the label data predicted by the student model. The first loss function is constructed based on the character class loss, character position loss, and character confidence loss, or based on the character class loss, character position loss, character confidence loss, and their respective weight coefficients; this is known as knowledge distillation loss. The character class loss and character confidence loss can be calculated using BCEWithLogitsLoss, and the character position loss can be calculated using GIoULoss, i.e., the character position loss is calculated based on the intersection-union ratio (IUU) of the bounding boxes of the second and fourth predicted character positions. The first loss function can also be calculated by calculating the KL divergence of the second and fourth predicted label data.
[0099] For example, equation (2) is the expression for the first loss function.
[0100] Equation (2)
[0101] in, For character category loss, For character position loss, For character confidence loss, , and These represent the weight parameters corresponding to the loss.
[0102] Figure 3 This is a flowchart illustrating the training process of a license plate character recognition model according to an embodiment of the present invention. The teacher model and the student model are used to predict the second license plate data in the second license plate dataset, respectively, to obtain second predicted label data and fourth predicted label data. A first loss function representing knowledge distillation loss is constructed based on the second predicted label data and the fourth predicted label data. A second loss function is constructed using the second predicted label data and the second predicted label data. A target loss function is constructed based on the first loss function and the second loss function. The student model is then trained using knowledge distillation with the target loss function to minimize the target loss function. This process is repeated to backpropagate and train the student model, resulting in the license plate character recognition model.
[0103] The training method for a license plate character recognition model provided in this invention first acquires a first license plate dataset and trains a license plate detection model using this dataset. Then, a second license plate dataset is selected from the first dataset. Using knowledge distillation, the license plate detection model is used as the teacher model, and the second dataset is used to train the student model, resulting in a license plate character recognition model. This method utilizes a small dataset and, through training a license plate detection model with strong generalization and high recognition accuracy, employs knowledge distillation to obtain a lightweight, low-computation-complexity, and high-performance license plate character recognition model that performs better in specific regions. Furthermore, the method pre-labels the license plate data to be recognized using the license plate detection model, and then manually fine-tunes the pre-labeling results. This efficiently obtains high-quality labeled data to update the license plate dataset, and uses the updated dataset to fine-tune the vehicle detection model. Obtaining labeled data through pre-labeling significantly reduces the cost of manual labeling, improves labeling efficiency, and enhances the accuracy and precision of the vehicle detection model.
[0104] According to another aspect of the embodiments of the present invention, such as Figure 4 As shown, a method for recognizing license plate characters is provided, including the following steps:
[0105] Step S401: Obtain the target license plate data to be identified;
[0106] Step S402: Input the target license plate data into the license plate character recognition model to obtain the target label data corresponding to the target license plate data. The target label data includes the category and position of each character in the target license plate data. The license plate character recognition model is trained by the training method of the license plate character recognition model according to the embodiment of the present invention.
[0107] In this embodiment of the invention, after training the license plate character recognition model, the model can be deployed on the edge device or camera device where computing resources are limited, enabling rapid integration with the management system and thus improving overall operational efficiency. Real-time capture of the target license plate data is obtained using a camera. This data is then input into the license plate character recognition model to obtain target label data corresponding to the target license plate. The target label data includes the category and position of each license plate character. Specifically, the license plate character recognition model identifies the target license plate data, obtaining multiple candidate label data. Each candidate label data includes the category, position, and confidence level of each license plate character. A non-maximum suppression algorithm can be used to filter the target label data from these candidate labels, deleting other candidate labels. For example, the candidate labels can be sorted according to their confidence level from highest to lowest, with the highest-ranked candidate label data used as the target label data, and the candidate labels not ranked first deleted.
[0108] The license plate character recognition method of this invention uses a trained license plate character recognition model to recognize the characters of the target license plate data. Since the license plate character recognition model is trained by knowledge distillation through a license plate detection model with strong generalization and high accuracy, the license plate character model has a small number of parameters and low computational complexity, which improves the efficiency, accuracy and precision of license plate character recognition. It is suitable for license plate character recognition in complex scenarios and has good performance in specific scenarios.
[0109] According to another aspect of the embodiments of the present invention, such as Figure 5 As shown, a training device 500 for a license plate character recognition model is provided, comprising:
[0110] The first acquisition module 501 acquires the first license plate dataset, which includes multiple first license plate data and first label data corresponding to each first license plate data. The first label data includes the category and position of each character in the first license plate data.
[0111] The first training module 502 trains a license plate detection model based on the first license plate dataset.
[0112] The second acquisition module 503 filters out the second license plate dataset from the first license plate dataset. The second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data.
[0113] The second training module 504 uses knowledge distillation, with the license plate detection model as the teacher model, and trains the license plate character recognition model as the student model based on the second license plate dataset and the teacher model.
[0114] In this embodiment of the invention, the first training module 502 is further configured to: after training a license plate detection model based on the first license plate dataset, obtain the third license plate data to be identified; input the third license plate data into the license plate detection model to obtain the third predicted label data corresponding to the third license plate data; obtain the third label data after fine-tuning the third predicted label data; add the third license plate data and the third label data to the first license plate dataset to update the first license plate dataset; and fine-tune the license plate detection model using the updated first license plate dataset.
[0115] In this embodiment of the invention, the second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data; the second training module 504 is further configured to: input the second license plate data into the teacher model to obtain the second predicted label data of the second license plate data; input the second license plate data into the student model to obtain the fourth predicted label data of the second license plate data; construct a target loss function based on the second predicted label data, the fourth predicted label data, and the second label data; and perform knowledge distillation training on the student model based on the target loss function to obtain a license plate character recognition model.
[0116] In this embodiment of the invention, the second training module 504 is further configured to: construct a first loss function based on the second predicted label data and the fourth predicted label data; construct a second loss function based on the fourth predicted label data and the second label data; and construct a target loss function based on the first loss function and the second loss function.
[0117] In this embodiment of the invention, the second predicted label data includes a second predicted character category, a second predicted character position, and a second predicted character confidence score; the fourth predicted label data includes a fourth predicted character category, a fourth predicted character position, and a fourth predicted character confidence score. The second training module 504 is further configured to: calculate a character category loss based on the second predicted character category and the fourth predicted character category; calculate a character position loss based on the second predicted character position and the fourth predicted character position; calculate a character confidence loss based on the second predicted character confidence score and the fourth predicted character confidence score; and construct a first loss function based on the character category loss, the character position loss, and the character confidence loss and their respective weight coefficients.
[0118] In this embodiment of the invention, the second acquisition module 503 is further configured to: filter out a first preset number of first label data with a preset character category and a second preset number of first label data without a preset character category from each first label data; and construct a second license plate dataset based on the filtered first label data and its corresponding first license plate data.
[0119] According to another aspect of the embodiments of the present invention, such as Figure 6 As shown, a license plate character recognition device 600 is provided, comprising:
[0120] The third acquisition module 601 acquires the target license plate data to be identified;
[0121] The determination module 602 inputs the target license plate data into the license plate character recognition model to obtain the target label data of the target license plate data. The target label data includes the category and position of each character in the target license plate data.
[0122] The license plate character recognition model is trained using the vehicle character recognition model training method according to an embodiment of the present invention.
[0123] According to another aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the training method or license plate character recognition method of the license plate character recognition model provided by the present invention.
[0124] According to another aspect of the present invention, a computer-readable medium is provided, on which a computer program is stored, which, when executed by a processor, implements the training method for the license plate character recognition model or the license plate character recognition method provided by the present invention.
[0125] According to another aspect of the present invention, a computer program product is provided, including a computer program that, when executed by a processor, implements the training method or license plate character recognition method of the license plate character recognition model provided by the present invention.
[0126] Figure 7 An exemplary system architecture 700 is shown, which can be used to train a license plate character recognition model or a license plate character recognition model, as well as a license plate character recognition method or license plate character recognition device.
[0127] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, and 703, a network 704, and a server 705. Network 704 serves as the medium for providing communication links between terminal devices 701, 702, and 703 and server 705. Network 704 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0128] Users can use terminal devices 701, 702, and 703 to interact with server 705 via network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0129] Terminal devices 701, 702, and 703 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0130] Server 705 can be a server providing various services, such as a backend management server supporting shopping websites browsed by users using terminal devices 701, 702, and 703 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal devices.
[0131] It should be noted that the training method or license plate character recognition method of the license plate character recognition model provided in the embodiments of the present invention is generally executed by the server 705. Correspondingly, the training device or license plate character recognition device of the license plate character recognition model is generally set in the server 705.
[0132] It should be understood that Figure 7 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0133] The following is for reference. Figure 8 It shows a schematic diagram of the structure of a computer system 800 suitable for implementing a terminal device of the present invention. Figure 8 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0134] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the system 800. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0135] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.
[0136] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs the functions defined above in the system of this invention.
[0137] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0139] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a first acquisition module, a first training module, a second acquisition module, and a second training module. The names of these modules do not necessarily limit the module itself; for example, the first acquisition module can also be described as a "module for acquiring a first license plate dataset".
[0140] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: acquiring a first license plate dataset, the first license plate dataset including multiple first license plate data and first label data corresponding to each first license plate data, the first label data including the category and position of each character in the first license plate data; training a license plate detection model based on the first license plate dataset; filtering a second license plate dataset from the first license plate dataset; and using knowledge distillation, training a license plate character recognition model as a student model using the license plate detection model as a teacher model and the second license plate dataset and the teacher model.
[0141] According to the technical solution of the present invention, the training method for the license plate character recognition model provided in the present invention first obtains a first license plate dataset and trains a license plate detection model using the first license plate dataset; then, a second license plate dataset is selected from the first license plate dataset, and using knowledge distillation, the license plate detection model is used as the teacher model, and the second license plate dataset is used to train the student model to obtain the license plate character recognition model. This method utilizes a small-scale dataset, and through the trained license plate detection model with strong generalization and high recognition accuracy, it uses knowledge distillation to obtain a lightweight, low-computation-complexity, and high-performance license plate character recognition model that performs better in specific regions. The method also uses the license plate detection model to pre-label the license plate data to be recognized, and then manually fine-tunes the pre-labeling results. This efficiently obtains high-quality labeled data to update the license plate dataset, and uses the updated license plate dataset to fine-tune the vehicle detection model. Obtaining labeled data through pre-labeling significantly reduces the cost of manual labeling, improves labeling efficiency, and enhances the accuracy and precision of the vehicle detection model.
[0142] The license plate character recognition method of this invention uses a trained license plate character recognition model to recognize the characters of the target license plate data. Since the license plate character recognition model is trained by knowledge distillation through a license plate detection model with strong generalization and high accuracy, the license plate character model has a small number of parameters and low computational complexity, which improves the efficiency, accuracy and precision of license plate character recognition. It is suitable for license plate character recognition in complex scenarios and has good performance in specific scenarios.
[0143] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A training method for a license plate character recognition model, characterized in that, include: Obtain a first license plate dataset, which includes multiple first license plate data and a first label data corresponding to each first license plate data. The first label data includes the category and position of each character in the first license plate data. A license plate detection model was trained based on the first license plate dataset. The second license plate dataset is selected from the first license plate dataset; Using knowledge distillation, the license plate detection model is used as the teacher model, and a license plate character recognition model is trained based on the second license plate dataset and the teacher model to obtain a license plate character recognition model as the student model.
2. The method according to claim 1, characterized in that, After training the license plate detection model based on the first license plate dataset, the model also includes: Obtain the third license plate data to be identified; The third license plate data is input into the license plate detection model to obtain the third predicted label data corresponding to the third license plate data; Obtain the third label data after fine-tuning the third predicted label data; The third license plate data and the third tag data are added to the first license plate dataset to update the first license plate dataset; The license plate detection model was fine-tuned using the updated first license plate dataset.
3. The method according to claim 1, characterized in that, The second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data; a license plate character recognition model, trained as a student model based on the second license plate dataset and the teacher model, includes: The second license plate data is input into the teacher model to obtain the second predicted label data of the second license plate data; The second license plate data is input into the student model to obtain the fourth predicted label data of the second license plate data; Construct a target loss function based on the second predicted label data, the fourth predicted label data, and the second label data; The student model is trained by knowledge distillation based on the target loss function to obtain the license plate character recognition model.
4. The method according to claim 3, characterized in that, Construct a target loss function based on the second predicted label data, the fourth predicted label data, and the second label data, including: A first loss function is constructed based on the second predicted label data and the fourth predicted label data; A second loss function is constructed based on the fourth predicted label data and the second label data; The target loss function is constructed based on the first loss function and the second loss function.
5. The method according to claim 4, characterized in that, The second predicted label data includes a second predicted character category, a second predicted character position, and a second predicted character confidence level; the fourth predicted label data includes a fourth predicted character category, a fourth predicted character position, and a fourth predicted character confidence level. A first loss function is constructed based on the second predicted label data and the fourth predicted label data, including: Calculate the character category loss based on the second predicted character category and the fourth predicted character category; Calculate the character position loss based on the second predicted character position and the fourth predicted character position; Calculate the character confidence loss based on the second predicted character confidence and the fourth predicted character confidence; The first loss function is constructed based on the character category loss, the character position loss, and the character confidence loss, and their respective weight coefficients.
6. The method according to claim 1, characterized in that, The second license plate dataset is selected from the first license plate dataset, including: From each set of first tag data, select a first preset number of first tag data with a preset character category and a second preset number of first tag data without the preset character category; The second license plate dataset is constructed based on the selected first label data and its corresponding first license plate data.
7. A method for recognizing license plate characters, characterized in that, include: Obtain the target license plate data to be identified; The target license plate data is input into the license plate character recognition model to obtain the target label data corresponding to the target license plate data. The target label data includes the category and position of each character in the target license plate data. The license plate character recognition model is trained using the method described in any one of claims 1-6.
8. A training device for a license plate character recognition model, characterized in that, include: The first acquisition module acquires a first license plate dataset, which includes multiple first license plate data and first label data corresponding to each first license plate data. The first label data includes the category and position of each character in the first license plate data. The first training module trains a license plate detection model based on the first license plate dataset. The second acquisition module filters out a second license plate dataset from the first license plate dataset. The second license plate dataset includes multiple second license plate data and second label data corresponding to each second license plate data. The second training module employs knowledge distillation, using the license plate detection model as the teacher model, and trains a license plate character recognition model as the student model based on the second license plate dataset and the teacher model.
9. A license plate character recognition device, characterized in that, include: The third acquisition module acquires the target license plate data to be identified; The determination module inputs the target license plate data into the license plate character recognition model to obtain target label data of the target license plate data. The target label data includes the category and position of each character in the target license plate data. The license plate character recognition model is trained using the method described in any one of claims 1-6.
10. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
11. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.
12. A computer program product, comprising a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.