License plate recognition method, device and electronic equipment
Through the combination of YOLO, STN and attention models, combined with the inherent rules of license plates, the problem of the impact of differences in imaging quality in license plate recognition technology is solved, and a more accurate and stable license plate recognition effect is achieved.
Patent Information
- Application Number
- CN201811133867.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-09-27
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2038-09-27
AI Technical Summary
The imaging quality of existing license plate recognition technology varies greatly in different scenarios, which affects the recognition effect of deep learning methods, resulting in unsatisfactory license plate recognition results.
The YOLO model is used to detect license plate coordinate information and rough classification information, the STN model is combined to correct the license plate area image, the attention model is used for character recognition, and the recognition results are corrected through the inherent rules of the license plate to reduce the impact of imaging quality on recognition.
It improves the accuracy and reliability of license plate recognition, reduces recognition errors caused by imaging quality, and enhances the stability and accuracy of license plate recognition.
Smart Images

Figure CN110956169B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a license plate recognition method, device and electronic equipment. Background Art
[0002] The license plate is the "identity card" of the vehicle, which can uniquely identify the vehicle. In the fields of public security monitoring and traffic management, license plate recognition technology is widely used to obtain the license plate information of vehicles in scenes such as public security checkpoints, entrances and exits, and parking lots. Most license plates in various regions of the country are composed of numbers, letters, provincial abbreviations, and license plate purposes, and can be divided into several types of license plates.
[0003] The relevant technology usually uses deep learning methods to extract image features and then recognize the image features to obtain the license plate information in the image.
[0004] However, although the license plate type is relatively fixed, the image quality of the license plate varies greatly in different scenarios, and the image quality will greatly affect the recognition effect of the deep learning-based method. Therefore, in practical applications, the effect of license plate recognition is not ideal. Summary of the invention
[0005] In view of this, the present application provides a license plate recognition method, device and electronic device, which reduce the impact of imaging quality on recognition, and further process based on deep learning to achieve more accurate license plate recognition.
[0006] Specifically, the present application is implemented through the following technical solutions:
[0007] A license plate recognition method, comprising:
[0008] Inputting the target image into the trained YOLO model so that the YOLO model detects the license plate in the target image and outputs the coordinate information and rough classification information of the license plate in the target image;
[0009] Acquire a license plate area image of the license plate from the target image based on coordinate information of the license plate in the target image, and input the license plate area image into a preset STN model so that the STN model corrects the license plate area image;
[0010] Inputting the corrected license plate area image into a trained attention model so that the attention model outputs a character recognition result of the license plate based on the license plate area image;
[0011] The detailed classification information of the license plate is determined based on the character recognition result and the coarse classification information, and the license plate is recognized according to the detailed classification information and the character recognition result.
[0012] In the license plate recognition method, before recognizing the license plate according to the sub-classification information and the character recognition result, the method further includes:
[0013] Correcting the character recognition result of the license plate based on a preset license plate inherent rule;
[0014] The identifying the license plate according to the sub-classification information and the character recognition result includes:
[0015] The license plate is recognized based on the sub-classification information and the corrected character recognition result.
[0016] In the license plate recognition method, the step of recognizing the license plate based on the sub-classification information and the character recognition result includes:
[0017] Correcting the color information of the license plate in the coarse classification information based on the character recognition result and the fine classification information;
[0018] The license plate is identified based on the sub-classification information, the character recognition result and the corrected color information.
[0019] In the license plate recognition method, determining the detailed classification information of the license plate based on the character recognition result and the coarse classification information includes:
[0020] Calculating the confidence level corresponding to the character recognition result of the license plate;
[0021] Determining whether the confidence reaches a preset confidence threshold;
[0022] If so, based on the character recognition result and the coarse classification information of the license plate, the detailed classification information of the license plate is determined.
[0023] In the license plate recognition method, the coarse classification information is a plurality of category information divided according to color information and the number of layers of license plate characters, and the fine classification information is the license plate category actually divided based on relevant laws and regulations;
[0024] The determining of the detailed classification information of the license plate based on the character recognition result and the rough classification information of the license plate includes:
[0025] Based on the character recognition result and the rough classification information of the license plate, checking the preset fine classification information matching rules; wherein the fine classification information matching rules are a series of inherent rules for fine classification of license plates;
[0026] The sub-category information corresponding to the matched sub-category information matching rule is determined as the sub-category information of the license plate.
[0027] A license plate recognition device, comprising:
[0028] A positioning and classification unit, used for inputting a target image into a trained YOLO model so that the YOLO model detects the license plate in the target image and outputs coordinate information and rough classification information of the license plate in the target image;
[0029] A correction unit, used for acquiring a license plate area image of the license plate from the target image based on the coordinate information of the license plate in the target image, and inputting the license plate area image into a preset STN model so as to correct the license plate area image by the STN model;
[0030] A first recognition unit, used for inputting the corrected license plate area image into a trained attention model, so that the attention model outputs a character recognition result of the license plate based on the license plate area image;
[0031] The second recognition unit is used to determine the detailed classification information of the license plate based on the character recognition result and the coarse classification information, and recognize the license plate according to the detailed classification information and the character recognition result.
[0032] In the license plate recognition device, the second recognition unit is further used to:
[0033] Correcting the character recognition result of the license plate based on a preset license plate inherent rule;
[0034] When the license plate is recognized according to the sub-classification information and the character recognition result, the second recognition unit is further used to:
[0035] The license plate is recognized based on the sub-classification information and the corrected character recognition result.
[0036] In the license plate recognition device, the second recognition unit is further used to:
[0037] Correcting the color information of the license plate in the coarse classification information based on the character recognition result and the fine classification information;
[0038] The license plate is identified based on the sub-classification information, the character recognition result and the corrected color information.
[0039] In the license plate recognition device, the second recognition unit is further used to:
[0040] Calculating the confidence level corresponding to the character recognition result of the license plate;
[0041] Determining whether the confidence reaches a preset confidence threshold;
[0042] If so, based on the character recognition result and the coarse classification information of the license plate, the detailed classification information of the license plate is determined.
[0043] In the license plate recognition device, the coarse classification information is a plurality of category information divided according to color information and the number of layers of license plate characters, and the fine classification information is the license plate category actually divided based on relevant laws and regulations;
[0044] The second identification unit is further used for:
[0045] Based on the character recognition result and the rough classification information of the license plate, checking the preset fine classification information matching rules; wherein the fine classification information matching rules are a series of inherent rules for fine classification of license plates;
[0046] The sub-category information corresponding to the matched sub-category information matching rule is determined as the sub-category information of the license plate.
[0047] An electronic device includes a memory, a processor, and machine executable instructions stored in the memory and executable on the processor, wherein the processor implements the following method when executing the machine executable instructions:
[0048] Inputting the target image into the trained YOLO model so that the YOLO model detects the license plate in the target image and outputs the coordinate information and rough classification information of the license plate in the target image;
[0049] Acquire a license plate area image of the license plate from the target image based on coordinate information of the license plate in the target image, and input the license plate area image into a preset STN model so that the STN model corrects the license plate area image;
[0050] Inputting the corrected license plate area image into a trained attention model so that the attention model outputs a character recognition result of the license plate based on the license plate area image;
[0051] The detailed classification information of the license plate is determined based on the character recognition result and the coarse classification information, and the license plate is recognized according to the detailed classification information and the character recognition result.
[0052] In the embodiments of the present application, multiple steps adopt deep learning methods, and use the STN model to correct the license plate area image, reducing the impact of the imaging quality of the license plate on license plate recognition, thereby obtaining accurate coarse classification information and character recognition results. In addition, the coarse classification information and character recognition results are further processed to obtain fine classification information, avoiding inaccurate results due to overfitting of the network model when obtaining fine classification information directly through deep learning methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1is a schematic diagram of a license plate area image in a natural scene shown in the present application;
[0054] Figure 2 is a flow chart of a license plate recognition method shown in the present application;
[0055] Figure 3 It is a schematic diagram of license plate sub-classification information shown in this application;
[0056] Figure 4 is a block diagram of an embodiment of a license plate recognition device shown in the present application;
[0057] Figure 5 It is a hardware structure diagram of an electronic device shown in this application. DETAILED DESCRIPTION
[0058] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention and to make the above-mentioned purposes, features and advantages of the embodiments of the present invention more obvious and easy to understand, the prior art solutions and the technical solutions in the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings.
[0059] Most license plates in various regions of the country can be divided into several fixed types, but the image quality of license plates varies greatly in different natural scenes. Figure 1 , is a schematic diagram of a license plate area image in a natural scene shown in this application. Figure 1 As shown, due to the influence of objective factors such as shooting angle, lighting, and distance, there are many differences in the clarity, size, and recognizability of the license plate in the license plate area image.
[0060] In related technologies, license plate recognition methods based on deep learning mainly include the following parts: license plate positioning / vehicle positioning-license plate positioning, license plate area image correction, character segmentation, feature extraction, and character recognition. Usually, the above links can be processed using deep learning methods to obtain license plate recognition results.
[0061] However, related technologies usually use deep learning methods to extract image features and then recognize image features to obtain license plate information in the image. However, since the imaging quality of license plates in natural scenes varies greatly, even if a large number of image samples are used, the network model may be overfitted during the training process of the network model used for license plate recognition, making it impossible to obtain accurate recognition results.
[0062] In view of this, in the technical solution of the present application, the license plate area image is corrected in the process of identifying the target image by a method based on deep learning, which reduces the influence of the imaging effect on the recognition; in addition, after obtaining the rough classification information and character recognition results of the license plate in the target image based on the deep learning method, the above rough classification information and character recognition results are further processed, thereby improving the accuracy of license plate recognition. Among them, the target image generally refers to any image used for license plate recognition.
[0063] First, it is necessary to build a network model for license plate recognition in the technical solution of this application.
[0064] In one embodiment shown, the network model used in the present application may include a YOLO (You Only Look Once) model, an STN (Spatial Transformer Networks) model, and an AM (Attention Model) model.
[0065] Among them, the YOLO model is used to detect the license plate in the target image and determine the coordinate information and rough classification information of the license plate in the image. The above rough classification information is a variety of category information divided according to color information (including blue, yellow, white, green and black) and the number of layers of license plate characters (including single layer and double layer). In this application, the rough classification information can include nine license plate categories, including blue single layer, yellow single layer, yellow double layer, white single layer, white double layer, green single layer, green double layer, black single layer and others.
[0066] In the present application, a YOLO model based on a neural network can be built, and then a sample image is obtained. The sample image is marked with coarse classification information and coordinate information of the license plate in the image, and the coordinate information includes the center coordinates of the bounding box of the license plate and the width and height of the bounding box. The coarse classification information and coordinate information of the license plate in the sample image are output by the YOLO model, and then the network parameters of the neural network are trained according to the difference between the coarse classification information output by the YOLO model and the marked coarse classification information, and the difference between the coordinate information output by the YOLO model and the marked coordinate information. The neural network is trained by a certain number of sample images to obtain a YOLO model that can realize license plate positioning and coarse classification.
[0067] The STN model is used to correct the license plate area image extracted from the target image and align the license plate area image in space, thereby reducing the impact of geometric transformations such as rotation, translation, and distortion of the license plate contour on license plate recognition, and can solve problems such as tilted license plates or excessive shooting angles in target images.
[0068] In the present application, a STN model based on a neural network can be built, and then a sample image can be obtained. The sample image is marked with six angle values for affine transformation of the license plate in the image. The network parameters of the neural network are trained by using the difference between the six angle values calculated by the localization network of the STN model and the six angle values marked on the sample image. The neural network is trained with a certain number of sample images to obtain an STN model that can realize image correction in the license plate area.
[0069] The AM model is used to encode and decode the license plate area image, so as to obtain the character recognition result of the license plate in the license plate area image.
[0070] In the present application, an AM model based on a neural network can be built, and then a sample image can be obtained. The sample image is a license plate area image with the character information in the image marked. Since the number of characters in the actual license plate is not fixed, the character information marked in the sample image can include 7 to 10 characters. The character recognition results in the sample image output by the AM model are used to train the network parameters of the neural network according to the difference between the character recognition results and the marked character information. The AM model is trained with a certain number of sample images, thereby obtaining an AM model that can recognize characters in the license plate area image.
[0071] After building and training the above network model, license plate recognition can be performed based on the above network model.
[0072] See also Figure 2 , is a flow chart of a license plate recognition method shown in this application, such as Figure 2 As shown, the method comprises the following steps:
[0073] Step 201: Input a target image into a trained YOLO model so that the YOLO model detects the license plate in the target image and outputs coordinate information and rough classification information of the license plate in the target image.
[0074] Among them, the above-mentioned license plate recognition method can be applied to electronic devices involving license plate recognition, such as monitoring equipment at traffic checkpoints, or background servers of traffic monitoring systems.
[0075] In one embodiment shown, first, the target image can be input into a trained YOLO model, so that the YOLO model divides the target image into multiple grids and then predicts each grid, thereby obtaining the coordinate information and coarse classification information of the license plate in the target image.
[0076] The above YOLO model predicts B bounding boxes and the confidence of each bounding box for each grid. Therefore, each bounding box includes 5 elements (x, y, w, h, c), where (x, y) represents the coordinates of the bounding box in the target image, w and h represent the width and height of the bounding box, and c represents the confidence of the bounding box. The above bounding box is the coordinate information of the license plate.
[0077] In addition, a probability value corresponding to each type of coarse classification information is given to the B boundary boxes. In the present application, each boundary box has 9 probability values, each corresponding to a type of coarse classification information.
[0078] When the confidence of any bounding box reaches a preset confidence threshold and the probability value corresponding to a kind of coarse classification information reaches a preset probability value threshold, it can be determined that a license plate exists in the bounding box, and the coarse classification information is determined to be coarse classification information of the license plate. The coarse classification information is a plurality of categories of information divided according to color information (including blue, yellow, white, green and black) and the number of layers of license plate characters (including single layer and double layer).
[0079] Step 202: Acquire a license plate area image of the license plate from the target image based on the coordinate information of the license plate in the target image, and input the license plate area image into a preset STN model so that the STN model can correct the license plate area image.
[0080] In order to reduce the influence of the imaging quality of the license plate on the license plate recognition, the license plate area image may be input into the STN model so that the STN model can correct the license plate area image.
[0081] As an embodiment, in order to avoid the detection error of the YOLO model and ensure that a complete license plate area image is cut out, the license plate area image to be cut out can be determined after expanding the bounding box where the license plate is located by a specified distance to the four sides of the bounding box.
[0082] For example, if the bounding box of the license plate is (x, y, w, h), the position of the license plate area image can be (x, y, 1.4×w, 1.4×h), which means expanding outward by one-fifth on all four sides based on the bounding box.
[0083] The above STN model includes a positioning network, a grid generator (Grid Generator) and a sampler (Sampler).
[0084] The positioning network can perform a series of convolution calculations and full connection processing on the above license plate area image to obtain six angle values for affine transformation, and form the six angle values into a 2×3 matrix.
[0085] The grid generator uses the above matrix to calculate the coordinate positions in the corrected license plate area image, and obtains the coordinate position in the license plate area image before correction corresponding to each coordinate position in the corrected license plate area image.
[0086] For example, (0,1), (0,2)... in the corrected license plate area image correspond to (6,2), (6,3)... in the original license plate area image.
[0087] Furthermore, the sampler can use the above correspondence to obtain the value of the pixel point at each coordinate position from the license plate area image before correction, and then fill it into the corresponding position of the license plate area image after correction.
[0088] For example: if (0,1) in the corrected license plate area image corresponds to (6,2) in the uncorrected license plate area image, the sampler can obtain the value of the pixel at position (6,2) of the uncorrected license plate area image, and then fill it into position (0,1) of the corrected license plate area image.
[0089] Through the above processing, the STN model corrects the license plate area image.
[0090] See also Figure 1 As shown in the figure, after correction, the image of the license plate area in the first row and second column has a similar imaging effect to that in the second row and third column. Through correction, the problem of the license plate tilt or excessive shooting angle in the license plate area image can be solved, so that the subsequent AM model can obtain better character recognition effect.
[0091] Step 203: Input the corrected license plate area image into the trained attention model so that the attention model outputs the character recognition result of the license plate based on the license plate area image.
[0092] In practical applications, before the corrected license plate area image is input into the above-mentioned attention model, the license plate area image can first be compressed into an image feature sequence through convolution calculation, and then the image feature sequence is input into the above-mentioned attention model. The above-mentioned attention model can encode and decode the image feature sequence, obtain the target information, and then classify it to obtain the character recognition result of the above-mentioned license plate. The specific encoding and decoding process can refer to the existing related technology, which will not be repeated here.
[0093] Step 204: Determine detailed classification information of the license plate based on the character recognition result and the coarse classification information, and recognize the license plate according to the detailed classification information and the character recognition result.
[0094] The above detailed classification information is the actual classification of license plate categories based on relevant laws and regulations. Figure 3, which is a schematic diagram of a license plate sub-classification information shown in this application. Specifically, the sub-classification information may include 7 types, including blue civilian license plates, police license plates, training license plates, embassy license plates, motorcycle front license plates, motorcycle rear license plates and new energy license plates.
[0095] After obtaining the character recognition result and the rough classification information of the license plate in the target image based on the deep learning method, the fine classification information of the license plate can be determined based on the character recognition result combined with the rough classification information. Alternatively, the fine classification information of the license plate can be determined directly based on the character recognition result.
[0096] In actual applications, the network model may identify other things in the natural scene as license plates and output corresponding coarse classification information and character recognition results.
[0097] As an embodiment, in order to reduce the workload of license plate recognition, before determining the detailed classification information of the above license plate, a part of invalid license plates can be filtered according to the confidence level corresponding to the character recognition result.
[0098] The character recognition results output by the above attention model are multiple groups of characters and the confidence corresponding to each character in each group of characters. Among them, any group of characters represents a possible recognition result of a character in the license plate.
[0099] For example, if any license plate contains 7 characters, the above attention model will output 7 groups of characters, and each character in each group has a corresponding confidence. If the confidence of the first character in the first group of characters is 0.3, it means that the probability that the character is actually the first character of the license plate is 0.3.
[0100] First, the confidence corresponding to the character recognition result of the license plate can be calculated. As an embodiment, the maximum confidence in each group of characters can be accumulated and then the average value can be calculated.
[0101] Next, it can be determined whether the confidence reaches a preset confidence threshold, wherein the confidence threshold can be configured based on actual application effects, for example, it can be 0.65.
[0102] On the one hand, if the confidence does not reach the confidence threshold, it can be considered that the license plate is the result of a recognition error, and the recognition of the license plate is stopped.
[0103] On the other hand, if the confidence reaches the confidence threshold, it can be considered that the license plate does exist in the target image, and the license plate can be further identified. In this application, the detailed classification information of the license plate is determined.
[0104] In one of the illustrated embodiments, based on the character recognition result of the above license plate and the above rough classification information, the preset fine classification information matching rules can be checked, and the fine classification information corresponding to the matched fine classification information matching rules can be determined as the fine classification information of the above license plate.
[0105] Among them, the above fine classification information matching rules are a series of inherent rules for license plate fine classification.
[0106] For example: If the rough classification information is "white single layer" and the last character of the character recognition result is "police", the corresponding fine classification information is "police vehicle license plate".
[0107] If the second to sixth characters of the character recognition result are all numbers, the corresponding fine classification information is "embassy license plate".
[0108] If the character recognition result has eight characters and the rough classification information is "green single layer", the corresponding fine classification information is "new energy license plate".
[0109] Of course, there are other fine classification information matching rules, which will not be elaborated here one by one.
[0110] After obtaining the above fine classification information of the license plate, the above license plate can be recognized based on the above fine classification information and the above character recognition result.
[0111] In addition, to obtain a more accurate recognition result, as an embodiment, the character recognition result of the above license plate can also be corrected based on the preset license plate inherent rules.
[0112] Among them, the above license plate inherent rules are a series of inherent rules for correcting the character recognition result.
[0113] For example: If the character "Ji" exists in the character recognition result, the first letter of the character recognition result cannot be "I". If the first letter of the character recognition result is "I", it can be corrected to "J".
[0114] If the character "Ji" exists in the character recognition result, the first letter of the character recognition result cannot be "K". If the first letter of the character recognition result is "K", it can be corrected to "R".
[0115] If the character "Ji" exists in the character recognition result, the first letter of the character recognition result cannot be "M" or "N". If the first letter of the character recognition result is "M" or "N", it can be corrected to "H".
[0116] If the character "Jin" exists in the character recognition result, the first letter of the character recognition result cannot be "I". If the first letter of the character recognition result is "I", it can be corrected to "J".
[0117] If the character "晋" exists in the character recognition result, the first letter of the character recognition result cannot be "N". If the first letter of the character recognition result is "N", it can be corrected to "H".
[0118] If the character "蒙" exists in the character recognition result, the first letter of the character recognition result cannot be "Q". If the first letter of the character recognition result is "Q", it can be corrected to "D".
[0119] Of course, there are other inherent rules for license plates, which will not be elaborated here one by one.
[0120] After obtaining the above-mentioned detailed classification information of the license plate and the corrected character recognition result, the above-mentioned license plate can be recognized.
[0121] In an illustrated embodiment, to make the recognition result more abundant, the color information of the above-mentioned license plate can be corrected based on the character recognition result and the detailed classification information of the above-mentioned license plate.
[0122] See Figure 3 and the color information can be corrected according to the correspondence between the detailed classification information and the color information in Figure 3 .
[0123] For example: If the detailed classification information is "blue civilian license plate", the color information is "blue".
[0124] If the detailed classification information is "police license plate", the color information is "white".
[0125] After obtaining the corrected color information, the above-mentioned license plate is recognized based on the above-mentioned detailed classification information, the corrected character recognition result and the corrected color information.
[0126] Finally, the license plate recognition result of the above-mentioned license plate can be output. The above-mentioned license plate recognition result includes the character recognition result and the detailed classification information. Optionally, the above-mentioned license plate recognition result can also include the color information.
[0127] In summary, in the technical solution of the present application, the coordinate information and the rough classification information of the license plate are determined from the target image by the trained YOLO model, and then the license plate area image of the above-mentioned license plate is obtained from the above-mentioned target image based on the above-mentioned coordinate information, and the STN model is used to correct the above-mentioned license plate area image, so as to facilitate subsequent character recognition from the corrected license plate area image, reducing the influence of the imaging quality on the license plate recognition;
[0128] Furthermore, the license plate area image is input into the trained attention model, so that the attention model encodes and decodes the license plate area image and then outputs the character recognition result; after obtaining the coarse classification information and character recognition result of the license plate in the target image through the deep learning method, the detailed classification information of the license plate can be determined based on the coarse classification information and the character recognition result; in addition, the character recognition result can be corrected based on the inherent rules of the license plate, so as to obtain a more accurate character recognition result;
[0129] Multiple steps of the present application adopt the deep learning method, so that accurate coarse classification information and character recognition results can be obtained. In addition, the coarse classification information and character recognition results are further processed to obtain fine classification information, avoiding inaccurate results caused by overfitting of the network model when obtaining fine classification information directly through the deep learning method, and the correction of the character recognition results can also further improve the recognition rate of license plate recognition;
[0130] In addition, the present application can output license plate recognition results including color information, and the license plate recognition results are richer and can be applied to subsequent more flexible processing.
[0131] Corresponding to the above-mentioned embodiments of the license plate recognition method, the present application also provides embodiments of a license plate recognition device.
[0132] See also Figure 4 , is a block diagram of an embodiment of a license plate recognition device shown in this application:
[0133] like Figure 4 As shown, the license plate recognition device 40 includes:
[0134] The positioning and classification unit 410 is used to input the target image into the trained YOLO model so that the YOLO model detects the license plate in the target image and outputs the coordinate information and rough classification information of the license plate in the target image.
[0135] The correction unit 420 is used to obtain a license plate area image of the license plate from the target image based on the coordinate information of the license plate in the target image, and input the license plate area image into a preset STN model so that the STN model can correct the license plate area image.
[0136] The first recognition unit 430 is used to input the corrected license plate area image into the trained attention model so that the attention model outputs the character recognition result of the license plate based on the license plate area image.
[0137] The second recognition unit 440 is used to determine the detailed classification information of the license plate based on the character recognition result and the coarse classification information, and recognize the license plate according to the detailed classification information and the character recognition result.
[0138] In this example, the second identification unit 440 is further configured to:
[0139] Correcting the character recognition result of the license plate based on a preset license plate inherent rule;
[0140] When the license plate is recognized according to the sub-classification information and the character recognition result, the second recognition unit 440 is further used to:
[0141] The license plate is recognized based on the sub-classification information and the corrected character recognition result.
[0142] In this example, the second identification unit 440 is further configured to:
[0143] Correcting the color information of the license plate in the coarse classification information based on the character recognition result and the fine classification information;
[0144] The license plate is identified based on the sub-classification information, the character recognition result and the corrected color information.
[0145] In this example, the second identification unit 440 is further configured to:
[0146] Calculating the confidence level corresponding to the character recognition result of the license plate;
[0147] Determining whether the confidence reaches a preset confidence threshold;
[0148] If so, based on the character recognition result and the coarse classification information of the license plate, the detailed classification information of the license plate is determined.
[0149] In this example, the coarse classification information is a variety of category information divided according to color information and the number of layers of license plate characters, and the fine classification information is the license plate category actually divided based on relevant laws and regulations;
[0150] The second identification unit 440 is further configured to:
[0151] Based on the character recognition result and the rough classification information of the license plate, checking the preset fine classification information matching rules; wherein the fine classification information matching rules are a series of inherent rules for fine classification of license plates;
[0152] The sub-category information corresponding to the matched sub-category information matching rule is determined as the sub-category information of the license plate.
[0153] The embodiments of the license plate recognition device of the present application can be applied to electronic devices. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, the processor of the electronic device in which it is located reads the corresponding machine executable instructions in the machine readable storage medium into the memory and runs them.
[0154] From the hardware level, Figure 5 As shown, it is a hardware structure diagram of an electronic device in which the license plate recognition device of the present application is located, and the electronic device may include a processor 501 and a machine-readable storage medium 502 storing machine-executable instructions. The processor 501 and the machine-readable storage medium 502 may communicate via a system bus 503. The processor 501 can realize the above-mentioned license plate recognition by loading and executing the machine-executable instructions stored in the machine-readable storage medium 502.
[0155] The machine-readable storage medium 502 mentioned herein may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0156] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0157] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0158] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A license plate recognition method, characterized in that: Including: Input the target image into the trained YOLO model to detect the license plate in the target image by the YOLO model, and output the coordinate information and rough classification information of the license plate in the target image; Obtain the license plate region image of the license plate from the target image based on the coordinate information of the license plate in the target image, and input the license plate region image into a preset STN model to correct the license plate region image by the STN model and align the license plate region image spatially, where the STN model is trained in the following manner: build an STN model based on a neural network; obtain sample images, and the sample images are marked with six angle values for affine transformation of the license plate in the images; use the positioning network of the STN model to calculate the difference between the six angle values obtained from the sample images and the six marked angle values, and train the network parameters of the neural network; Input the corrected license plate region image into the trained attention model to output the character recognition result of the license plate by the attention model based on the license plate region image; Determine the fine classification information of the license plate based on the character recognition result and the rough classification information, including: calculate the confidence corresponding to the character recognition result of the license plate; determine whether the confidence reaches a preset confidence threshold; if so, based on the character recognition result and rough classification information of the license plate, check the preset fine classification information matching rules; where the fine classification information matching rules are a series of inherent rules for license plate fine classification; determine the fine classification information corresponding to the matched fine classification information matching rules as the fine classification information of the license plate; the rough classification information is multiple category information divided according to color information and the number of layers of license plate characters, and the fine classification information is the license plate category actually divided based on relevant regulations; Correct the character recognition result of the license plate based on the preset license plate inherent rules, where the preset license plate inherent rules include the following rules: if in the character recognition result, there is the character "Ji", and the first letter is "I", it can be corrected to "J"; if in the character recognition result, there is the character "Ji", and the first letter is "K", it can be corrected to "R"; if in the character recognition result, there is the character "Ji", and the first letter is "M" or "N", it can be corrected to "H"; if in the character recognition result, there is the character "Jin", and the first letter is "I", it can be corrected to "J"; if in the character recognition result, there is the character "Jin", and the first letter is "N", it can be corrected to "H"; if in the character recognition result, there is the character "Meng", and the first letter is "Q", it can be corrected to "D"; Identify the license plate based on the fine classification information and the corrected character recognition result, including: correct the color information of the license plate in the rough classification information based on the character recognition result and the fine classification information; identify the license plate based on the fine classification information, the character recognition result, and the corrected color information.
2. A license plate recognition device, characterized in that: Including: A positioning classification unit is used to input a target image into a trained YOLO model, so that the YOLO model detects a license plate in the target image and outputs coordinate information and rough classification information of the license plate in the target image; A correction unit is used to obtain a license plate region image of the license plate from the target image based on the coordinate information of the license plate in the target image, and input the license plate region image into a preset STN model, so that the STN model corrects the license plate region image and aligns the license plate region image spatially. Among them, the STN model is trained in the following way: build an STN model based on a neural network; obtain a sample image, and the sample image is marked with six angle values for affine transformation of the license plate in the image; use the positioning network of the STN model to calculate the difference between the six angle values obtained from the sample image and the six marked angle values, and train the network parameters of the neural network; A first recognition unit is used to input the corrected license plate region image into a trained attention model, so that the attention model outputs a character recognition result of the license plate based on the license plate region image; A second recognition unit is used to determine the detailed classification information of the license plate based on the character recognition result and the rough classification information, and recognize the license plate according to the detailed classification information and the corrected character recognition result; The rough classification information is multiple category information divided according to color information and the number of layers of license plate characters, and the detailed classification information is the license plate category actually divided based on relevant regulations; The second recognition unit is further used for: Calculate the confidence corresponding to the character recognition result of the license plate; determine whether the confidence reaches a preset confidence threshold; if so, based on the character recognition result and rough classification information of the license plate, check the preset detailed classification information matching rules; among them, the detailed classification information matching rules are a series of inherent rules for license plate detailed classification; Determine the detailed classification information corresponding to the matched detailed classification information matching rule as the detailed classification information of the license plate; The second recognition unit is further used for: correcting the character recognition result of the license plate based on the preset license plate inherent rules, where the preset license plate inherent rules include the following rules: if in the character recognition result, there is the character "Ji", and the first letter is "I", it can be corrected to "J"; if in the character recognition result, there is the character "Ji", and the first letter is "K", it can be corrected to "R"; if in the character recognition result, there is the character "Ji", and the first letter is "M" or "N", it can be corrected to "H"; if in the character recognition result, there is the character "Jin", and the first letter is "I", it can be corrected to "J"; if in the character recognition result, there is the character "Jin", and the first letter is "N", it can be corrected to "H"; if in the character recognition result, there is the character "Meng", and the first letter is "Q", it can be corrected to "D"; The second recognition unit is further used to: correct the color information of the license plate in the coarse classification information based on the character recognition result and the fine classification information; and recognize the license plate according to the fine classification information, the character recognition result and the corrected color information.
3. An electronic device, characterized in that: The electronic device includes a memory, a processor, and a machine executable instruction stored in the memory and executable on the processor, wherein the processor implements the following method when executing the machine executable instruction: Inputting the target image into the trained YOLO model so that the YOLO model detects the license plate in the target image and outputs the coordinate information and rough classification information of the license plate in the target image; A license plate area image of the license plate is obtained from the target image based on the coordinate information of the license plate in the target image, and the license plate area image is input into a preset STN model so that the STN model can correct the license plate area image and align the license plate area image in space, wherein the STN model is trained in the following manner: building an STN model based on a neural network; obtaining a sample image, wherein the sample image is marked with six angle values of the license plate in the image for affine transformation; using the positioning network of the STN model to calculate the differences between the six angle values of the sample image and the six marked angle values, and training the network parameters of the neural network; Inputting the corrected license plate area image into a trained attention model so that the attention model outputs a character recognition result of the license plate based on the license plate area image; Determining the detailed classification information of the license plate based on the character recognition result and the coarse classification information includes: calculating the confidence corresponding to the character recognition result of the license plate; determining whether the confidence reaches a preset confidence threshold; if so, checking the preset detailed classification information matching rules based on the character recognition result and the coarse classification information of the license plate; wherein the detailed classification information matching rules are a series of inherent rules for license plate detailed classification; determining the detailed classification information corresponding to the matched detailed classification information matching rules as the detailed classification information of the license plate; the coarse classification information is a plurality of category information divided according to color information and the number of layers of license plate characters, and the detailed classification information is the license plate category actually divided based on relevant laws and regulations; Correct the character recognition result of the license plate based on preset inherent rules of the license plate. Among them, the preset inherent rules of the license plate include the following rules: If in the character recognition result, there is a character "冀" and the first letter is "I", it can be corrected to "J"; if in the character recognition result, there is a character "冀" and the first letter is "K", it can be corrected to "R"; if in the character recognition result, there is a character "冀" and the first letter is "M" or "N", it can be corrected to "H"; if in the character recognition result, there is a character "晋" and the first letter is "I", it can be corrected to "J"; if in the character recognition result, there is a character "晋" and the first letter is "N", it can be corrected to "H"; if in the character recognition result, there is a character "蒙" and the first letter is "Q", it can be corrected to "D". Identify the license plate according to the detailed classification information and the corrected character recognition result, including: Correct the color information of the license plate in the rough classification information based on the character recognition result and the detailed classification information; Identify the license plate according to the detailed classification information, the character recognition result and the corrected color information.
