Vehicle identification code identification method and device, computer equipment and storage medium
By performing image quality detection and enhancement processing on VIN code images, the character and encoding area of the vehicle identification code are identified, which solves the problem of low VIN code recognition accuracy and achieves higher recognition accuracy.
Patent Information
- Application Number
- CN202510568680.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, the recognition accuracy of VIN code is low and is easily affected by factors such as lighting and environmental reflection.
By determining the image quality, image enhancement processing and denoising reconstruction are carried out, character areas and encoding areas of the vehicle identification code are identified, and identification processing is carried out for vehicle identification code, including image grayscale processing, clarity analysis, shape correction, brightness normalization and denoising reconstruction.
The recognition accuracy of vehicle identification codes is improved, the image quality is improved, and the recognition effect of character areas and encoding areas is enhanced.
Smart Images

Figure CN120544178A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for recognizing a vehicle identification code. Background Art
[0002] The VIN (Vehicle Identification Number) is a unique identification code for each motor vehicle, serving as its "identity card." It's typically engraved or affixed to the vehicle's dashboard, door frames, engine compartment, and other locations.
[0003] VIN code recognition has a wide range of applications. For example, you can use the VIN code to query the vehicle's brand, model, engine, production year and other information. You can also use the VIN code to query the vehicle's accident, repair, recall and other information.
[0004] Related technologies typically use artificial intelligence models like deep learning to identify VIN codes in images. However, because VIN codes are typically made of metal and are easily affected by factors like lighting and environmental reflections, AI models often have low recognition accuracy. Summary of the Invention
[0005] Based on this, it is necessary to provide a vehicle identification code recognition method, device, computer equipment, computer-readable storage medium and computer program product that can improve the recognition accuracy of vehicle identification codes in images in order to address the above technical problems.
[0006] In a first aspect, the present application provides a method for identifying a vehicle identification code. The method comprises:
[0007] Determining the image quality of an image to be identified; the image to be identified includes a vehicle identification code to be identified;
[0008] If the image quality meets the preset image quality condition, performing image enhancement processing and denoising and reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified;
[0009] Determining a character region and a coding region associated with the vehicle identification code in the reconstructed image;
[0010] The encoding area and / or the character area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
[0011] In one embodiment, determining the image quality of the image to be recognized includes:
[0012] Performing image grayscale processing on the image to be identified of the vehicle identification code to obtain a grayscale image of the image to be identified;
[0013] Performing clarity analysis processing on the grayscale image to obtain a clarity analysis result of the grayscale image;
[0014] The image quality of the image to be recognized is obtained according to the clarity analysis result.
[0015] In one embodiment, performing clarity analysis on the grayscale image to obtain a clarity analysis result of the grayscale image includes:
[0016] performing Laplace processing on the grayscale image to obtain a first clarity parameter of the grayscale image;
[0017] performing spatial frequency processing on the grayscale image to obtain a second clarity parameter of the grayscale image;
[0018] The first clarity parameter and the second clarity parameter are set as clarity analysis results of the grayscale image.
[0019] In one of the embodiments, the image quality condition includes a first parameter threshold and a second parameter threshold for image clarity;
[0020] If the image quality meets the preset image quality condition, the method further includes: performing image enhancement processing and denoising reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified;
[0021] If the first clarity parameter reaches the first parameter threshold, and the second clarity parameter reaches the second parameter threshold, confirming that the image quality meets the image quality condition;
[0022] If the first clarity parameter does not reach the first parameter threshold and / or the second clarity parameter does not reach the second parameter threshold, it is determined that the image quality does not meet the image quality condition, and the image to be identified of the vehicle identification code is reacquired.
[0023] In one embodiment, performing image enhancement processing and denoising reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified includes:
[0024] Performing image segmentation processing on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified;
[0025] performing shape correction processing on the identification code image to obtain a corrected image of the identification code image;
[0026] Performing brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image;
[0027] The image after brightness normalization is subjected to denoising and reconstruction processing by using an image denoising and reconstruction model to obtain the reconstructed image.
[0028] In one embodiment, performing brightness normalization on the corrected image to obtain a brightness normalized image of the corrected image includes:
[0029] Decomposing the rectified image into a reflection image and an illumination image; the reflection image is used to reflect the appearance information of the vehicle identification code; the illumination image is used to represent the change information of the ambient light of the vehicle identification code;
[0030] performing illumination compensation processing on the reflected image according to the illumination image to obtain a compensated reflected image;
[0031] Image reconstruction processing is performed on the compensated reflected image and the illumination image to obtain the brightness normalized image.
[0032] In one embodiment, performing denoising and reconstruction processing on the brightness normalized image using an image denoising and reconstruction model to obtain the reconstructed image includes:
[0033] Performing image block processing on the brightness normalized image using the image denoising and reconstruction model to obtain block images of the brightness normalized image;
[0034] Performing feature encoding processing on the block image through the encoder in the image denoising and reconstruction model to obtain embedded features of the block image;
[0035] Performing deep feature extraction processing on the block images through the bottleneck layer in the image denoising and reconstruction model to obtain deep features of the block images;
[0036] The decoder in the image denoising and reconstruction model decodes and reconstructs the embedded features and the deep features to obtain the reconstructed image.
[0037] In one embodiment, performing image segmentation processing on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified includes:
[0038] Performing contour extraction processing on the image to be identified to obtain contour information of the vehicle identification code in the image to be identified;
[0039] Based on the contour information, mask segmentation processing is performed on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified.
[0040] In one embodiment, performing shape correction processing on the identification code image to obtain a corrected image of the identification code image includes:
[0041] Based on the contour information, performing corner detection processing on the identification code image to obtain corner point information of the area where the vehicle identification code in the identification code image is located;
[0042] Obtaining a perspective transformation matrix of the identification code image according to the corner point information;
[0043] Based on the perspective transformation matrix, perspective transformation processing is performed on the identification code image to obtain a corrected image of the identification code image.
[0044] In one embodiment, determining the character region and the code region associated with the vehicle identification code in the reconstructed image includes:
[0045] Performing contour detection on the reconstructed image to obtain a candidate region in the reconstructed image;
[0046] Filtering a region to be processed from the candidate region according to the region area information of the candidate region;
[0047] Performing character extraction processing on the area to be processed by orthogonal moments to obtain character features of the area to be processed;
[0048] The character region and the coding region associated with the vehicle identification code are located in the area to be processed according to the character features.
[0049] In one embodiment, performing recognition processing on the encoding region and / or the character region for the vehicle identification code to obtain a target recognition result for the vehicle identification code includes:
[0050] Performing recognition processing on the coding area for the vehicle identification code to obtain an initial recognition result of the coding area and a confidence level of the initial recognition result;
[0051] If the confidence level reaches a preset confidence level, the initial recognition result is set as the target recognition result;
[0052] If the confidence level does not meet the confidence level condition, the character area is subjected to recognition processing for the vehicle identification code to obtain the target recognition result.
[0053] In one embodiment, performing recognition processing on the coding region for the vehicle identification code to obtain an initial recognition result of the coding region and a confidence level of the initial recognition result includes:
[0054] Determining line ratio information of each coding line in the coding area; the line ratio information is used to represent the ratio of the length to the width of the coding line;
[0055] Based on the line ratio information, matching the respective coded lines with the coded character table to obtain the initial recognition result;
[0056] The confidence level of the initial recognition result is obtained based on the matching information corresponding to the initial recognition result; the matching information includes at least one of the matching similarity between the coding line and the character in the coding character table and the check code of the character.
[0057] In one embodiment, performing recognition processing on the character area for the vehicle identification code to obtain the target recognition result includes:
[0058] Performing character segmentation processing on the character area to obtain sub-character areas in the character area;
[0059] The character recognition model is used to extract character features from the sub-character region to obtain sub-character features of the sub-character region; the character recognition model is obtained by performing model improvement processing on the initial recognition model through the attention mechanism;
[0060] Performing character recognition processing on the sub-character area based on the sub-character features using the character recognition model to obtain a character recognition result for the sub-character area;
[0061] According to the character recognition result, a target recognition result of the character area is obtained.
[0062] In a second aspect, the present application also provides a device for identifying a vehicle identification code. The device comprises:
[0063] A quality detection module, configured to determine the image quality of an image to be identified, wherein the image to be identified includes a vehicle identification code to be identified;
[0064] an image denoising module, configured to perform image enhancement processing and denoising reconstruction processing on the image to be identified if the image quality meets a preset image quality condition, to obtain a reconstructed image of the image to be identified;
[0065] A region positioning module, configured to determine a character region and a coding region associated with the vehicle identification code in the reconstructed image;
[0066] The identification code recognition module is used to perform identification processing on the coding area and / or the character area for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
[0067] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:
[0068] Determining the image quality of an image to be identified; the image to be identified includes a vehicle identification code to be identified;
[0069] If the image quality meets the preset image quality condition, performing image enhancement processing and denoising and reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified;
[0070] Determining a character region and a coding region associated with the vehicle identification code in the reconstructed image;
[0071] The encoding area and / or the character area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
[0072] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0073] Determining the image quality of an image to be identified; the image to be identified includes a vehicle identification code to be identified;
[0074] If the image quality meets the preset image quality condition, performing image enhancement processing and denoising and reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified;
[0075] Determining a character region and a coding region associated with the vehicle identification code in the reconstructed image;
[0076] The encoding area and / or the character area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
[0077] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0078] Determining the image quality of an image to be identified; the image to be identified includes a vehicle identification code to be identified;
[0079] If the image quality meets the preset image quality condition, performing image enhancement processing and denoising and reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified;
[0080] Determining a character region and a coding region associated with the vehicle identification code in the reconstructed image;
[0081] The encoding area and / or the character area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
[0082] The above-mentioned vehicle identification code recognition method, apparatus, computer equipment, storage medium and computer program product determine the image quality of the image to be recognized; the image to be recognized contains the vehicle identification code to be recognized; if the image quality meets the preset image quality conditions, the image to be recognized is subjected to image enhancement processing and denoising reconstruction processing to obtain a reconstructed image of the image to be recognized; the character area and coding area associated with the vehicle identification code in the reconstructed image are determined; the character area and / or coding area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code. By adopting this method, by processing the image to be recognized whose image quality meets the image quality conditions, it is possible to achieve preliminary screening of the image, improve the quality of the image to be recognized for subsequent processing, and help improve the recognition accuracy of the vehicle identification code in the image to be recognized; the image to be recognized is subjected to dual image processing through image enhancement and denoising reconstruction, further improving the performance of the vehicle identification code in the reconstructed image, improving the recognition effect of the vehicle identification code in the character area and coding area of the reconstructed image, thereby greatly improving the recognition accuracy of the target recognition result of the vehicle identification code in the image to be recognized. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] Figure 1 1 is a flow chart of a method for identifying a vehicle identification code in one embodiment;
[0084] Figure 2 A schematic flow chart of steps of performing image enhancement processing and denoising and reconstruction processing on an image to be recognized in one embodiment;
[0085] Figure 3 A schematic diagram showing a reflection phenomenon in a partial area of a vehicle identification code according to an embodiment;
[0086] Figure 4 A flowchart illustrating steps of performing identification processing on a coding area and / or a character area for a vehicle identification code in one embodiment;
[0087] Figure 5 1 is a flow chart of a method for identifying a vehicle identification code in another embodiment;
[0088] Figure 6 is a structural block diagram of a vehicle identification code recognition device in one embodiment;
[0089] Figure 7 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0090] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0091] In one embodiment, Figure 1 As shown, a method for identifying a vehicle identification code is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0092] Step S101 , determining the image quality of an image to be recognized; the image to be recognized includes a vehicle identification code to be recognized.
[0093] The image to be identified refers to an image containing a vehicle identification number (VIN) to be identified.
[0094] Image quality refers to information that describes the visual condition of an image (such as clarity, color, sharpness, details, etc.).
[0095] Specifically, a terminal can capture the vehicle's VIN to obtain an image. Alternatively, another device (such as a camera) can be used to capture the VIN to obtain an image, which can then be sent to the terminal. For example, the terminal can be a user's smartphone, which captures the VIN on the vehicle's windshield to obtain an image. After obtaining the image, the terminal can directly analyze the image quality, or perform some image processing on the image before analyzing its quality to improve the accuracy of the image quality analysis.
[0096] Step S102: If the image quality meets the preset image quality condition, image enhancement processing and denoising and reconstruction processing are performed on the image to be identified to obtain a reconstructed image of the image to be identified.
[0097] The image quality condition refers to a condition used to determine the image quality of an image (such as a grayscale image or an image to be recognized). For example, the image quality condition can be set to require that the clarity parameter of the image reaches a corresponding parameter threshold.
[0098] The reconstructed image refers to the image obtained after the image to be identified has undergone multiple processing (such as shape correction of the vehicle identification code, image brightness processing, image denoising, etc.).
[0099] Specifically, when it is detected that the image quality of the image to be identified meets the preset image quality conditions and the image quality of the image to be identified is confirmed to be qualified, the terminal performs image enhancement processing and denoising and reconstruction processing on the image to be identified. For example, image correction and brightness normalization processing are first performed to correct the deformation problem of the vehicle identification code in the image to be identified and remove the image blur caused by lighting factors such as reflection. Then, image reconstruction processing is used to remove the noise in the image to be identified, and finally a reconstructed image of the image to be identified is obtained. This not only realizes the deformation correction of the image, but also solves the reflection blur problem caused by the material of the vehicle identification code, and removes the noise in the image, thereby greatly improving the image quality.
[0100] Step S103 , determining the character region and the code region associated with the vehicle identification code in the reconstructed image.
[0101] The VIN can be composed of characters or in a coded form such as a QR code or barcode. The character region refers to the area within an image (e.g., the image to be identified or the reconstructed image) containing the VIN in character form. The coded region refers to the area within an image (e.g., the image to be identified or the reconstructed image) containing the VIN in coded form.
[0102] Specifically, the terminal can first detect the candidate areas where characters and codes may exist in the reconstructed image through the contour detection algorithm, and then further filter out the areas with a higher probability of characters and codes from the candidate areas to obtain the area to be processed, and then locate the character area where the characters are located and the coding area where the codes are located from the area to be processed.
[0103] Step S104 , performing recognition processing for the vehicle identification code on the coding area and / or the character area to obtain a target recognition result for the vehicle identification code.
[0104] Specifically, to improve recognition efficiency, the terminal may first perform recognition processing on the coding area for the vehicle identification code. If the recognition result of the coding area is reliable and effective, the recognition result of the coding area may be set as the target recognition result for the vehicle identification code of the image to be recognized. If the recognition result of the coding area is unreliable, for example, the recognition result has a low confidence level, the terminal may then perform recognition processing on the character area for the vehicle identification code, and then set the recognition result of the character area as the target recognition result for the vehicle identification code of the image to be recognized.
[0105] Of course, the terminal may also first perform recognition processing on the character area for the vehicle identification code. If the recognition result of the character area is reliable and valid, the recognition result of the character area may be set as the target recognition result for the vehicle identification code of the image to be recognized. If the recognition result of the character area is unreliable, for example, the recognition result has a low confidence level, the terminal may then perform recognition processing on the coding area for the vehicle identification code, and then set the recognition result of the coding area as the target recognition result for the vehicle identification code of the image to be recognized.
[0106] It is understandable that the terminal can also perform recognition processing on the coding area and the character area for the vehicle identification code at the same time, and then combine the recognition results of the coding area and the recognition results of the character area to obtain the target recognition result of the vehicle identification code of the image to be recognized.
[0107] In the above-mentioned method for recognizing a vehicle identification code, the image quality of the image to be recognized is determined; the image to be recognized contains the vehicle identification code to be recognized; if the image quality meets the preset image quality conditions, the image to be recognized is subjected to image enhancement processing and denoising reconstruction processing to obtain a reconstructed image of the image to be recognized; the character area and coding area associated with the vehicle identification code in the reconstructed image are determined; the character area and / or coding area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code. By adopting this method, by processing the image to be recognized whose image quality meets the image quality conditions, it is possible to achieve preliminary screening of the image, improve the quality of the image to be recognized for subsequent processing, and help improve the recognition accuracy of the vehicle identification code in the image to be recognized; the image to be recognized is subjected to dual image processing through image enhancement and denoising reconstruction, further improving the performance of the vehicle identification code in the reconstructed image, improving the recognition effect of the vehicle identification code in the character area and coding area of the reconstructed image, thereby greatly improving the recognition accuracy of the target recognition result of the vehicle identification code in the image to be recognized.
[0108] In one embodiment, the above-mentioned step S101, determining the image quality of the image to be identified, specifically includes the following contents: performing image grayscale processing on the image to be identified of the vehicle identification code to obtain a grayscale image of the image to be identified; performing clarity analysis processing on the grayscale image to obtain a clarity analysis result of the grayscale image; and obtaining the image quality of the image to be identified based on the clarity analysis result.
[0109] The grayscale image refers to an image obtained after the image to be identified is grayscaled.
[0110] In practical applications, a vehicle's vehicle identification code is typically stamped onto vehicle accessories using metal stamping technology. Due to the reflective nature of metal materials, when photographing the vehicle identification code, it is often affected by the reflection, resulting in some missing information in the captured image to be identified. For example, reflections from a vehicle's windshield can cause parts of the vehicle identification code on the windshield to appear as a ball of light in the captured image to be identified, making it impossible to clearly identify the image of the vehicle identification code. Therefore, the terminal can first grayscale the image to be identified and then perform multiple image quality analyses on the grayscale image to be identified. For example, the clarity of the grayscale image can be analyzed to obtain a clarity analysis result of the image to be identified. The image detail analysis result of the grayscale image can also be analyzed to obtain an image detail analysis result of the image to be identified. The clarity of the image to be identified can also be obtained through a variety of different clarity analysis methods. The terminal can then determine the image quality of the image to be identified based on the clarity analysis result or the image detail analysis result.
[0111] In this embodiment, by performing clarity analysis on the grayscale image of the image to be identified, the image quality of the image to be identified can be determined based on the clarity analysis results obtained, laying the foundation for the subsequent steps of determining whether the image to be identified is suitable for vehicle identification code recognition processing.
[0112] In one embodiment, a clarity analysis process is performed on a grayscale image to obtain a clarity analysis result of the grayscale image, specifically including the following: performing Laplace processing on the grayscale image to obtain a first clarity parameter of the grayscale image; performing spatial frequency processing on the grayscale image to obtain a second clarity parameter of the grayscale image; and setting the first clarity parameter and the second clarity parameter as the clarity analysis result of the grayscale image.
[0113] The terminal can determine the image quality of the image to be recognized by analyzing the clarity of the grayscale image. Specifically, the terminal can use the Laplacian operator (LV) to calculate the clarity of the grayscale image, thereby obtaining a first clarity parameter for the grayscale image. The terminal can also calculate the spatial frequency of the grayscale image and set the spatial frequency as the second clarity parameter for the grayscale image. Finally, the terminal combines the first clarity parameter and the second clarity parameter to obtain an overall clarity analysis result for the grayscale image.
[0114] The Laplace operator is a second-order differential operator that can be used to detect edge information in images (such as grayscale images), thereby measuring their clarity. The core idea of Laplace processing is to calculate the second-order derivative of pixels in an image. High-frequency information (such as edges and details) is stronger in sharp images and weaker in blurred images. Therefore, a larger first clarity parameter indicates that the image has more high-frequency details and higher clarity. A smaller first clarity parameter indicates that the image has less edge detail and is likely blurred.
[0115] The spatial frequency reflects the overall activity level of the spatial domain of an image (such as a grayscale image). The larger the spatial frequency (i.e., the larger the second clarity parameter), the better the image quality.
[0116] In practical applications, the terminal can perform Laplace transform on each pixel in the grayscale image to obtain the Laplace value of each pixel, and then calculate the Laplace variance of the grayscale image as a whole based on the Laplace value of each pixel, and finally set the Laplace variance as the first clarity parameter of the grayscale image. The Laplace variance is calculated as follows:
[0117]
[0118]
[0119] Where LV is the Laplace variance; M is the image length of the grayscale image; N is the image width of the grayscale image; i, j are pixel indexes; For grayscale images Grayscale value of the pixel at the coordinate; yes The Laplace transform function of a pixel point is used to calculate the Laplace value of the pixel point.
[0120] The terminal can also calculate the row frequency and column frequency of the grayscale image separately, and then calculate the spatial frequency of the grayscale image based on the row frequency and column frequency. The calculation method of the spatial frequency is as follows:
[0121]
[0122]
[0123]
[0124] Where RF is the row frequency, CF is the column frequency, and SF is the spatial frequency.
[0125] In this embodiment, by performing Laplace processing on the grayscale image to obtain a first clarity parameter of the grayscale image, and by performing spatial frequency processing on the grayscale image to obtain a second clarity parameter of the grayscale image, edges and details in the grayscale image can be identified, and then the first clarity parameter and the second clarity parameter are combined to comprehensively reflect the clarity analysis result of the grayscale image, effectively improving the comprehensiveness and accuracy of the clarity analysis of the grayscale image.
[0126] In one embodiment, the image quality condition includes a first parameter threshold and a second parameter threshold for image clarity. In the above step S102, if the image quality meets the preset image quality condition, image enhancement processing and denoising and reconstruction processing are performed on the image to be identified, and before obtaining the reconstructed image of the image to be identified, the following steps are further included: if the first clarity parameter reaches the first parameter threshold and the second clarity parameter reaches the second parameter threshold, then the image quality is confirmed to meet the image quality condition; if the first clarity parameter does not reach the first parameter threshold and / or the second clarity parameter does not reach the second parameter threshold, then the image quality is confirmed to not meet the image quality condition, and the image to be identified of the vehicle identification code is re-acquired.
[0127] Among them, different parameter thresholds can be set for the first clarity parameter and the second clarity parameter respectively, that is, the first parameter threshold and the second parameter threshold are different. Of course, the same parameter threshold can also be set for the first clarity parameter and the second clarity parameter, that is, the first parameter threshold and the second parameter threshold are the same.
[0128] Specifically, when it is detected that the first clarity parameter reaches the first parameter threshold and the second clarity parameter also reaches the second parameter threshold, the terminal confirms that the image quality of the image to be identified meets the image quality condition, that is, the image quality is qualified, and then the image to be identified can be used to continue to perform subsequent steps. When it is detected that at least one of the first clarity parameter and the second clarity parameter does not reach the corresponding parameter threshold, the terminal confirms that the image quality of the image to be identified does not meet the image quality condition, that is, the image quality is unqualified, and a prompt message can be generated to remind the terminal, and the terminal needs to re-acquire the image to be identified of the vehicle identification code, for example, the terminal can use the terminal to re-photograph the image to be identified of the vehicle identification code; then jump to the above-mentioned step S101 to determine the image quality of the newly acquired image to be identified.
[0129] In this embodiment, the image quality of the image to be identified is comprehensively analyzed by determining whether the first clarity parameter reaches the corresponding first parameter threshold, and determining whether the second clarity parameter reaches the corresponding second parameter threshold; when multiple clarity parameters all reach the corresponding parameter thresholds, it is confirmed that the image quality of the image to be identified is qualified, and the subsequent vehicle identification code recognition processing can continue; otherwise, the image to be identified is reacquired, which ensures the image quality of the image to be identified for recognition processing, and helps to improve the recognition accuracy of the vehicle identification code in the image to be identified.
[0130] In one embodiment, Figure 2 As shown, in the above step S102, if the image quality meets the preset image quality condition, image enhancement processing and denoising and reconstruction processing are performed on the image to be identified to obtain a reconstructed image of the image to be identified, which specifically includes the following contents:
[0131] Step S201 : performing image segmentation processing on the image to be recognized to obtain an identification code image of the vehicle identification code in the image to be recognized.
[0132] The identification code image refers to a local image of the area where the vehicle identification code is located.
[0133] Specifically, the terminal can use the contour detection algorithm to detect the position of the edge contour of the vehicle identification code in the image to be identified, and then segment the local image where the vehicle identification code is located from the image to be identified along the position of the edge contour. The terminal then obtains the identification code image containing the vehicle identification code in the image to be identified.
[0134] Step S202 : performing shape correction processing on the identification code image to obtain a corrected image of the identification code image.
[0135] In actual applications, since there may be certain deviations in the shooting angle, the captured vehicle identification code may be deformed to a certain extent. In order to improve the recognition accuracy of the vehicle identification code, the terminal may also need to perform shape correction on the identification code image to obtain a corrected image.
[0136] Step S203 , performing brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image.
[0137] Specifically, the metal material of the vehicle identification number has reflective characteristics, e.g. Figure 3Parts of the VIN shown in the image have reflections, which obscure the VIN structure and affect VIN recognition. To reduce the impact of reflections, the terminal can perform brightness normalization on the rectified image to improve the brightness of the pixels in the image, restore the VIN's true structure, and further improve image quality. The terminal can also first perform grayscale processing on the rectified image to obtain a grayscale image of the rectified image, and then perform brightness normalization on the grayscale image of the rectified image to reduce the impact of color on the image. For example, the terminal can perform brightness normalization on the rectified image using Retinex (an image enhancement technology based on visual perception that addresses changes in image illumination). Finally, the terminal processes the rectified image to obtain a brightness normalized image of the rectified image.
[0138] Step S204 , performing denoising and reconstruction processing on the brightness normalized image using an image denoising and reconstruction model to obtain a reconstructed image.
[0139] Among them, the image denoising and reconstruction model refers to an artificial intelligence model used to remove noise data in images.
[0140] It should be noted that the denoising effect of filtering technology is effective, and in the process of image segmentation processing of the image to be identified in the above step S201, the background noise of the image has been removed by mask segmentation technology. In this case, the role of filtering technology in this application is more limited. Therefore, this application uses an image denoising reconstruction model based on deep learning for denoising processing.
[0141] Specifically, the terminal inputs the brightness normalized image into the image denoising and reconstruction model, and uses the image denoising and reconstruction model to perform feature encoding processing on the brightness normalized image to obtain the features of the brightness normalized image; and also uses the image denoising and reconstruction model to decode and reconstruct the features to obtain a reconstructed image after noise removal.
[0142] In this embodiment, by performing image segmentation processing on the image to be identified, the identification code image of the vehicle identification code in the image to be identified can be extracted, and the background data is effectively removed, so that subsequent processing can be more accurate and efficient; by performing shape correction processing on the identification code image, the shape distortion of the vehicle identification code in the image can be eliminated, which helps to improve the recognition accuracy of the vehicle identification code; in order to solve the reflection problem of the vehicle identification code, it is very important to perform brightness normalization processing on the corrected image, which effectively eliminates the influence of lighting, so that the brightness normalized image can accurately restore the true structure of the vehicle identification code; finally, the image denoising reconstruction model is used to further remove the noise in the brightness normalized image, so that the data of the reconstructed image is clearer and cleaner, which greatly improves the recognition efficiency and recognition accuracy of the vehicle identification code.
[0143] In one embodiment, the above-mentioned step S203 performs brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image, which specifically includes the following contents: decomposing the corrected image into a reflection image and an illumination image; the reflection image is used to reflect the appearance information of the vehicle identification code; the illumination image is used to represent the change information of the ambient lighting of the vehicle identification code; based on the illumination image, performing illumination compensation processing on the reflection image to obtain a compensated reflection image; and performing image reconstruction processing on the compensated reflection image and the illumination image to obtain a brightness normalized image.
[0144] The reflected image reflects the inherent color and texture of the VIN surface, unaffected by changes in lighting. Specifically, it reflects the color and appearance that the VIN should have under ideal lighting conditions.
[0145] The illumination image reflects the impact of scene lighting conditions on the VIN. These lighting conditions include ambient light and direct light sources. The illumination image determines the brightness of each region in the image (such as the rectified image) but does not provide the color characteristics of the VIN.
[0146] Specifically, the terminal can decompose the rectified image into two independent components: a reflection component (reflection image) and an illumination component (illumination image). The reflection image reflects the true appearance of the VIN, while the illumination image reflects the actual ambient lighting changes in the scene where the VIN is located. The terminal uses the illumination image to perform multi-scale illumination compensation or multi-scale brightness normalization on the reflection image to remove the impact of different-scale illumination changes on the VIN and highlight the VIN's characteristic features in the reflection image. The terminal then obtains a compensated reflection image. The terminal then fuses the compensated reflection image with the illumination image to obtain a brightness-normalized image that removes the effects of illumination.
[0147] In practical applications, brightness normalization can be expressed by the following formula:
[0148]
[0149]
[0150] Where, is the brightness normalized image after removing the illumination Position pixel value (reflection component); k is the scale index; K is the total number of scales (multiple scales of illumination estimation are used here to better handle brightness changes at different scales and improve image enhancement effects); refers to the weight at scale k; In the image The original pixel value of the position; refers to the image at scale k The pixel value of the position lighting component; It refers to the standard deviation of Gaussian filtering at scale k.
[0151] In this embodiment, brightness normalization technology is used to remove lighting changes in the corrected image, effectively solving the reflection problem caused by the material of the vehicle identification code and restoring the true structure of the vehicle identification code, thereby improving the clarity of the vehicle identification code in the brightness normalized image and improving the image quality of the brightness normalized image.
[0152] In one embodiment, the above-mentioned step S204, through the image denoising and reconstruction model, performs denoising and reconstruction processing on the brightness normalized image to obtain a reconstructed image, specifically including the following contents: through the image denoising and reconstruction model, the brightness normalized image is subjected to image block processing to obtain block images of the brightness normalized image; through the encoder in the image denoising and reconstruction model, the block images are subjected to feature encoding processing to obtain embedded features of the block images; through the bottleneck layer in the image denoising and reconstruction model, deep feature extraction processing is performed on the block images to obtain deep features of the block images; through the decoder in the image denoising and reconstruction model, the embedded features and the deep features are subjected to decoding and reconstruction processing to obtain the reconstructed image.
[0153] The image denoising and reconstruction model can be based on the Swin Transformer-SGAN (Shifted Window Transformer-Stochastic Gradient Ascent Network, a layered visual transformer using a shifted window network). The Swin Transformer-SGAN is a model that combines the Swin Transformer with a semi-supervised generative adversarial network (SGAN). The Swin Transformer is a Transformer-based visual model. The image denoising and reconstruction model based on the Swin Transformer-SGAN includes the following structure: an encoder, a bottleneck layer, a decoder, and an SGAN discriminator.
[0154] Specifically, the terminal can construct an initial image denoising and reconstruction model based on the shifted window network. During the training phase of the image denoising and reconstruction model, the denoised image generated by the encoding layer of the initial image denoising and reconstruction model will be passed to the SGAN discriminator. The SGAN discriminator determines whether the denoised image is a real image by outputting a probability value of "realism". The initial image denoising and reconstruction model will adjust the generated denoised image according to the feedback of the discriminator, making it closer and closer to the real image, until the SGAN discriminator considers the generated denoised image to be "real enough", thereby preventing the denoised image from being distorted, improving the denoising quality of the trained image denoising and reconstruction model, and being able to effectively retain the detailed information of the vehicle identification code in the image to be identified.
[0155] During the inference phase of the image denoising and reconstruction model, the encoder in the model uses SwinTransformer (a new type of visual transformer) technology to replace the traditional convolutional neural network (CNN) to perform global feature extraction on the brightness-normalized image. Specifically, the encoder performs patch partitioning on the brightness-normalized image, dividing it into multiple small patches of fixed size. The terminal then obtains the patched images of the brightness-normalized image. It then uses linear embedding to convert the patched images into embedded vectors, i.e., embedded features. The bottleneck layer in the image denoising and reconstruction model uses a self-attention mechanism combined with a Transformer layer to extract deep features. Specifically, the bottleneck layer uses the Window-based Multi-head Self Attention (W-MSA) and Shifted Window Multi-head Self Attention (SW-MSA) of the Swin Transformer Block (windowed multi-head self-attention block) to extract features layer by layer from the image blocks, obtaining deep features for each block. The decoder in the image denoising and reconstruction model uses a method similar to deconvolution or upsampling to restore the features to the image structure of the brightness-normalized image. Specifically, the decoder performs a pooling process on the deep features and embedded features, merging them (patch merging) to generate merged features, reducing computational effort and improving the feature hierarchy. The merged features are then decoded through feature expansion (patch expanding) to reconstruct them to the image size of the brightness-normalized image. Finally, the output layer generates the denoised reconstructed image.
[0156] In this embodiment, an image denoising and reconstruction model obtained through training based on a shifted window network is used to perform denoising and reconstruction processing on the brightness normalized image. This model can adapt to a variety of image noises and ensure the quality of noise removal through the window offset characteristics and the semi-supervised generative adversarial network characteristics, thereby effectively improving the image quality of the denoised reconstructed image and providing high-quality data for subsequent vehicle identification code recognition.
[0157] In one embodiment, the above step S201, performing image segmentation processing on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified, specifically includes the following contents: performing contour extraction processing on the image to be identified to obtain contour information of the vehicle identification code in the image to be identified; based on the contour information, performing mask segmentation processing on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified.
[0158] The contour information is used to describe the edge contour outside the vehicle identification code. For example, the pixel position information of the circumscribed rectangle of the vehicle identification code can be used to represent the contour information of the vehicle identification code in the image to be identified.
[0159] Specifically, the terminal can use an edge detection algorithm (such as Canny) to detect the edge contour of the vehicle identification code in the image to be identified, and then use a contour extraction algorithm (such as the findContours function of the OpenCV library) to extract the contour information of the vehicle identification code in the image to be identified; wherein, the contour of the vehicle identification code in the image to be identified is usually a rectangle or a quadrilateral. The terminal can use a mask algorithm to perform a mask segmentation operation on the area where the vehicle identification code is located in the image to be identified according to the contour information. For example, the mask algorithm is used to create a binary mask for the image to be identified, separating the area where the vehicle identification code is located from the image background, and finally processing to obtain an identification code image of the vehicle identification code. Therefore, the identification code image can also exclude the background information of the image to be identified, thereby reducing the interference of background noise on the recognition process of the vehicle identification code and achieving high-quality image segmentation operations.
[0160] Among them, Canny is an edge detection algorithm.
[0161] Among them, OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library.
[0162] The findContours function in the OpenCV library is used to extract image contours. The findContours function can extract the boundary information of objects (such as vehicle identification numbers) from binary images.
[0163] In this embodiment, by performing contour extraction processing on the image to be identified, the contour information of the vehicle identification code in the image to be identified can be obtained, and the boundary contour of the vehicle identification code in the image can be accurately located, so that the image to be identified can be subjected to mask segmentation processing based on the contour information, thereby obtaining an identification code image of the vehicle identification code in the image to be identified. Not only is the image of the area where the vehicle identification code is located extracted, but the mask technology can also separate the vehicle identification code from the background, thereby improving the image quality of the obtained identification code image, and greatly improving the efficiency and accuracy of subsequent image processing and recognition processing.
[0164] In one embodiment, the above step S202 performs shape correction processing on the identification code image to obtain a corrected image of the identification code image, which specifically includes the following contents: based on the contour information, performing corner point detection processing on the identification code image to obtain corner point information of the area where the vehicle identification code is located in the identification code image; based on the corner point information, obtaining a perspective transformation matrix of the identification code image; based on the perspective transformation matrix, performing perspective transformation processing on the identification code image to obtain a corrected image of the identification code image.
[0165] Corner point information refers to the coordinates of corner points within an image. Corner points are where two edges intersect in an image. Corner points are typically locations where the grayscale value of an image changes rapidly. For example, if the outline of an identification code image is a rectangle, the corner points can be the four vertices of the rectangle.
[0166] Specifically, the terminal can use corner detection functions in the OpenCV library (such as approxPolyDP, a function used to identify object shapes that returns an array containing multiple vertices) to perform corner detection on the contour information. This process then determines the coordinate positions of the vertices in the identification code image, effectively obtaining the corner information of the identification code image. The terminal can then use this corner information (i.e., vertex coordinate positions) to calculate a perspective transformation matrix. This perspective transformation matrix is then used to perform a perspective transformation on the identification code image, resulting in a corrected image of the vehicle identification code that more closely resembles its true state.
[0167] In this embodiment, the corner point information in the identification code image is first detected based on the contour information. Then, the perspective transformation matrix of the identification code image is obtained using the corner point information. Finally, the perspective transformation processing is implemented on the identification code image based on the perspective transformation matrix, thereby eliminating the distortion of the vehicle identification code in the identification code image, thereby obtaining a corrected image with a more accurate and realistic vehicle identification code shape, providing a reliable processing basis for subsequent image processing steps.
[0168] In one embodiment, the above-mentioned step S103 determines the character area and coding area associated with the vehicle identification code in the reconstructed image, which specifically includes the following contents: performing contour detection processing on the reconstructed image to obtain candidate areas in the reconstructed image; screening out the area to be processed from the candidate areas based on the area information of the candidate areas; performing character extraction processing on the area to be processed through orthogonal moments to obtain character features of the area to be processed; and locating the character area and coding area associated with the vehicle identification code in the area to be processed based on the character features.
[0169] The region area information refers to information describing the area size of the candidate region.
[0170] Specifically, using contour detection algorithms such as the Sobel operator (combining Gaussian smoothing with first-order derivatives for efficient edge detection, extracting edge information by setting a threshold) or the Canny operator, the terminal detects areas in the reconstructed image that may contain characters or codes (such as barcodes or QR codes). The terminal then obtains candidate regions in the reconstructed image. The terminal calculates the area of each candidate region, obtains area information for each candidate region, and uses this area information to filter out the candidate regions to be processed. For example, candidate regions with area information less than a preset area threshold are eliminated, and candidate regions with area information greater than or equal to the preset area threshold are obtained and set as the regions to be processed. The characters of the processed area are extracted using Legendre orthogonal moments (Legendre polynomials) to obtain the first character features of the processed area. The characters of the processed area are extracted using Zernike orthogonal moments (Zernike polynomials) to obtain the second character features of the processed area. Zernike orthogonal moments are more robust to noise and are suitable for situations where the characters of the vehicle identification code are obscured by watermarks. Legendre orthogonal moments calculate the global shape of the processed area based on orthogonal Legendre polynomials, which can remove the influence of watermarks and make the character features of the vehicle identification code clearer. Legendre orthogonal moments and Zernike orthogonal moments can extract the contour information of the processed area through feature representations of different orders, thereby obtaining richer first and second character features.
[0171] The terminal classifies the area to be processed based on the characteristic morphological changes of the first character feature and the second character feature, and obtains a classification result of the area to be processed (i.e., a character area or a coding area). For example, the first character feature extracted by the Legendre orthogonal moment and the second character feature extracted by the Zernike orthogonal moment have different forms. For example, the characters of the vehicle identification code are regularly arranged, the first character feature is relatively stable at low-order moments, and changes more irregularly at high-order moments. The barcode of the vehicle identification code has a regular arrangement of stripe structures, the first character feature changes more dramatically and has a complex structure along the horizontal direction (x-axis), and the high-order moments show periodic changes in certain specific directions. The first character feature of the watermark area is more discretely distributed and has no obvious directionality.
[0172] The terminal may also utilize classification models such as a vector machine model and a random forest model to classify the area to be processed based on the first character feature and the second character feature to obtain a classification result of the area to be processed (ie, a character area or a coding area).
[0173] In this embodiment, the candidate area in the reconstructed image is first preliminarily located through contour detection processing, thereby realizing the preliminary area positioning of the characters or codes; then, based on the area information of the candidate area, the area of reasonable size is further screened out from the candidate area as the area to be processed, thereby realizing the second area positioning of the characters or codes and excluding obviously unreasonable areas; through multiple orthogonal moments, the character extraction processing is performed on the area to be processed to obtain multiple character features of the area to be processed, thereby improving the diversity of features and removing the influence of watermarks, laying the foundation for subsequent area classification; and then, based on the multiple character features, the area to be processed is classified, thereby effectively distinguishing between character areas and code areas.
[0174] In one embodiment, Figure 4 As shown, in the above step S104, the encoding area and / or the character area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code, which specifically includes the following contents:
[0175] Step S401 : performing recognition processing on the coding area for the vehicle identification code to obtain an initial recognition result of the coding area and a confidence level of the initial recognition result.
[0176] Among them, confidence is used to characterize the reliability of the initial recognition results.
[0177] Specifically, to improve recognition efficiency, the terminal can first perform vehicle identification code recognition on the coded area, obtain the recognition result of the coded area, and set it as the initial recognition result. The recognition method for the coded area is generally simpler and faster than the recognition method for the character area. However, to ensure the accuracy and reliability of the recognition result of the coded area, the confidence level of the recognition result of the coded area (i.e., the initial recognition result) can also be calculated.
[0178] Step S402: If the confidence level reaches a preset confidence level, the initial recognition result is set as the target recognition result.
[0179] The confidence condition refers to a judgment condition set for the confidence of the initial recognition result. For example, the confidence condition can be set to be no less than a preset confidence threshold.
[0180] Specifically, if the confidence level of the initial recognition result is not less than a preset confidence level threshold, the terminal may set the initial recognition result as the target recognition result of the vehicle identification code in the image to be recognized.
[0181] Step S403: If the confidence level does not meet the confidence level condition, the character area is subjected to a recognition process for the vehicle identification code to obtain a target recognition result.
[0182] Specifically, if the confidence of the initial recognition result is less than the preset confidence threshold, the terminal can also perform recognition processing on the character area for the vehicle identification code, obtain the recognition result of the character area, and set the recognition result of the character area as the target recognition result of the vehicle identification code in the image to be recognized.
[0183] In this embodiment, by performing VIN recognition processing on the coding region, an initial recognition result for the coding region can be quickly obtained, thereby improving VIN recognition efficiency. The confidence level of the initial recognition result is also used to determine whether the initial recognition result is accurate and reliable, thereby determining whether to set the initial recognition result as the target recognition result or the recognition result of the character region as the target recognition result, thereby improving VIN recognition accuracy.
[0184] In one embodiment, the above step S401 performs recognition processing on the coding area for the vehicle identification code to obtain an initial recognition result of the coding area and a confidence level of the initial recognition result, which specifically includes the following contents: determining the line ratio information of each coding line in the coding area; the line ratio information is used to characterize the ratio of the length to the width of the coding line; based on the line ratio information, each coding line and the coding character table are matched to obtain an initial recognition result; according to the matching information corresponding to the initial recognition result, the confidence level of the initial recognition result is obtained; the matching information includes at least one of the matching similarity between the coding line and the character in the coding character table and the check code of the character.
[0185] The coded character table refers to a data table that records the line ratio standards of multiple characters.
[0186] The matching information refers to information describing the matching degree of the initial recognition result.
[0187] Specifically, the terminal can calculate the ratio of each coded line in the coded area, such as calculating the ratio of the length to the width of the coded lines in the form of a barcode, and thus obtain the line ratio information of each coded line. The terminal can use decoding libraries such as ZBar (an open source barcode and QR code detection and decoding library), ZXing (an open source barcode library), and OpenCV to compare the line ratio information of the coded lines with the ratio information of each character in the coded character table, thereby obtaining target ratio information in the coded character table that matches the line ratio information. The initial recognition result is obtained based on the character corresponding to the target ratio information. During the matching process, the terminal can also calculate the overall confidence level of the initial recognition result based on the checksum of the characters in the coded character table, or the matching similarity between the coded lines and the characters in the coded character table.
[0188] In this embodiment, based on the line ratio information of each coded line in the coding area, characters matching the line ratio information are queried from the coding character table to obtain the initial recognition result of the coding area, thereby improving the recognition efficiency of the vehicle identification code. The confidence of the initial recognition result can also be calculated to evaluate the reliability of the initial recognition result through the confidence.
[0189] In one embodiment, the above step S403 performs recognition processing on the character area for the vehicle identification code to obtain a target recognition result, which specifically includes the following contents: performing character segmentation processing on the character area to obtain a sub-character area in the character area; performing character feature extraction processing on the sub-character area through a character recognition model to obtain a sub-character feature of the sub-character area; the character recognition model is obtained by performing model improvement processing on the initial recognition model through an attention mechanism; performing character recognition processing on the sub-character area based on the sub-character feature through the character recognition model to obtain a character recognition result of the sub-character area; and obtaining a target recognition result of the character area based on the character recognition result.
[0190] The sub-character area refers to the local image of the area where a single character is located.
[0191] Specifically, the terminal can build an initial recognition model based on MoblieNet (mobile network), then use the attention mechanism to improve the model structure of the initial recognition model to obtain an improved recognition model. By iteratively training the improved recognition model, a trained character recognition model is obtained. The network structure of the character recognition model includes MBConv (Mobile Inverted Bottleneck Convolution), Vision Transformer (Vision Transformer), and classifier. MBConv is used to enhance feature extraction capabilities and achieve local feature extraction. MBConv includes depthwise separable convolution, SE (Squeeze-and-Excitation) module, and PWConv (Pointwise Convolution) module. The Vision Transformer module is used for global feature extraction and includes Patch Embedding and Transformer Encoder. The classifier is used to identify and classify the extracted features.
[0192] Among them, the depthwise separable convolution is used to extract local features. The SE module is used to enhance channel attention. The PWConv module is used to change the number of channels to make the features suitable for the Vision Transformer module.
[0193] Patch Embedding is used to map the features output by MBConv to tokens (small block features), and Transformer Encoder is used to extract global features using Multi-Head Self Attention (MHSA).
[0194] The terminal can segment the character area through vertical projection. For example, by counting the black pixel values of each column of pixels in the character area, the vertical projection information is calculated. Based on the vertical projection information, the projection valley value of the character area is determined (the gaps between characters correspond to the valley value in the projection). The character area is then segmented based on the projection valley value to obtain sub-character areas for each character in the character area. Individual characters are recognized in the sub-character areas using a character recognition model. For example, the depthwise separable convolutional layer in the character recognition model is used as a feature extractor to extract character features from the sub-character areas to obtain sub-character features for each character. The visual transformer in the character recognition model can also be used as a feature extractor to extract character features from the sub-character areas to obtain sub-character features for each character. The classifier in the character recognition model (such as Softmax) is used to perform global average pooling and classification on the sub-character features to obtain classification results for the sub-character features, which are used as the character recognition results. The character recognition results of all sub-character areas are combined to obtain the target recognition result for the entire character area.
[0195] In this embodiment, the character area is divided into sub-character areas of a single character; the global features and local features of the sub-character area are extracted through the character recognition model to obtain sub-character features, which help to improve the accuracy of subsequent recognition; based on the sub-character features, the characters in the sub-character area are classified and recognized, thereby outputting the character recognition results of the sub-character area; all the character recognition results are combined to obtain the overall target recognition results of the character area, and the recognition and classification of single characters at a finer granularity is used to effectively improve the accuracy of the target recognition results.
[0196] In one embodiment, Figure 5 As shown, another method for identifying a vehicle identification code is provided, which is described by taking the method applied to a terminal as an example, and includes the following steps:
[0197] Step S501 : performing image grayscale processing on the image to be identified of the vehicle identification code to obtain a grayscale image of the image to be identified.
[0198] Step S502 , performing clarity analysis processing on the grayscale image to obtain a clarity analysis result of the grayscale image; and obtaining the image quality of the image to be identified based on the clarity analysis result.
[0199] In step S503 , if the image quality satisfies the preset image quality condition, image segmentation processing is performed on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified; shape correction processing is performed on the identification code image to obtain a corrected image of the identification code image.
[0200] Step S504 , performing brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image.
[0201] Step S505 , performing denoising and reconstruction processing on the brightness normalized image using an image denoising and reconstruction model to obtain a reconstructed image.
[0202] Step S506 , performing contour detection processing on the reconstructed image to obtain candidate regions in the reconstructed image; and screening out regions to be processed from the candidate regions based on the area information of the candidate regions.
[0203] Step S507 , performing character extraction processing on the area to be processed by orthogonal moments to obtain character features of the area to be processed.
[0204] Step S508 : Locate the character region and the coding region associated with the vehicle identification code in the area to be processed based on the character features.
[0205] Step S509 : performing recognition processing on the coding area for the vehicle identification code to obtain an initial recognition result of the coding area and a confidence level of the initial recognition result.
[0206] By judging whether the confidence level meets the preset confidence level condition, it is decided whether to execute step S510 or step S511:
[0207] Step S510: If the confidence level meets the confidence level condition, the initial recognition result is set as the target recognition result.
[0208] Step S511: If the confidence level does not meet the confidence level condition, the character area is processed for vehicle identification code recognition to obtain a target recognition result.
[0209] The above-mentioned vehicle identification code recognition method can achieve the following beneficial effects: by processing the image to be identified whose image quality meets the image quality conditions, it can realize the preliminary screening of the image, improve the quality of the image to be identified for subsequent processing, and help to improve the recognition accuracy of the vehicle identification code in the image to be identified; it also performs double image processing on the image to be identified through image enhancement and denoising reconstruction, further improving the performance of the vehicle identification code in the reconstructed image, and improving the recognition effect of the vehicle identification code in the character area and the coding area of the reconstructed image, thereby greatly improving the recognition accuracy of the target recognition result of the vehicle identification code in the image to be identified.
[0210] In order to more clearly illustrate the vehicle identification code recognition method provided by the embodiment of the present disclosure, the above vehicle identification code recognition method is specifically described below with a specific embodiment. Another vehicle identification code recognition method is provided, which can be applied to a terminal and specifically includes the following contents:
[0211] 1) Get the vehicle's VIN code image
[0212] The captured VIN code image is grayscaled, and then the clarity of the grayscale image is identified. For example, the clarity of the grayscale image can be determined by using Laplacian variance and image spatial frequency calculation methods.
[0213] 2) Image denoising and enhancement
[0214] Based on the clarity of the grayscale image, images with higher clarity are screened out from the VIN code images. Then, the screened VIN code images are segmented and shape corrected. The corrected images are preprocessed with brightness normalization. Finally, the normalized images are subjected to feature extraction and image denoising and reconstruction using the Swin Transformer-SGAN network.
[0215] 3) VIN code information positioning
[0216] The character area of the VIN code and the barcode area of the VIN code are located in the denoised and reconstructed VIN code image by using Legendre orthogonal moments and Zernike orthogonal moments.
[0217] 4) Barcode recognition
[0218] The barcode area of the VIN code is subjected to barcode recognition based on the bar width ratio of each line in the barcode area.
[0219] 5) Character VIN code recognition
[0220] If the confidence level of the barcode recognition result is lower than the preset confidence threshold, the characters in the character area of the VIN code are segmented to obtain the character image of a single character; the character image of a single character is recognized using the improved MoblieNet network based on the attention mechanism; the improved depthwise separable convolutional layer is used as a feature extractor to extract the features of a single character, and the extracted features are identified and classified using a softmax classifier to obtain the final target recognition result.
[0221] In this embodiment, the following beneficial effects can be achieved: 1) The quality of the image is determined by the Laplacian variance and image spatial frequency calculation methods, which can achieve preliminary screening of the image, improve the quality of the VIN image during recognition, and thus improve the recognition accuracy; 2) Image denoising is performed through the Swin Transformer-SGAN network, which can adapt to various image noises, and the SGAN network is used to determine the denoising quality, thereby improving the recognition accuracy; 3) The key information of the VIN code is located through the Legendre orthogonal moment and the Zernike orthogonal moment, which can effectively remove the influence of the watermark and distinguish between barcodes and characters, thereby improving the efficiency of subsequent information recognition; 4) The character recognition of the VIN code is realized by improving MoblieNet, which can effectively extract global features and local features, improve the recognition accuracy while making the computational complexity more balanced, suitable for edge devices, and improve the efficiency of character recognition.
[0222] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0223] Based on the same inventive concept, embodiments of the present application also provide a vehicle identification code recognition device for implementing the aforementioned vehicle identification code recognition method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more vehicle identification code recognition device embodiments provided below can be found in the limitations of the vehicle identification code recognition method described above and will not be further elaborated here.
[0224] In one embodiment, Figure 6 As shown, a vehicle identification code recognition device 600 is provided, comprising: a quality detection module 601, an image denoising module 602, a region positioning module 603 and an identification code recognition module 604, wherein:
[0225] The quality detection module 601 is used to determine the image quality of the image to be recognized; the image to be recognized includes the vehicle identification code to be recognized.
[0226] The image denoising module 602 is configured to perform image enhancement processing and denoising reconstruction processing on the image to be identified if the image quality meets a preset image quality condition, so as to obtain a reconstructed image of the image to be identified.
[0227] The region positioning module 603 is used to determine the character region and the code region associated with the vehicle identification code in the reconstructed image.
[0228] The identification code recognition module 604 is used to perform identification processing on the coding area and / or the character area for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
[0229] In one embodiment, the quality detection module 601 is further used to perform image grayscale processing on the image to be identified of the vehicle identification code to obtain a grayscale image of the image to be identified; perform clarity analysis processing on the grayscale image to obtain a clarity analysis result of the grayscale image; and obtain the image quality of the image to be identified based on the clarity analysis result.
[0230] In one embodiment, the vehicle identification code recognition device 600 also includes a clarity analysis module for performing Laplace processing on the grayscale image to obtain a first clarity parameter of the grayscale image; performing spatial frequency processing on the grayscale image to obtain a second clarity parameter of the grayscale image; and setting the first clarity parameter and the second clarity parameter as the clarity analysis result of the grayscale image.
[0231] In one embodiment, the image quality condition includes a first parameter threshold and a second parameter threshold for image clarity. The clarity judgment module is configured to, if the image quality meets the preset image quality condition, perform image enhancement processing and denoising and reconstruction processing on the image to be identified before obtaining a reconstructed image of the image to be identified. The module also includes: if the first clarity parameter reaches the first parameter threshold and the second clarity parameter reaches the second parameter threshold, confirming that the image quality meets the image quality condition; if the first clarity parameter does not reach the first parameter threshold and / or the second clarity parameter does not reach the second parameter threshold, confirming that the image quality does not meet the image quality condition and reacquiring the image to be identified of the vehicle identification code.
[0232] In one embodiment, the image denoising module 602 is further used to perform image segmentation processing on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified; perform shape correction processing on the identification code image to obtain a corrected image of the identification code image; perform brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image; and perform denoising and reconstruction processing on the brightness normalized image through an image denoising and reconstruction model to obtain a reconstructed image.
[0233] In one embodiment, the vehicle identification code recognition device 600 also includes a brightness processing module for decomposing the corrected image into a reflection image and an illumination image; the reflection image is used to reflect the appearance information of the vehicle identification code; the illumination image is used to represent the change information of the ambient lighting of the vehicle identification code; based on the illumination image, the reflection image is subjected to illumination compensation processing to obtain a compensated reflection image; the compensated reflection image and the illumination image are subjected to image reconstruction processing to obtain a brightness normalized image.
[0234] In one embodiment, the vehicle identification code recognition device 600 also includes a denoising and reconstruction module, which is used to perform image segmentation processing on the brightness normalized image through an image denoising and reconstruction model to obtain segmented images of the brightness normalized image; perform feature encoding processing on the segmented image through an encoder in the image denoising and reconstruction model to obtain embedded features of the segmented image; perform deep feature extraction processing on the segmented image through a bottleneck layer in the image denoising and reconstruction model to obtain deep features of the segmented image; and perform decoding and reconstruction processing on the embedded features and deep features through a decoder in the image denoising and reconstruction model to obtain a reconstructed image.
[0235] In one embodiment, the vehicle identification code recognition device 600 also includes an image segmentation module, which is used to perform contour extraction processing on the image to be identified to obtain contour information of the vehicle identification code in the image to be identified; based on the contour information, the image to be identified is subjected to mask segmentation processing to obtain an identification code image of the vehicle identification code in the image to be identified.
[0236] In one embodiment, the vehicle identification code recognition device 600 also includes an image correction module, which is used to perform corner detection processing on the identification code image based on contour information to obtain corner point information of the area where the vehicle identification code is located in the identification code image; obtain the perspective transformation matrix of the identification code image based on the corner point information; and perform perspective transformation processing on the identification code image based on the perspective transformation matrix to obtain a corrected image of the identification code image.
[0237] In one embodiment, the region positioning module 603 is also used to perform contour detection processing on the reconstructed image to obtain candidate regions in the reconstructed image; based on the area information of the candidate regions, the region to be processed is screened out from the candidate regions; through the orthogonal matrix, character extraction processing is performed on the region to be processed to obtain character features of the region to be processed; based on the character features, the character region and coding region associated with the vehicle identification code are located in the region to be processed.
[0238] In one embodiment, the identification code recognition module 604 is also used to perform identification processing on the coding area for the vehicle identification code to obtain the initial recognition result of the coding area and the confidence of the initial recognition result; if the confidence reaches a preset confidence condition, the initial recognition result is set as the target recognition result; if the confidence does not reach the confidence condition, the character area is subjected to identification processing for the vehicle identification code to obtain the target recognition result.
[0239] In one embodiment, the vehicle identification code recognition device 600 also includes a coding recognition module for determining the line ratio information of each coding line in the coding area; the line ratio information is used to characterize the ratio of the length to the width of the coding line; based on the line ratio information, each coding line and the coding character table are matched to obtain an initial recognition result; based on the matching information corresponding to the initial recognition result, the confidence level of the initial recognition result is obtained; the matching information includes at least one of the matching similarity between the coding line and the character in the coding character table and the check code of the character.
[0240] In one embodiment, the vehicle identification code recognition device 600 also includes a character recognition module, which is used to perform character segmentation processing on the character area to obtain sub-character areas in the character area; through the character recognition model, character feature extraction processing is performed on the sub-character area to obtain sub-character features of the sub-character area; the character recognition model is obtained by improving the initial recognition model through the attention mechanism; through the character recognition model, character recognition processing is performed on the sub-character area based on the sub-character features to obtain character recognition results of the sub-character area; based on the character recognition results, a target recognition result of the character area is obtained.
[0241] Each module in the aforementioned vehicle identification code recognition device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0242] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be achieved via Wi-Fi, mobile cellular networks, NFC (near-field communication), or other technologies. When executed by the processor, the computer program implements a method for identifying a vehicle identification code. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0243] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0244] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0245] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0246] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0247] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, such as images to be identified, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0248] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0249] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0250] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for identifying a vehicle identification code, characterized in that: The method comprises: Determining the image quality of an image to be identified; the image to be identified includes a vehicle identification code to be identified; If the image quality meets the preset image quality condition, performing image enhancement processing and denoising and reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified; Determining a character region and a coding region associated with the vehicle identification code in the reconstructed image; The encoding area and / or the character area are subjected to recognition processing for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
2. The method according to claim 1, characterized in that Determining the image quality of the image to be recognized includes: Performing image grayscale processing on the image to be identified of the vehicle identification code to obtain a grayscale image of the image to be identified; Performing clarity analysis processing on the grayscale image to obtain a clarity analysis result of the grayscale image; The image quality of the image to be recognized is obtained according to the clarity analysis result.
3. The method according to claim 2, characterized in that The performing clarity analysis processing on the grayscale image to obtain a clarity analysis result of the grayscale image includes: performing Laplace processing on the grayscale image to obtain a first clarity parameter of the grayscale image; performing spatial frequency processing on the grayscale image to obtain a second clarity parameter of the grayscale image; The first clarity parameter and the second clarity parameter are set as clarity analysis results of the grayscale image.
4. The method according to claim 1, wherein The performing image enhancement processing and denoising and reconstruction processing on the image to be identified to obtain a reconstructed image of the image to be identified includes: Performing image segmentation processing on the image to be identified to obtain an identification code image of the vehicle identification code in the image to be identified; performing shape correction processing on the identification code image to obtain a corrected image of the identification code image; Performing brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image; The image after brightness normalization is subjected to denoising and reconstruction processing by using an image denoising and reconstruction model to obtain the reconstructed image.
5. The method according to claim 4, characterized in that The performing brightness normalization processing on the corrected image to obtain a brightness normalized image of the corrected image includes: Decomposing the rectified image into a reflection image and an illumination image; the reflection image is used to reflect the appearance information of the vehicle identification code; the illumination image is used to represent the change information of the ambient light of the vehicle identification code; performing illumination compensation processing on the reflected image according to the illumination image to obtain a compensated reflected image; Image reconstruction processing is performed on the compensated reflected image and the illumination image to obtain the brightness normalized image.
6. The method according to claim 1, characterized in that The determining of the character region and the coding region associated with the vehicle identification code in the reconstructed image includes: Performing contour detection on the reconstructed image to obtain a candidate region in the reconstructed image; Filtering a region to be processed from the candidate region according to the region area information of the candidate region; Performing character extraction processing on the area to be processed by orthogonal moments to obtain character features of the area to be processed; The character region and the coding region associated with the vehicle identification code are located in the area to be processed according to the character features.
7. The method according to claim 1, characterized in that The performing recognition processing on the coding area and / or the character area for the vehicle identification code to obtain a target recognition result for the vehicle identification code includes: Performing recognition processing on the coding area for the vehicle identification code to obtain an initial recognition result of the coding area and a confidence level of the initial recognition result; If the confidence level reaches a preset confidence level, the initial recognition result is set as the target recognition result; If the confidence level does not meet the confidence level condition, the character area is subjected to recognition processing for the vehicle identification code to obtain the target recognition result.
8. A vehicle identification code recognition device, characterized in that: The device comprises: A quality detection module, configured to determine the image quality of an image to be identified, wherein the image to be identified includes a vehicle identification code to be identified; an image denoising module, configured to perform image enhancement processing and denoising reconstruction processing on the image to be identified if the image quality meets a preset image quality condition, to obtain a reconstructed image of the image to be identified; A region positioning module, configured to determine a character region and a coding region associated with the vehicle identification code in the reconstructed image; The identification code recognition module is used to perform identification processing on the coding area and / or the character area for the vehicle identification code to obtain a target recognition result for the vehicle identification code.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.