Vehicle identification code determination method and device and vehicle-mounted diagnostic apparatus

By acquiring the camera environment parameters and building a vehicle identification code recognition model, and processing multiple initial images, the problem of insufficient vehicle identification code recognition accuracy in insufficient light or complex backgrounds is solved, and efficient and accurate vehicle recognition is achieved.

CN120032375APending Publication Date: 2025-05-23LAUNCH TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510182982.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

Existing vehicle-mounted diagnostic instruments are difficult to accurately identify vehicle identification codes in the context of insufficient light or complex background, resulting in insufficient recognition accuracy and low diagnostic efficiency.

Method used

By obtaining camera environment parameters, using the camera to obtain multiple initial images, calculate horizontal and vertical grayscale change gradients, build a vehicle identification code recognition model, perform image processing and character recognition, and improve recognition accuracy.

Benefits of technology

It improves the identification accuracy and diagnostic efficiency of vehicle identification codes, and can accurately identify vehicle identification codes in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120032375A_ABST
    Figure CN120032375A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a vehicle identification code determination method and device and a vehicle-mounted diagnostic apparatus, the method is applied to the vehicle-mounted diagnostic apparatus, and the vehicle-mounted diagnostic apparatus comprises at least one camera; the method comprises the following steps: acquiring camera shooting environment parameters of a target area; the camera shooting environment parameters are used for reflecting the complexity or interference degree of the camera shooting environment in the target area; obtaining n initial images of the vehicle identification code through at least one camera according to the shooting environment parameters; n is a positive integer; determining a horizontal gray level change gradient and a vertical gray level change gradient of each initial image in the n initial images; processing the n initial images according to the n horizontal gray level change gradients and the n vertical gray level change gradients to obtain n reference images; constructing a vehicle identification code identification model; determining a character recognition result of each reference image in the n reference images according to a vehicle identification code recognition model; and determining a vehicle identification code according to the n character identification results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of vehicle technology, and in particular to a method and device for determining a vehicle identification code and an on-board diagnostic instrument. Background Art

[0002] When a vehicle breaks down, the first step in vehicle fault diagnosis is to obtain the vehicle identification number (VIN). The vehicle identification number is the only "identity card" for each vehicle. Through it, key information such as the vehicle's manufacturer, production year, model, configuration parameters, and maintenance history can be queried, providing an accurate basis for subsequent fault diagnosis and repair. At present, on-board diagnostic instruments usually use cameras to capture the vehicle's vehicle identification number, and identify and analyze it based on the captured image.

[0003] However, the accurate acquisition of the vehicle identification code faces the following challenges in practical applications: in scenes with insufficient lighting, such as rainy weather, at night, or in a garage environment, or when the exposure time is insufficient, the camera of the on-board diagnostic instrument may take blurry photos due to inaccurate focus, resulting in poor image quality, which directly affects the recognition effect of the vehicle identification code. In addition, even if a clear image is captured, the existing vehicle identification code recognition algorithm still has the problem of insufficient accuracy, especially when faced with complex background interference or contaminated vehicle identification codes, it is easy to cause problems such as misrecognition or missed recognition, reducing the diagnostic efficiency.

[0004] Therefore, there is an urgent need for a method for determining a vehicle identification code to improve the recognition accuracy of the vehicle identification code by the on-board diagnostic instrument and improve the diagnosis efficiency. Summary of the invention

[0005] In order to solve the above problems, the embodiments of the present invention provide a method, device and on-board diagnostic instrument for determining a vehicle identification code, which can improve the diagnosis efficiency by improving the recognition accuracy when the on-board diagnostic instrument recognizes the vehicle identification code.

[0006] In a first aspect, an embodiment of the present invention provides a method for determining a vehicle identification code, which is applied to an on-board diagnostic instrument, wherein the on-board diagnostic instrument includes at least one camera; the method includes:

[0007] Acquire the camera environment parameters of the target area; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference level of the camera environment in the target area;

[0008] Acquire n initial images of the vehicle identification code through the at least one camera according to the camera environment parameters; n is a positive integer;

[0009] Determine the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients;

[0010] Processing the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images;

[0011] Construct a vehicle identification code recognition model;

[0012] Determine a character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results;

[0013] The vehicle identification code is determined according to the n character recognition results.

[0014] In a second aspect, an embodiment of the present invention provides a vehicle identification code determination device, which is applied to an on-board diagnostic instrument, wherein the on-board diagnostic instrument includes at least one camera; the device includes an acquisition unit and a processing unit:

[0015] The acquisition unit is used to acquire the camera environment parameters of the target area; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference level of the camera environment in the target area;

[0016] The processing unit is used to obtain n initial images of the vehicle identification code through the at least one camera according to the camera environment parameters; n is a positive integer;

[0017] Determine the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients;

[0018] Processing the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images;

[0019] Construct a vehicle identification code recognition model;

[0020] Determine a character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results;

[0021] The vehicle identification code is determined according to the n character recognition results.

[0022] In a third aspect, an embodiment of the present invention provides an on-board diagnostic instrument, which includes a processor and a memory, wherein the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory so that the on-board diagnostic instrument performs the method described in the first aspect.

[0023] Implementing the embodiments of the present application has the following beneficial effects:

[0024] In an implementation manner of the present application, the camera environment parameters of the target area are first obtained; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference degree of the camera environment in the target area; n initial images of the vehicle identification code are obtained through at least one camera according to the camera environment parameters; n is a positive integer; the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images are determined to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients; the n initial images are processed according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images; a vehicle identification code recognition model is constructed; the character recognition result of each of the n reference images is determined according to the vehicle identification code recognition model to obtain n character recognition results; the vehicle identification code is determined according to the n character recognition results. Therefore, n initial images of the vehicle identification code are obtained through the camera environment parameters, and the n initial images are processed to obtain n reference images. The n reference images are recognized by the vehicle identification code recognition model to obtain n character recognition results. Finally, the vehicle identification code is determined by the n character recognition results. This can improve the recognition accuracy of the vehicle identification code to improve the diagnosis efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 It is a schematic diagram of the architecture of a vehicle identification code determination system provided in an embodiment of the present application;

[0027] Figure 2 is a flow chart of a method for determining a vehicle identification code provided in an embodiment of the present application;

[0028] Figure 3 This is an application scenario diagram of determining a vehicle identification code based on a motor vehicle driving license provided in an embodiment of the present application;

[0029] Figure 4 This is an application scenario diagram of determining a vehicle identification code based on a vehicle front window provided by an embodiment of the present application;

[0030] Figure 5 This is a schematic diagram of the position relationship between a vehicle identification code and a camera provided in an embodiment of the present application;

[0031] Figure 6 is a flow chart of an embodiment of a method for determining a vehicle identification code provided in an embodiment of the present application;

[0032] Figure 7 It is a structural schematic diagram of a vehicle identification code determination device provided in an embodiment of the present application;

[0033] Figure 8 It is a structural schematic diagram of an on-board diagnostic instrument provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0035] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other steps or modules inherent to these processes, methods, products or devices.

[0036] Reference to "embodiments" herein means that a particular feature, result, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0037] The vehicle identification code determination method provided in the embodiment of the present application is applied to an on-board diagnostic instrument, which includes at least one camera. Figure 1 , Figure 1is a schematic diagram of the architecture of a vehicle identification code determination system provided in an embodiment of the present application, such as Figure 1 As shown, the vehicle identification code determination system is provided with an on-board diagnostic instrument, the on-board diagnostic instrument is provided with a camera, and the on-board diagnostic instrument also includes a controller, the controller is used to control the camera to acquire images, and control instructions are exchanged between the controller and the camera to control the camera to acquire image data of the vehicle identification code. Thus, the vehicle identification code determination system can determine the vehicle identification code through the controller and camera of the on-board diagnostic instrument.

[0038] See also Figure 2 , Figure 2 is a flow chart of a method for determining a vehicle identification code provided in an embodiment of the present application, such as Figure 2 As shown, the vehicle identification code determination method provided in the embodiment of the present application includes but is not limited to the following steps:

[0039] Step S101: Acquire the camera environment parameters of the target area;

[0040] The target area is the area where the vehicle identification code is located; the camera environment parameter is used to reflect the complexity or interference level of the camera environment in the target area;

[0041] Step S102: acquiring n initial images of the vehicle identification code through at least one camera according to the camera environment parameters;

[0042] Wherein, n is a positive integer;

[0043] Step S103: determining the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images, and obtaining n horizontal grayscale change gradients and n vertical grayscale change gradients;

[0044] Step S104: Processing the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images;

[0045] Step S105: constructing a vehicle identification code recognition model;

[0046] Step S106: determining a character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results;

[0047] Step S107: Determine the vehicle identification code according to the n character recognition results.

[0048] In a possible embodiment, camera environment parameters of a target area are obtained, where the target area is the area where the vehicle identification code is located, and the camera environment parameters are used to reflect the complexity or interference level of the camera environment in the target area. When obtaining the camera environment parameters, one or more of the methods such as light intensity measurement, ambient light color analysis, reflection characteristic evaluation, interference source evaluation, and background complexity evaluation can be adopted. Exemplarily, for reflection characteristic evaluation, it can be determined whether the surface material of the area where the vehicle identification code is located is smooth or rough to determine whether it has high reflectivity, and the reflectivity of this area can also be measured by a reflectometer to quantify the degree of reflection.

[0049] In a possible embodiment, n initial images of the vehicle identification code are obtained through at least one camera according to the camera environment parameters, where n is a positive integer. If the camera environment parameters are good, then there may not be a low-light scene or a reflective scene currently, so only one camera can be determined and the vehicle identification code can be photographed from the front, and the number of initial images can be 1. If the camera environment parameters indicate that the current situation may be a low-light scene or a reflective scene, first, a target camera is selected from at least one camera according to the camera environment parameters. If it is a low-light environment, a camera with high sensitivity and a large aperture is selected as the target camera. For a highly reflective area, a camera with a high dynamic range function is selected as the target camera. And the parameters such as the exposure time, aperture size, and focal length of the camera are adjusted to adapt to different lighting and distance requirements. Then, according to the structure of the target area and possible interference sources, the vehicle identification code is photographed from different angles to ensure that at least n initial images with different perspectives are obtained. For some positions that are difficult to directly photograph, an endoscope camera or a flexible probe camera can be used to take multiple photographs at different time points to cope with possible light changes or motion interferences in the environment. Multiple cameras are used to simultaneously photograph from different positions to obtain more comprehensive information. In the embodiments of the present application, obtaining images from multiple angles and time points can increase the probability of obtaining high-quality images and reduce the risk that a single image cannot be recognized due to light changes, reflections, occlusions, or other interferences. Images with different perspectives can provide more information about the vehicle identification code, which is beneficial to subsequent processing and analysis and improves the recognition success rate.

[0050] In a possible embodiment, the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images are determined to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients. Before performing gradient calculation, the color initial image is converted into a grayscale image to reduce the influence of noise on the gradient calculation. For example, the Gaussian kernel size is determined according to the image noise level by Gaussian filtering. The Gaussian kernel size includes but is not limited to 3*3, 5*5, etc. For each initial image, a gradient operator is used to perform gradient calculation to determine the horizontal gradient convolution kernel and the vertical gradient convolution kernel. The gradient operator performs a convolution operation with the image through the convolution kernel to calculate the gradient in the horizontal and vertical directions. Among them, the gradient operator can be a Sobel operator, a Prewitt operator or a Scharr operator. The above convolution kernel is slid on the image, and the horizontal edge information and the vertical edge information in the image are highlighted by weighted summing of the pixel grayscale values ​​at different positions in the image. The horizontal and vertical gradients of each pixel position are calculated to obtain the horizontal and vertical grayscale change gradient matrices with the same number as the initial images. In the embodiment of the present application, the gradient information reflects the edge and texture information of the image. By calculating the horizontal and vertical grayscale change gradients, the edge contours of the vehicle identification code characters can be effectively detected, which is very important for the segmentation and subsequent recognition of the characters. Under different lighting and background conditions, the gradient information is relatively stable, which helps to enhance the feature representation of the image and provide a reliable basis for subsequent processing.

[0051] In a possible embodiment, determining the horizontal grayscale transformation gradient and the vertical grayscale transformation gradient of the image can detect features such as edges and textures in the image. When calculating the horizontal grayscale transformation gradient and the vertical grayscale transformation gradient, the calculation can also be performed based on the discrete difference method. For example, through the first-order forward difference and the first-order backward difference, for the first-order forward difference, in the horizontal direction, the difference between the grayscale value of the current pixel and the grayscale value of the adjacent pixel on its right is the horizontal grayscale transformation gradient of the point, and in the vertical direction, the difference between the grayscale value of the current pixel and the grayscale value of the adjacent pixel below it is the vertical grayscale transformation gradient of the point. For the first-order backward difference, in the horizontal direction, the difference between the grayscale value of the current pixel and the grayscale value of the adjacent pixel on its left is used as the horizontal gradient, and in the vertical direction, the difference between the grayscale value of the current pixel and the grayscale value of the adjacent pixel above it is used as the vertical gradient.

[0052] In a possible embodiment, n initial images are processed according to n horizontal grayscale change gradients and n vertical grayscale change gradients to obtain n reference images. First, the initial images are subjected to gradient enhancement processing according to the calculated gradient information. For example, the following formula is used: e =I o +k*G, where I e is the enhanced image, Io is the initial image, G is the gradient information, k is the weighting coefficient, the gradient information is weightedly added to the original image, the edge and texture of the image are enhanced, and the character outline of the vehicle identification code is highlighted. Then, the gradient image is thresholded, the pixels with gradient values ​​below a certain threshold are set to black, and the pixels above the threshold are set to white, the characters and the background are separated, and the outline of the vehicle identification code characters can be extracted according to different gradient distributions by adjusting the threshold. Next, the processed image is denoised to remove the noise or unnecessary details introduced during the gradient processing. Median filtering and morphological operations, such as opening and closing operations, can be used to remove small noise spots and fill the holes in the characters. For multiple reference images, they are aligned by image registration technology to ensure that the information in different images can be fused during subsequent analysis. For example, a registration method based on feature points is used to first find the significant feature points in the image, and then the image is aligned to the same coordinate system according to the matching relationship of the feature points. In the embodiment of the present application, processing the initial image using gradient information can enhance the characteristics of the characters in the image, make the distinction between the characters and the background more obvious, and improve the recognizability of the image. Gradient threshold processing helps convert images into binary images, simplifying the subsequent character segmentation and recognition steps. Image registration, when using multiple images, can make full use of multi-source information and reduce errors caused by shooting angles or slight vehicle movements.

[0053] In a possible embodiment, a vehicle identification code recognition model is constructed. First, according to the characteristics of the vehicle identification code and the characteristics of the image processed in the early stage, a suitable deep learning architecture is selected, such as a convolutional neural network or a Transformer-based network. Then, a large number of images with vehicle identification codes and their annotations are collected as training sets and verification sets. These images include vehicle identification codes of different models, different environments, different shooting angles and different lighting conditions to ensure the generalization ability of the model. The selected network architecture is trained using the training set. During the training process, the parameters of the model are adjusted using an optimization algorithm, and appropriate hyperparameters such as learning rate, batch size, and training rounds are set. The overfitting of the model is monitored using the verification set, and the hyperparameters are adjusted according to the verification results. The trained model is evaluated using the test set to calculate indicators such as accuracy and recall. According to the evaluation results, the model is optimized, such as adjusting the network structure, adding data enhancement operations such as rotation, translation, scaling, flipping images, etc., or using regularization methods to prevent overfitting. In the embodiment of the present application, constructing a recognition model specifically for vehicle identification codes can improve the accuracy and reliability of recognition. Through large-scale data training and optimization, the model can adapt to various complex vehicle identification code images, improve the recognition performance in different environments and conditions, and avoid the performance deficiencies that may be caused by using general image recognition models.

[0054] In a possible embodiment, the character recognition result of each reference image in n reference images is determined according to the vehicle identification code recognition model to obtain n character recognition results. The n reference images are adjusted to the input format required by the model, such as uniform size and normalized pixel value. For reference images of different sizes, an interpolation algorithm is used to adjust them to the standard size during model training. The preprocessed reference images are sequentially input into the trained vehicle identification code recognition model, and the character category probability distribution of each image is calculated by forward propagation. For the convolutional neural network model, the final character category probability is obtained by calculation of multiple convolutional layers, pooling layers and fully connected layers. For each reference image, the character category with the highest probability is selected as the character recognition result of the image. For the recognition task of the vehicle identification code with a fixed length and character set, the predicted characters can be combined in sequence to form a complete vehicle identification code prediction result. In the embodiment of the present application, the trained model is used for recognition, which can realize automatic and intelligent character recognition and improve recognition efficiency and accuracy. Through the powerful feature extraction and classification capabilities of the model, vehicle identification code characters in different fonts, different deformations and different environments can be accurately identified, reducing the error rate of manual recognition.

[0055] In a possible embodiment, the vehicle identification code is determined based on n character recognition results. Multiple character recognition results are obtained from multiple reference images. For character positions that are consistent in most images, the character recognition results at this position are considered reliable. For a few inconsistent positions, weighted averaging or other fusion methods can be used according to the confidence of different results to determine the final character. The vehicle identification code's coding rules are used to check whether the recognition results meet the standards. The vehicle identification code has specific coding rules. For example, the 9th bit is a check bit. The correctness of the recognition result can be verified by a specific check algorithm. If it does not meet the rules, the recognition result is rechecked or the image is reprocessed for recognition. In the embodiment of the present application, the information of multiple reference images can be comprehensively utilized through result fusion to improve the reliability of the final recognition result. Using coding rules for consistency checks can ensure the correctness of the recognition results and avoid erroneous recognition results.

[0056] See also Figure 3 , Figure 3 This is an application scenario diagram of determining a vehicle identification code based on a motor vehicle driving license provided in an embodiment of the present application, such as Figure 3 As shown, when it is necessary to obtain the vehicle identification code of the target vehicle based on the motor vehicle driving license, for the motor vehicle driving license, by identifying the target identification area, it can be determined that the vehicle identification code is: LSVFF66R8CZ116280.

[0057] See also Figure 4 , Figure 4This is an application scenario diagram of determining a vehicle identification code based on a vehicle front window provided by an embodiment of the present application, such as Figure 4 As shown, when it is necessary to obtain the vehicle identification code of a vehicle through the front window of the vehicle, for the vehicle, the diagnostic instrument can be set at a position corresponding to the target area where the vehicle identification code of the vehicle is located, and obtain the vehicle identification code in the target area through the target camera range.

[0058] Optionally, the camera environment parameters include illumination condition parameters and background condition parameters; step S102, acquiring n initial images of the vehicle identification code through at least one camera according to the camera environment parameters, may include the following steps:

[0059] Step S201: determining a first interference score according to a lighting condition parameter;

[0060] Step S202: determining a second interference score according to background condition parameters;

[0061] Step S203: determining the number of image acquisitions according to the first interference score and the second interference score;

[0062] Step S204: acquiring the spatial position coordinates of the vehicle identification code through at least one camera;

[0063] Step S205: determining the image acquisition parameters of each camera in at least one camera according to the number of image acquisitions, the illumination condition parameters, the background condition parameters and the spatial position coordinates, and obtaining n image acquisition parameters; the image acquisition parameters include at least one of the following: resolution, contrast, saturation, focal length, shooting angle, number of shots, brightness and exposure time;

[0064] Step S206: acquiring n initial images through at least one camera according to the image acquisition quantity and n image acquisition parameters.

[0065] In a possible embodiment, the first interference score is determined according to the illumination condition parameter, and the first interference score is determined according to the actual illumination intensity, the ideal illumination intensity, the illumination intensity standard deviation, the actual color temperature and the standard color temperature. The first interference score is higher when the illumination intensity is too high or too low, the illumination uniformity is poor, and the illumination color is greatly different from the standard. The second interference score is determined according to the background condition parameter, and the color contrast between the background and the vehicle identification code characters is calculated. The contrast can be measured by analyzing the color histogram of the identification code area and the background area in the image and calculating the difference between the two. Then, the second interference score is determined according to the background color type, the background and the identification code contrast, the background dynamic change frequency and the background dynamic change amplitude. The second interference score is higher when the background complexity is high, the contrast with the identification code is low, and there is a dynamic change. The number of image acquisitions is determined according to the first interference score and the second interference score, and the relationship between the first interference score, the second interference score and the number of image acquisitions is established. For example, when both interference scores are low, the number of image acquisitions can be relatively small, and when one of the interference scores is high, the number of image acquisitions needs to be increased to increase the probability of obtaining a clear and usable image.

[0066] In a possible embodiment, the spatial position coordinates of the vehicle identification code are obtained by at least one camera. When multiple cameras are used, the spatial position coordinates of the vehicle identification code can be accurately determined by the principle of triangulation. That is, the exact coordinates of the vehicle identification code in three-dimensional space are calculated by combining the position and angle information of the camera with the position of the vehicle identification code in the images taken by different cameras. Obtaining the spatial position coordinates of the vehicle identification code helps to adjust the camera's shooting parameters more accurately in the future, ensure that the camera can accurately capture the vehicle identification code, and improve the quality and efficiency of image acquisition. At the same time, the spatial position coordinate information can also be used for image stitching and fusion, providing more comprehensive information for subsequent image processing and recognition.

[0067] In a possible embodiment, the image acquisition parameters of each camera in at least one camera are determined according to the number of image acquisitions, the illumination condition parameters, the background condition parameters and the spatial position coordinates, and n image acquisition parameters are obtained, wherein the image acquisition parameters include at least one of the following: resolution, contrast, saturation, focal length, shooting angle, number of shots, brightness and exposure time. If the illumination condition is good and the background is relatively simple, a higher resolution can be selected to obtain clearer image details, which is helpful for identification. If the interference is large, the resolution can be appropriately reduced to reduce the amount of data, improve the acquisition speed and processing efficiency. According to the contrast between the background and the identification code, if the contrast is low, the difference between the two can be enhanced by adjusting the contrast parameters of the camera to make the identification code clearer. In the case of a pure color background but low contrast, the contrast can be increased. According to the illumination color and the background color, the saturation is adjusted to highlight the identification code. For example, in a warm light environment, the saturation is reduced to avoid the color being too strong to affect the identification, and in a cold light environment, the saturation is increased. According to the spatial position coordinates of the vehicle identification code, the focal length of the camera is adjusted to ensure that the vehicle identification code is clearly imaged in the image. By calculating the distance between the vehicle identification code and the camera, the appropriate focal length is determined by the lens focal length calculation formula. According to the spatial position coordinates and the position of the vehicle identification code, select the best shooting angle to avoid reflection, occlusion and other problems. Combined with the number of images collected, determine the number of shots for each camera. According to the light intensity and uniformity, adjust the brightness and exposure time of the camera. When the light intensity is low, appropriately increase the exposure time and brightness. When the light intensity is high, reduce the exposure time and brightness to avoid overexposure.

[0068] In the embodiment of the present application, the number of images collected is dynamically adjusted according to the degree of interference, which not only avoids the waste of resources caused by collecting too many images when the interference is small, but also ensures that enough images can be obtained to improve the recognition success rate when the interference is large. In this way, the collection efficiency and resource utilization can be improved while ensuring the recognition effect. According to the specific environmental parameters and spatial position coordinates, the image acquisition parameters of each camera are adjusted in a targeted manner, which can optimize the image quality to the greatest extent, reduce the impact of light and background interference on the image, and improve the recognizability of the vehicle identification code.

[0069] See also Figure 5 , Figure 5 : is a schematic diagram of the position relationship between a vehicle identification code and a camera provided in an embodiment of the present application, such as Figure 5As shown, for a vehicle identification code in a reflective or dark light scene, three camera positions can be determined to capture the image of the vehicle identification code. The three camera positions are the first camera position, the second camera position and the third camera position. The three camera positions correspond to the first camera range, the second camera range and the third camera range, respectively. If there are three cameras that meet the camera conditions in at least one camera of the on-board diagnostic instrument, then the three cameras can be controlled to be located at the three camera positions respectively and to capture the initial image at the same time. If there are not three cameras that meet the camera conditions, the target camera can be controlled to be located at one of the three camera positions in turn, and image capture is performed in turn through the corresponding camera ranges in the three camera ranges.

[0070] Optionally, step S104, processing the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images, may include the following steps:

[0071] Step S301: determining the number of pixels at each gray level of each of the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients, and obtaining n grayscale histograms;

[0072] Step S302: determining the maximum grayscale level and the minimum grayscale level of each of the n initial images according to the n grayscale histograms, and obtaining n maximum grayscale levels and n minimum grayscale levels;

[0073] Step S303: determining n original grayscale intervals according to the n maximum grayscale levels and the n minimum grayscale levels;

[0074] Step S304: mapping the grayscale value of each pixel in the n original grayscale intervals to a preset grayscale range according to a preset grayscale mapping function, to obtain a target grayscale value of each pixel in each of the n initial images;

[0075] Step S305: determining the rotation angle and deformation parameter of each of the n initial images, and obtaining n rotation angles and n deformation parameters;

[0076] Step S306: determining n adjustment parameters according to the n rotation angles and the n deformation parameters;

[0077] Step S307: Process the n initial images according to the target grayscale value of each pixel of each initial image and the n adjustment parameters to obtain n reference images.

[0078] In a possible embodiment, first, the number of pixels at each gray level in the image is counted to obtain the original gray histogram. This can be done by traversing each pixel of the image, using its gray value as an index, and adding one to the pixel count of the corresponding gray level. Then, the minimum and maximum gray levels of the pixel gray values ​​in the original image are found to determine the range in which the current pixel value is concentrated. A mapping function is designed to map the original gray interval to the entire gray range. A common method is to use linear transformation, but nonlinear transformations such as logarithmic transformation, power transformation, etc. can also be used, and a suitable mapping function is selected according to specific needs. Then the gray value of each pixel in the original image is transformed by the mapping function to obtain a new gray value and generate a new image. The main purpose of this process is to enhance the contrast of the image, make the originally darker or brighter areas in the image clearer, and distribute the pixel values ​​originally concentrated in a certain gray range more evenly throughout the gray range, thereby improving the overall quality of the image, especially when the image contrast is low. For example, for a vehicle identification code image taken in dim light, the pixels may be concentrated in a darker grayscale range due to insufficient light. Through histogram equalization, the contrast between the characters and the background can be enhanced, making them easier to identify.

[0079] Optionally, step S105, constructing a vehicle identification code recognition model, may include the following steps:

[0080] Step S401: acquiring k training images through at least one camera according to k preset training conditions; k is an integer greater than 1; the different parts of any two preset training conditions among the k preset training conditions include at least one of the following: preset lighting conditions, preset shooting angles, and preset vehicle types;

[0081] Step S402: obtaining k vehicle identification code labels corresponding to k training images; the k vehicle identification code labels are used to reflect the actual vehicle identification code corresponding to each of the k training images;

[0082] Step S403: determining the network structure parameters of the vehicle identification code recognition model according to the k training images and the k vehicle identification code labels; the network structure parameters include: learning rate, initial model, number of model layers, and number of neurons in each layer;

[0083] Step S404: constructing a vehicle identification code recognition model according to the network structure parameters.

[0084] In a possible embodiment, the network structure parameters are determined according to the complexity of the characters and the adhesion and deformation of the characters. For example, the vehicle identification code is composed of numbers and letters, and the structures and complexities of different characters are different. For example, the letter "O" and the number "0" are similar in shape, which increases the difficulty of recognition. For such tasks with high character complexity, a network structure with strong feature extraction capabilities can be selected, such as a deep network architecture in a convolutional neural network. These networks can gradually extract different levels of features of characters through multi-layer convolution operations, from low-level edge and line features to high-level character shape and structural features. In the actual captured vehicle identification code image, the characters may be adhered, overlapped or deformed. For example, due to factors such as shooting angle, lighting conditions or uneven vehicle surface, the characters may be distorted, stretched or partially blocked in the image. For such tasks with character adhesion and deformation, a network structure with special structure or processing capabilities can be selected, for example, an architecture based on a full convolutional network can generate a segmentation mask of the characters by classifying and predicting the image pixel by pixel, thereby realizing the segmentation and recognition of adhered characters. In addition, some special layers or operations can be added to the network structure, such as a spatial transformer network, which can perform spatial transformation on the input image to correct the deformation of characters.

[0085] In a possible embodiment, the learning rate in the network structure parameters is used to control the update step size of the model parameters. The learning rate can be adjusted according to the specific situation. A larger learning rate can be selected at the beginning to speed up the convergence of the model so that it can quickly adapt to the specific task requirements of vehicle identification code recognition. When the loss function of the model begins to converge, the learning rate can be gradually reduced to avoid oscillation or overfitting during the model convergence process. At the same time, it can also make the model more stable during the convergence process, thereby improving the performance of the model.

[0086] In a possible embodiment, the initial model in the network structure parameters can adopt a convolutional neural network or a Transformer-based architecture, wherein, in the vehicle identification code recognition, the convolutional neural network automatically extracts features and abstractly represents the image data through structures such as convolutional layers, pooling layers, and fully connected layers. The convolutional layer slides on the image through the convolution kernel to automatically learn and extract features at different levels. When processing the vehicle identification code image, the initial convolutional layer can extract basic low-level features, such as the edges, lines, corners, etc. of the characters. As the network deepens, the subsequent convolutional layers can further extract more complex features, such as the shape, structure, and texture of the characters. The pooling layer plays a role of downsampling in the convolutional neural network. By reducing the spatial dimension of the data, the amount of calculation and the number of parameters are reduced, while enhancing the robustness and invariance of the features, which helps to improve the model's tolerance to image size changes, rotations, and slight deformations, allowing the model to better adapt to vehicle identification code images of different shooting angles and distances. The fully connected layer finally maps the extracted high-level features to output categories, such as different numbers and letters, and achieves classification and recognition of vehicle identification code characters by learning the relationship between features and categories. Among them, the self-attention mechanism in the Transformer architecture allows the model to focus on the dependencies between different positions in the sequence when processing sequence data, without being restricted by distance. In vehicle identification code recognition, the character sequence of the vehicle identification code can be regarded as an ordered data, and the Transformer can capture the sequential relationship between characters. The self-attention mechanism calculates the correlation weight between each character and other characters, so that the model can better understand the combination information of the vehicle identification code characters, and helps to identify the contextual information in the character sequence. This is very helpful for processing sequence data with fixed length and strict order such as vehicle identification codes, especially when dealing with partial occlusion of characters, deformation of characters or blurring. By paying attention to information at different positions, the complete vehicle identification code can be more accurately identified.

[0087] During the model training process, hyperparameters can be automatically adjusted and optimized. The learning rate is one of the important hyperparameters, which determines the step size of the model each time the parameters are updated. Through multiple iterations and verifications, the deep learning model automatically finds a suitable learning rate to achieve rapid convergence and high performance of the model. In addition, hyperparameters such as the number of layers and the number of neurons in each layer of the model are adjusted and optimized according to actual conditions. Various optimization algorithms such as stochastic gradient descent are used to automatically find the optimal network structure and hyperparameter combination, so that the model can better adapt to the feature extraction and classification tasks of vehicle identification code images.

[0088] In a possible embodiment, when the initial model is a convolutional neural network, the number of convolutional layers is determined according to data characteristics and task complexity, wherein the data characteristics include data volume, image resolution and size, image noise and blur, and the task complexity includes the number and type of characters, as well as character adhesion and deformation. If the image data volume is small, the number of convolutional layers can be set to be small, the small network parameters are small, and it is not easy to overfit on a small data set. If the data volume is very large, more convolutional layers are set, and richer and more abstract features can be learned from a large amount of data, thereby improving the recognition accuracy. High-resolution images contain more detailed information, and more convolutional layers are set. Through multiple convolution operations, different levels of features in the image are gradually extracted, from low-level edge and line features to high-level character shape and structural features. If the image size is small, fewer convolutional layers are set, and feature extraction is performed quickly on a smaller image size, avoiding the gradient disappearance or overfitting problem on a small-size image due to an overly deep network. If the image has a lot of noise or blur, add some special processing layers to the network structure, or adjust the size and parameters of the convolution kernel. For example, for images with large noise, add a Gaussian filter layer or a median filter layer after the input layer of the network to reduce the noise of the image, so that the subsequent convolution layer can better extract the features in the image. In addition, for blurred images, the size of the convolution kernel can be appropriately increased, such as from the commonly used 3×3 convolution kernel to a 5×5 or 7×7 convolution kernel, which can extract features on a larger image area, helping to compensate for the loss of detail information caused by image blur, thereby improving the network's recognition ability for blurred images. Different vehicle identification code recognition tasks may involve different numbers and types of characters. If the number of characters is small and the type is single, such as a segment recognition task that only contains the numbers 0-9, fewer convolution layers are set. However, if the number of characters is large and contains a variety of letters and numbers, involving 26 English letters and 10 numbers, a total of 36 types of characters, more convolution layers are set. For situations where characters may be stuck, overlapped or deformed, some convolutional neural networks with special structures are used to classify and predict the image pixel by pixel to generate character segmentation masks, thereby achieving segmentation and recognition of stuck characters. For the problem of character deformation, the robustness of the network is enhanced by adding some special layers or operations to the network structure. For example, some pooling layers, such as maximum pooling layers or average pooling layers, are added after the convolutional layers. The pooling layers can retain the main features of the image while reducing the image resolution, and have a certain invariance to transformations such as translation, rotation, and scaling of the image, thereby improving the network's tolerance and recognition ability to character deformation.

[0089] Optionally, step S106, determining the character recognition result of each reference image in the n reference images according to the vehicle identification code recognition model to obtain n character recognition results, may include the following steps:

[0090] Step S501: determining the recognition difficulty of each reference image in n reference images to obtain n recognition difficulties;

[0091] Step S502: determining the recognition order of the n reference images according to the n recognition difficulties; the recognition order is used to determine the processing order of the vehicle identification code recognition model on the n reference images;

[0092] Step S503: determining m feature points of the target reference image through the vehicle identification code recognition model; m is a positive integer; the target reference image is any reference image among the n reference images; the m feature points are used to reflect the character position and character shape of the vehicle identification code of the target reference image;

[0093] Step S504: determining a character recognition result of the target reference image according to the m feature points;

[0094] Step S505: Determine n character recognition results corresponding to n reference images according to the recognition order and the character recognition result of the target reference image.

[0095] In a possible embodiment, the recognition difficulty of each reference image among n reference images is determined to obtain n recognition difficulties, and the recognition order of the n reference images is determined according to the n recognition difficulties; the recognition order is used to determine the processing order of the vehicle identification code recognition model for the n reference images. The recognition difficulty can be based on the image parameters of each reference image, and the image parameters include the shooting angle, the shooting time, the clarity of the image, etc. For reference images with lower recognition difficulty, the corresponding character recognition results have higher credibility.

[0096] In a possible embodiment, m feature points of the target reference image are determined by a vehicle identification code recognition model, where m is a positive integer, the target reference image is any reference image among the n reference images, and the m feature points are used to reflect the character position and character shape of the vehicle identification code of the target reference image. The number of feature points varies according to the vehicle identification code font and character structure, image resolution and quality, and feature extraction algorithm. For example, some fonts have a more complex character structure, so the number of feature points is relatively large, and fonts with simple structures and regular lines may have relatively fewer feature points. When the image resolution is increased from 1080p to 4K, the vehicle identification code characters in the image will become clearer, and subtle flaws on the edges of the characters, changes in line thickness, and other details that were originally difficult to detect in low-resolution images can be clearly presented in high-resolution images, resulting in an increase in the number of feature points. A clear, noise-free, and blur-free image can accurately reflect the true form of the VIN characters, which is conducive to the accurate extraction of feature points. If there is noise interference in the image, such as a VIN image taken in a dark environment, there may be more noise points, which will interfere with the extraction of feature points, resulting in a reduction in the number of feature points or inaccurate extracted feature points. Similarly, image blur will also have a negative impact on feature point extraction. For example, camera shake or inaccurate focus during shooting may cause the VIN image to be blurred, making the edges of the characters unclear, and the details that could have been used as feature points will be lost, resulting in a reduction in the number of feature points. Different feature extraction algorithms have their own unique principles and characteristics. These differences will result in different numbers of feature points being extracted from the same VIN image.

[0097] In a possible embodiment, the character recognition result of the target reference image is determined based on m feature points, and a confidence scoring principle based on probability distribution is adopted. When characters such as vehicle identification codes are recognized, a probability value is output for each possible character category, such as numbers 0-9 and letters AZ. These probability values ​​constitute a probability distribution, which represents the degree of recognition of the recognition result. For example, a character is recognized as "5", and the probability of outputting this recognition result is 0.9, which means that the recognition degree of this character as "5" is high.

[0098] Optionally, step S107, determining the vehicle identification code according to the n character recognition results, may include the following steps:

[0099] Step S601: compare the first character recognition result with the character recognition results other than the first character recognition result in the n character recognition results one by one to obtain n-1 character comparison results; the first character recognition result is any character recognition result in the n character recognition results;

[0100] Step S602: determining the similarity of the first character recognition result according to the n-1 character comparison results; the similarity is used to reflect the consistency between the first character recognition result and the character recognition results other than the first character recognition result among the n character recognition results;

[0101] Step S603: determining n similarities corresponding to n character recognition results according to the similarity of the first character recognition result;

[0102] Step S604: taking the character recognition result corresponding to the maximum value among the n similarities as the target character recognition result;

[0103] Step S605: Determine the confidence score of the target character recognition result;

[0104] Step S606: If the confidence score is higher than the preset score threshold, the target character recognition result is used as the vehicle identification code;

[0105] Step S607: Otherwise, the target image of the vehicle identification code is acquired again according to the n character recognition results, and the vehicle identification code is determined according to the target image.

[0106] In a possible embodiment, the first character recognition result is compared one by one with the character recognition results other than the first character recognition result among the n character recognition results, and n-1 character comparison results are obtained, wherein the first character recognition result is any character recognition result among the n character recognition results, and the similarity of the first character recognition result is determined according to the n-1 character comparison results, wherein the similarity is used to reflect the consistency between the first character recognition result and the character recognition results other than the first character recognition result among the n character recognition results, and the n similarities corresponding to the n character recognition results are determined according to the similarity of the first character recognition result, and the character recognition result corresponding to the maximum value among the n similarities is used as the target character recognition result. Exemplarily, the result output by the recognition model is cross-validated, because multiple images under different conditions are obtained when shooting the vehicle identification code, and each image obtains a recognition result of the vehicle identification code through the recognition model. However, the recognition result of a single image may be affected by various factors, such as local noise of the image, blur of the characters, etc., resulting in inaccurate recognition results. The cross-validation method can adopt a simple majority voting method. For example, if 5 vehicle identification code images are input into the model and 5 recognition results are obtained, when 3 or more of the results are consistent, it is determined that the consistent result is more reliable.

[0107] In a possible embodiment, the confidence score of the target character recognition result is determined. In order to further verify the recognition result, the confidence score of the recognition result is scored. The confidence score can be based on the probability distribution of the model output. When the score is lower than the threshold, a re-shoot is prompted to ensure that an accurate vehicle identification code is finally obtained. When the score is qualified, the final recognition result is displayed on the on-board diagnostic instrument and saved.

[0108] Optionally, the on-board diagnostic instrument further includes a self-cleaning device; in step S607, obtaining the target image of the vehicle identification code again according to the n character recognition results may include the following steps:

[0109] Step S701: determining the interference region of the vehicle identification code according to the n character recognition results; the interference region is used to reflect the region corresponding to the characters that are inconsistent in the n character recognition results;

[0110] Step S702: determining the boundary definition and boundary shape of the interference area in the n initial images, and obtaining n boundary definitions and n boundary shapes;

[0111] Step S703: determining the overlap of n interference regions according to n boundary sharpnesses and n boundary shapes;

[0112] Step S704: if the overlap degree is higher than a preset threshold, determining the area to be cleaned of at least one camera, and obtaining at least one area to be cleaned;

[0113] Step S705: determining the cleaning time and cleaning intensity of each area to be cleaned by the self-cleaning device in at least one area to be cleaned, and obtaining at least one cleaning time and at least one cleaning intensity;

[0114] Step S706: After cleaning at least one area to be cleaned by the self-cleaning device according to at least one cleaning duration and at least one cleaning intensity, a target image of the vehicle identification code is acquired again.

[0115] In a possible embodiment, the self-cleaning device includes a cleaning brush head, a cleaning liquid reservoir, a spray device, a driving mechanism, a sensor and a control system, wherein the cleaning brush head is made of a soft and elastic material, such as a sponge, a soft brush, etc., and is round or oval in shape to better fit the curved surface of the camera lens. The cleaning liquid reservoir is used to store the cleaning liquid, is made of corrosion-resistant plastic or glass material, has a certain capacity, and can meet the needs of multiple cleanings. The spray device is used to spray the cleaning liquid evenly onto the surface of the lens, and is composed of a micro nozzle and a control valve. The aperture of the micro nozzle is used to spray the cleaning liquid in a fine mist to ensure that the cleaning liquid evenly covers the lens, and the control valve is used to control the spray amount and spray time of the cleaning liquid. The driving mechanism can be a motor and a transmission device, the motor provides power for the cleaning device, and the transmission device transmits the power of the motor to the cleaning brush head, so that it can rotate or reciprocate to achieve wiping and cleaning of the lens. An ultrasonic driving element can also be used to use the vibration of the ultrasonic wave to drive the brush head or make the lens surface produce high-frequency vibration, thereby removing stains. The sensors include dust sensors and humidity sensors. The dust sensor can detect the number and density of dust particles on the lens surface. When the amount of dust reaches a certain threshold, the cleaning device is automatically triggered. The humidity sensor is used to detect the ambient humidity. When the humidity is too high, it may cause condensation of water vapor on the lens surface, which will also trigger the cleaning operation. The control system is composed of chips such as microcontrollers or digital signal processors. It receives signals from sensors and controls the operation of components such as drive mechanisms and spray devices according to preset programs and algorithms to achieve automatic cleaning functions. At the same time, it can also receive external control instructions, such as cleaning instructions sent by mobile phones or remote control platforms.

[0116] In a possible embodiment, the interference area of ​​the vehicle identification code is determined based on n character recognition results, wherein the interference area is used to reflect the area corresponding to the characters that are inconsistent in the n character recognition results. The recognition consistency of the characters at the same position in the character recognition results corresponding to different images is analyzed. For example, for three reference images, the corresponding character recognition results are as follows: 1ABC234567890123456, 1AEC234567890123456 and 1AFC234567890123456. Each character position in these results corresponds to a position in the vehicle identification code. By comparing the characters at the same position in different images, the inconsistent recognition can be determined. Compare the characters at the same position, traverse each character position, start from the first character, compare the first character in the three results, determine that the position is consistent, then compare the second character, which is also consistent, and continue to compare the third character. If it is inconsistent, the inconsistent character positions may be interfered with, and these positions are marked as possible interference areas. In addition, for each character position of the vehicle identification code, the average grayscale value and grayscale variance near the position can also be calculated. A higher grayscale variance indicates that the area corresponding to the character is unevenly illuminated, which is regarded as an interference area. An edge detection algorithm can also be used to determine the edge information of the area. If the edge information is blurred or discontinuous, it is regarded as an interference area.

[0117] In a possible embodiment, for each possible interference area, the recognition consistency of different images at the position and the grayscale variance, edge density and other characteristics of the image are comprehensively considered. For example, a threshold is set, and if the character recognition at the same position in multiple images is inconsistent, and the grayscale variance of the position exceeds a preset grayscale variance threshold or the edge density is not within a preset edge density range, then the position is determined to be an interference area.

[0118] In a possible embodiment, the boundary clarity and boundary shape of the interference area in n initial images are determined to obtain n boundary clarity and n boundary shapes. For the character position of the interference area, the image features of the position in the original image are analyzed to distinguish whether the interference area is caused by camera dirt or by insufficient light or reflection. The fuzzy interference caused by dirt is manifested as blur or spots at a fixed position, and the boundary of the fuzzy area is relatively clear, while the fuzzy interference caused by reflection has a highlight area and a halo, and the shape of the fuzzy area is irregular. For example, if the camera is dirty, the fuzzy area or spots caused by the dirt usually appear in the same position of the image in different pictures. This is because the dirty position on the surface of the camera is fixed, and when the light passes through the lens, the dirty part will block or scatter the light, thereby forming an unclear area at a fixed position on the image. For example, if there is a stain on the edge of the camera lens, then in all the pictures taken, blur or dark spots will appear at the same position on the edge of the picture. The fuzzy area caused by camera dirt often has relatively clear boundaries. This is because the shape and boundary of the dirt are relatively fixed, and the range of influence on the light is also relatively clear. When the subject is reflecting light, obvious highlights will appear in the image, and the brightness of these highlights will usually be much higher than the surrounding environment. Around the highlights, halos may form, and the color and brightness of the halos will change with the distance from the highlights. For example, when shooting a vehicle identification number, if there is a reflection, a bright highlight will appear in the corresponding part of the vehicle identification number in the picture, and there may be a circle of darker halos around it. The shape of the blurred area caused by reflections is usually irregular. This is because the direction and intensity of the reflection are affected by many factors such as the shape and material of the surface of the subject and the angle of incidence of the light. The reflection conditions of different parts are different, resulting in the shape of the blurred area formed in the picture is also ever-changing, and there is no fixed pattern to follow.

[0119] In a possible embodiment, the overlap of n interference areas is determined according to n boundary sharpness and n boundary shapes, which is mainly reflected in the consistency of camera dirtiness and the inconsistency of reflection of the photographed object. If the overlap is high, the interference factor is determined to be camera dirtiness, and if the overlap is low, the interference factor is determined to be reflection of the photographed object. For example, if the unclear area is caused by camera dirtiness, these unclear areas will show a high degree of consistency in multiple pictures taken at different times and angles. As mentioned above, the position of the unclear area is fixed, and its shape, size and blur are basically the same. This is because the dirty condition of the camera surface will not change significantly in a short time unless the camera is cleaned. For example, in a group of pictures taken continuously, a blurred spot of the same shape and size appears in the upper left corner of each picture, which is probably due to dirtiness in the upper left corner of the camera lens. The unclear area caused by reflection of the photographed object often shows large differences in multiple pictures. Since reflections are affected by many factors, such as lighting conditions, shooting angle, and the state of the subject itself, changes in any of these factors may cause changes in reflections. For example, when the angle of incidence of light changes, the reflective part and intensity of the surface of the subject will also change, resulting in highlight areas and blurred areas of different positions, shapes, and brightness in the picture. Similarly, when the shooting angle changes, the reflective conditions on the surface of the subject will also be different, resulting in inconsistent unclear areas in the picture.

[0120] In a possible embodiment, if the overlap is higher than a preset threshold, determine the area to be cleaned of at least one camera to obtain at least one area to be cleaned; determine the cleaning time and cleaning strength of each area to be cleaned by the self-cleaning device in at least one area to be cleaned to obtain at least one cleaning time and at least one cleaning strength; after cleaning at least one area to be cleaned by the self-cleaning device according to at least one cleaning time and at least one cleaning strength, obtain the target image of the vehicle identification code again. Determine the area to be cleaned of at least one camera according to n initial images to obtain at least one area to be cleaned, then determine the cleaning strength and cleaning time of each area to be cleaned according to the surface condition of the camera and environmental factors, and determine the cleaning time of each area to be cleaned according to the working status of the camera and the availability of cleaning resources. Exemplarily, the surface condition of the camera includes the degree of dirt and the type of dirt. The degree of dirt is evaluated by the quality of the image collected by the camera. For example, if there is obvious blur, spots or reduced contrast in the image, it means that the degree of dirt is high. Common types of dirt include dust, oil, water stains, fingerprints, etc. Different types of dirt require different cleaning methods. For example, for dust, it can be cleaned by blowing or vacuuming, while for oil, it may be necessary to use a wipe or spray containing a detergent for cleaning. Environmental factors include ambient temperature, ambient humidity and dust concentration. In a low temperature environment, the cleaning fluid may freeze and affect its normal use. Therefore, before cleaning, detect the ambient temperature. If the temperature is too low, preheat the camera first, or choose to clean it when the temperature is suitable. In a high humidity environment, water vapor may condense quickly on the surface of the camera after cleaning, resulting in blurred images. Therefore, before cleaning, monitor the ambient humidity. If the humidity is too high, use a dehumidifier to reduce the ambient humidity first, or take measures to prevent water vapor condensation after cleaning, such as using a desiccant or heating element. If the dust concentration in the environment where the camera is located is high, a large amount of dust may quickly accumulate on the camera surface, affecting the image quality. In this case, increase the time and intensity of blowing or vacuuming to ensure that the dust can be effectively removed. Before cleaning the camera, determine whether the camera is collecting images. If the camera is collecting images, determine whether to suspend image collection first based on the importance of the task of collecting images, and then start the self-cleaning mode. After cleaning, ensure that the camera returns to the normal collection state.

[0121] Optionally, the on-board diagnostic instrument further includes a lighting device; in step S607, obtaining the target image of the vehicle identification code again according to the n character recognition results may also include the following steps:

[0122] Step S801: if the overlap degree is lower than a preset threshold, determine the area to be filled with light in the target area;

[0123] Step S802: Determine the light intensity and light angle of the lighting device;

[0124] Step S803: after the area to be filled with light is filled with light by the lighting device according to the light intensity and the light angle, the target image of the vehicle identification code is acquired again.

[0125] In a possible embodiment, if the overlap is lower than a preset threshold, and it is determined that the unclear shooting is caused by the reflection of the shooting object, the area to be filled with light in the target area is determined, the light intensity and light angle of the lighting device are determined, and the target image of the vehicle identification code is obtained again after the area to be filled with light is filled with light by the lighting device according to the light intensity and light angle. The brightness information of the area to be filled with light is analyzed, and the average grayscale value of the area to be filled with light is calculated and compared with the average grayscale value of the corresponding area in the reference image. If the average grayscale value of the area to be filled with light in the current image is significantly lower than that of the reference image, it means that the light intensity needs to be increased. If the ambient light is dark, a relatively high light intensity is determined to achieve a good fill light effect. If the ambient light color is warm or cold, the light intensity and color of the fill light are adjusted accordingly to ensure the overall light balance. The position and shape of the area to be filled with light in the image, as well as the character direction and structure of the vehicle identification code are determined. For example, if the area to be filled with light is located on the left side of the vehicle identification code character, and the character structure is written from left to right, in order to avoid shadows, fill light is performed from the right side at a certain angle. It is also possible to simulate the fill-in lighting effect under different light angles through 3D modeling or simulation software according to the actual structure of the vehicle and the position of the camera. By adjusting the light angle, observe the brightness uniformity and clarity of the characters in the area to be filled, and select the light angle that can make the light uniform and the characters clearest in the area to be filled. According to the reflection problem of the fill-in light, avoid direct light exposure to the reflective parts of the vehicle surface to cause reflection interference. By analyzing the material and texture of the vehicle surface, predict the reflection direction of the light, and adjust the light angle to reduce the impact of reflection on the fill-in lighting effect. According to the determined light intensity and light angle, adjust the parameters of the lighting device. If the lighting device is an adjustable lighting lamp, set its brightness value through the controller to achieve the required light intensity. Adjust the light angle to the set value by adjusting the physical position of the lamp or using an adjustable angle bracket. Start the lighting device, fill the area to be filled, ensure that the lighting device works stably for a period of time, so that the light in the area to be filled reaches a stable state, and use the camera to obtain the target image of the vehicle identification code again. Before obtaining the image, the exposure time, gain and other parameters of the camera can be appropriately adjusted according to the light conditions after the fill-in to ensure the quality of the image.

[0126] The hardware architecture of the embodiment of the present application is composed of an image acquisition module, an image preprocessing module, a vehicle identification code recognition model and a recognition result output module, wherein the image acquisition module is used to take multiple vehicle identification code photos by adopting the method of "first enlarging the focal length, locking the brightness and focusing", adjusting different exposure times to take multiple photos containing the vehicle identification code, and taking multiple images at different focus points. The image preprocessing module is used to apply a filtering algorithm to the acquired image, remove background noise, enhance the edge clarity of the image, adjust the image brightness by using a histogram equalization method and other methods to adjust the image brightness distribution, ensure that the vehicle identification code characters are clearly visible, and adjust the image angle by a geometric correction algorithm to ensure that the vehicle identification code characters are presented in a standard direction for subsequent recognition. The vehicle identification code recognition model is used to recognize images using a pre-trained and fine-tuned deep learning model. The recognition result output module is used to cross-validate the recognition results, judge the consistency of the recognition results in multiple images, improve the recognition accuracy, and score the confidence of the recognition results. When the score is lower than the threshold, the user can be prompted to re-shoot the user. The final recognition result is displayed on the on-board diagnostic instrument and saved.

[0127] For example, see Figure 6 , Figure 6 is a flow chart of an embodiment of a method for determining a vehicle identification code provided in an embodiment of the present application, such as Figure 6 As shown in the flowchart, multiple vehicle identification code photos are obtained, multiple vehicle identification code photos are preprocessed, a vehicle identification code recognition model based on deep learning is constructed, a vehicle identification code and a vehicle identification code label data set are obtained, and the constructed vehicle identification code recognition model is trained, multiple vehicle identification code photos are input into the vehicle identification code recognition model, and the results output by the model are verified and output to the vehicle-mounted detector. Exemplarily, in vehicle identification code recognition, the vehicle identification code photos are first obtained through the image acquisition module. For example, for a car to be detected, the camera is first zoomed in, the brightness and focus are locked, and multiple vehicle identification code photos with different exposure times and different focus points are taken. Then, the image preprocessing module starts to work, using the filtering algorithm to remove background noise, adjusting the brightness through histogram equalization, and then adjusting the image angle with the geometric correction algorithm to make the vehicle identification code characters clear and the direction standard. Then, the pre-trained and fine-tuned deep learning vehicle identification code recognition model recognizes the processed image. Finally, the recognition result output module cross-validates the results, judges the consistency and scores. If the score is qualified, the vehicle identification code recognition result will be displayed on the on-board diagnostic instrument and saved; if the score is low, you will be prompted to take the photo again.

[0128] In the embodiments of the present application, the method for obtaining pictures is to take multiple vehicle identification code pictures by first magnifying the focal length, locking the brightness and focusing, adjust the exposure duration to take multiple pictures containing the vehicle identification code, take multiple images at different focusing positions, and through the constructed and trained vehicle identification code recognition model, the vehicle identification code of the target vehicle can be accurately recognized.

[0129] In summary, in the embodiments of the present application, first obtain the camera environment parameters of the target area; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference degree of the camera environment in the target area; according to the camera environment parameters, obtain n initial images of the vehicle identification code through at least one camera; n is a positive integer; determine the horizontal gray level change gradient and vertical gray level change gradient of each initial image among the n initial images, and obtain n horizontal gray level change gradients and n vertical gray level change gradients; process the n initial images according to the n horizontal gray level change gradients and n vertical gray level change gradients to obtain n reference images; construct a vehicle identification code recognition model; determine the character recognition results of each reference image among the n reference images according to the vehicle identification code recognition model to obtain n character recognition results; determine the vehicle identification code according to the n character recognition results. Thus, by obtaining n initial images of the vehicle identification code through the camera environment parameters, processing the n initial images to obtain n reference images, recognizing the n reference images through the vehicle identification code recognition model to obtain n character recognition results, and finally determining the vehicle identification code through the n character recognition results, the recognition accuracy of the vehicle identification code can be improved to improve the diagnosis efficiency.

[0130] The method of the embodiments of the present invention is described in detail above, and the device of the embodiments of the present invention is provided below.

[0131] Refer to Figure 7 , Figure 7 FIG. is a schematic structural diagram of a vehicle identification code determination device provided by an embodiment of the present application. As Figure 7 shown, the vehicle identification code determination device 900 is applied to an on-vehicle diagnostic instrument, and the on-vehicle diagnostic instrument includes at least one camera; the vehicle identification code determination device 900 includes an acquisition unit 901 and a processing unit 902;

[0132] The acquisition unit 901 is configured to acquire the camera environment parameters of the target area; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference degree of the camera environment in the target area;

[0133] The processing unit 902 is configured to obtain n initial images of the vehicle identification code through at least one camera according to the camera environment parameters; n is a positive integer;

[0134] Determine the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients;

[0135] Processing n initial images according to n horizontal grayscale change gradients and n vertical grayscale change gradients to obtain n reference images;

[0136] Construct a vehicle identification code recognition model;

[0137] Determine a character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results;

[0138] The vehicle identification code is determined based on the n character recognition results.

[0139] In a possible embodiment, the camera environment parameters include lighting condition parameters and background condition parameters; in acquiring n initial images of the vehicle identification code through at least one camera according to the camera environment parameters, the processing unit 902 is specifically configured to:

[0140] determining a first interference score based on the lighting condition parameter;

[0141] determining a second interference score based on the background condition parameter;

[0142] determining the number of image acquisitions according to the first interference score and the second interference score;

[0143] Acquiring the spatial position coordinates of the vehicle identification code through at least one camera;

[0144] Determine the image acquisition parameters of each camera in at least one camera according to the number of image acquisitions, the illumination condition parameters, the background condition parameters and the spatial position coordinates, and obtain n image acquisition parameters; the image acquisition parameters include at least one of the following: resolution, contrast, saturation, focal length, shooting angle, number of shots, brightness, and exposure time;

[0145] According to the image acquisition quantity and the n image acquisition parameters, n initial images are acquired through at least one camera.

[0146] In a possible embodiment, in terms of obtaining n reference images by processing n initial images according to n horizontal grayscale change gradients and n vertical grayscale change gradients, the processing unit 902 is specifically configured to:

[0147] Determine the number of pixels at each gray level of each of the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients, and obtain n grayscale histograms;

[0148] Determine the maximum grayscale level and the minimum grayscale level of each of the n initial images according to the n grayscale histograms, and obtain n maximum grayscale levels and n minimum grayscale levels;

[0149] Determine n original grayscale intervals according to n maximum grayscale levels and n minimum grayscale levels;

[0150] Mapping the grayscale value of each pixel in the n original grayscale intervals to a preset grayscale range according to a preset grayscale mapping function to obtain a target grayscale value of each pixel in each of the n initial images;

[0151] Determine a rotation angle and a deformation parameter of each of the n initial images to obtain n rotation angles and n deformation parameters;

[0152] Determine n adjustment parameters according to n rotation angles and n deformation parameters;

[0153] The n initial images are processed according to the target grayscale value of each pixel of each initial image and the n adjustment parameters to obtain n reference images.

[0154] In a possible embodiment, in terms of constructing a vehicle identification code recognition model, the processing unit 902 is specifically configured to:

[0155] Acquire k training images through at least one camera according to k preset training conditions; k is an integer greater than 1; the different parts of any two preset training conditions among the k preset training conditions include at least one of the following: preset lighting conditions, preset shooting angles, and preset vehicle types;

[0156] Obtain k vehicle identification code labels corresponding to the k training images; the k vehicle identification code labels are used to reflect the actual vehicle identification code corresponding to each of the k training images;

[0157] Determine the network structure parameters of the vehicle identification code recognition model according to k training images and k vehicle identification code labels; the network structure parameters include: learning rate, initial model, number of model layers, and number of neurons in each layer;

[0158] Construct a vehicle identification code recognition model based on network structure parameters.

[0159] In a possible embodiment, in determining the character recognition result of each reference image in n reference images according to the vehicle identification code recognition model to obtain n character recognition results, the processing unit 902 is specifically configured to:

[0160] Determine the recognition difficulty of each reference image in n reference images to obtain n recognition difficulties;

[0161] Determine the recognition order of the n reference images according to the n recognition difficulties; the recognition order is used to determine the processing order of the vehicle identification code recognition model on the n reference images;

[0162] Determine m feature points of the target reference image through the vehicle identification code recognition model; m is a positive integer; the target reference image is any reference image among the n reference images; the m feature points are used to reflect the character position and character shape of the vehicle identification code of the target reference image;

[0163] Determine the character recognition result of the target reference image according to the m feature points;

[0164] The n character recognition results corresponding to the n reference images are determined according to the recognition order and the character recognition result of the target reference image.

[0165] In a possible embodiment, in determining the vehicle identification code according to the n character recognition results, the processing unit 902 is specifically configured to:

[0166] Compare the first character recognition result with the character recognition results other than the first character recognition result in the n character recognition results one by one to obtain n-1 character comparison results; the first character recognition result is any character recognition result in the n character recognition results;

[0167] Determine the similarity of the first character recognition result according to the n-1 character comparison results; the similarity is used to reflect the consistency between the first character recognition result and the character recognition results other than the first character recognition result among the n character recognition results;

[0168] Determining n similarities corresponding to the n character recognition results according to the similarity of the first character recognition result;

[0169] The character recognition result corresponding to the maximum value among the n similarities is taken as the target character recognition result;

[0170] Determine a confidence score for the target character recognition result;

[0171] If the confidence score is higher than the preset score threshold, the target character recognition result is used as the vehicle identification code;

[0172] Otherwise, the target image of the vehicle identification code is acquired again according to the n character recognition results, and the vehicle identification code is determined according to the target image.

[0173] In a possible embodiment, the on-board diagnostic instrument further includes a self-cleaning device; in terms of reacquiring a target image of the vehicle identification code according to the n character recognition results, the processing unit 902 is specifically configured to:

[0174] Determine the interference area of ​​the vehicle identification code according to the n character recognition results; the interference area is used to reflect the area corresponding to the characters that are inconsistent in the n character recognition results;

[0175] Determine the boundary definition and boundary shape of the interference area in the n initial images to obtain n boundary definition and n boundary shapes;

[0176] Determine the overlap of n interference regions according to n boundary sharpnesses and n boundary shapes;

[0177] If the overlap degree is higher than a preset threshold, determining the area to be cleaned of at least one camera, and obtaining at least one area to be cleaned;

[0178] Determine the cleaning time and cleaning intensity of each to-be-cleaned area in at least one to-be-cleaned area by the self-cleaning device to obtain at least one cleaning time and at least one cleaning intensity;

[0179] After at least one area to be cleaned is cleaned by the self-cleaning device according to at least one cleaning duration and at least one cleaning intensity, a target image of the vehicle identification code is acquired again.

[0180] In a possible embodiment, the on-board diagnostic instrument further includes a lighting device; in terms of reacquiring a target image of the vehicle identification code according to the n character recognition results, the processing unit 902 is further configured to:

[0181] If the overlap is lower than a preset threshold, the area to be filled with light in the target area is determined;

[0182] Determine the light intensity and light angle of the lighting device;

[0183] According to the light intensity and light angle, after the area to be filled with light is filled with light by the lighting device, the target image of the vehicle identification code is obtained again.

[0184] See also Figure 8 , Figure 8 Schematic diagram of the structure of a vehicle-mounted diagnostic instrument provided in an embodiment of the present application. Figure 8 As shown, the on-board diagnostic instrument 1000 includes a transceiver 1001, a processor 1002 and a memory 1003, which are connected via a bus 1004. The memory 1003 is used to store computer programs and data, and can transmit the data stored in the memory 1003 to the processor 1002. The on-board diagnostic instrument 1000 can be the above-mentioned vehicle identification code determination device 900, and the processor 1002 can be the above-mentioned acquisition unit 901 and processing unit 902.

[0185] The processor 1002 is used to read the computer program in the memory 1003 and perform the following operations:

[0186] Obtain the camera environment parameters of the target area; the target area is the area where the vehicle identification number is located; the camera environment parameters are used to reflect the complexity or interference degree of the camera environment in the target area;

[0187] Obtain n initial images of the vehicle identification number through at least one camera according to the camera environment parameters; n is a positive integer;

[0188] Determine the horizontal gray-scale change gradient and vertical gray-scale change gradient of each initial image in the n initial images, obtaining n horizontal gray-scale change gradients and n vertical gray-scale change gradients;

[0189] Process the n initial images according to the n horizontal gray-scale change gradients and n vertical gray-scale change gradients to obtain n reference images;

[0190] Construct a vehicle identification number recognition model;

[0191] Determine the character recognition result of each reference image in the n reference images according to the vehicle identification number recognition model, obtaining n character recognition results;

[0192] Determine the vehicle identification number according to the n character recognition results.

[0193] In a possible embodiment, the camera environment parameters include a lighting condition parameter and a background condition parameter; in terms of obtaining n initial images of the vehicle identification number through at least one camera according to the camera environment parameters, the processor 1002 is specifically configured to perform the following operations:

[0194] Determine a first interference score according to the lighting condition parameter;

[0195] Determine a second interference score according to the background condition parameter;

[0196] Determine the image acquisition quantity according to the first interference score and the second interference score;

[0197] Obtain the spatial position coordinates of the vehicle identification number through at least one camera;

[0198] Determine the image acquisition parameters of each camera in the at least one camera according to the image acquisition quantity, the lighting condition parameter, the background condition parameter, and the spatial position coordinates, obtaining n image acquisition parameters; the image acquisition parameters include at least one of the following: resolution, contrast, saturation, focal length, shooting angle, shooting times, brightness, exposure duration;

[0199] Obtain n initial images through at least one camera according to the image acquisition quantity and the n image acquisition parameters.

[0200] In a possible embodiment, in terms of processing n initial images according to n horizontal grayscale change gradients and n vertical grayscale change gradients to obtain n reference images, the processor 1002 is specifically configured to perform the following operations:

[0201] Determine the number of pixels at each gray level of each of the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients, and obtain n grayscale histograms;

[0202] Determine the maximum grayscale level and the minimum grayscale level of each of the n initial images according to the n grayscale histograms, and obtain n maximum grayscale levels and n minimum grayscale levels;

[0203] Determine n original grayscale intervals according to n maximum grayscale levels and n minimum grayscale levels;

[0204] Mapping the grayscale value of each pixel in the n original grayscale intervals to a preset grayscale range according to a preset grayscale mapping function to obtain a target grayscale value of each pixel in each of the n initial images;

[0205] Determine a rotation angle and a deformation parameter of each of the n initial images to obtain n rotation angles and n deformation parameters;

[0206] Determine n adjustment parameters according to n rotation angles and n deformation parameters;

[0207] The n initial images are processed according to the target grayscale value of each pixel of each initial image and the n adjustment parameters to obtain n reference images.

[0208] In a possible embodiment, in terms of constructing a vehicle identification code recognition model, the processor 1002 is specifically configured to perform the following operations:

[0209] Acquire k training images through at least one camera according to k preset training conditions; k is an integer greater than 1; the different parts of any two preset training conditions among the k preset training conditions include at least one of the following: preset lighting conditions, preset shooting angles, and preset vehicle types;

[0210] Obtain k vehicle identification code labels corresponding to the k training images; the k vehicle identification code labels are used to reflect the actual vehicle identification code corresponding to each of the k training images;

[0211] Determine the network structure parameters of the vehicle identification code recognition model according to k training images and k vehicle identification code labels; the network structure parameters include: learning rate, initial model, number of model layers, and number of neurons in each layer;

[0212] Construct a vehicle identification code recognition model based on network structure parameters.

[0213] In a possible embodiment, in determining the character recognition result of each reference image in n reference images according to the vehicle identification code recognition model to obtain n character recognition results, the processor 1002 is specifically configured to perform the following operations:

[0214] Determine the recognition difficulty of each reference image in n reference images to obtain n recognition difficulties;

[0215] Determine the recognition order of the n reference images according to the n recognition difficulties; the recognition order is used to determine the processing order of the vehicle identification code recognition model on the n reference images;

[0216] Determine m feature points of the target reference image through the vehicle identification code recognition model; m is a positive integer; the target reference image is any reference image among the n reference images; the m feature points are used to reflect the character position and character shape of the vehicle identification code of the target reference image;

[0217] Determine the character recognition result of the target reference image according to the m feature points;

[0218] The n character recognition results corresponding to the n reference images are determined according to the recognition order and the character recognition result of the target reference image.

[0219] In a possible embodiment, in determining the vehicle identification code according to the n character recognition results, the processor 1002 is specifically configured to perform the following operations:

[0220] Compare the first character recognition result with the character recognition results other than the first character recognition result in the n character recognition results one by one to obtain n-1 character comparison results; the first character recognition result is any character recognition result in the n character recognition results;

[0221] Determine the similarity of the first character recognition result according to the n-1 character comparison results; the similarity is used to reflect the consistency between the first character recognition result and the character recognition results other than the first character recognition result among the n character recognition results;

[0222] Determining n similarities corresponding to the n character recognition results according to the similarity of the first character recognition result;

[0223] The character recognition result corresponding to the maximum value among the n similarities is taken as the target character recognition result;

[0224] Determine a confidence score for the target character recognition result;

[0225] If the confidence score is higher than the preset score threshold, the target character recognition result is used as the vehicle identification code;

[0226] Otherwise, the target image of the vehicle identification code is acquired again according to the n character recognition results, and the vehicle identification code is determined according to the target image.

[0227] In a possible embodiment, the on-board diagnostic instrument further includes a self-cleaning device; in terms of reacquiring the target image of the vehicle identification code according to the n character recognition results, the processor 1002 is specifically configured to perform the following operations:

[0228] Determine the interference area of ​​the vehicle identification code according to the n character recognition results; the interference area is used to reflect the area corresponding to the characters that are inconsistent in the n character recognition results;

[0229] Determine the boundary definition and boundary shape of the interference area in the n initial images to obtain n boundary definition and n boundary shapes;

[0230] Determine the overlap of n interference regions according to n boundary sharpnesses and n boundary shapes;

[0231] If the overlap degree is higher than a preset threshold, determining the area to be cleaned of at least one camera, and obtaining at least one area to be cleaned;

[0232] Determine the cleaning time and cleaning intensity of each to-be-cleaned area in at least one to-be-cleaned area by the self-cleaning device to obtain at least one cleaning time and at least one cleaning intensity;

[0233] After at least one area to be cleaned is cleaned by the self-cleaning device according to at least one cleaning duration and at least one cleaning intensity, a target image of the vehicle identification code is acquired again.

[0234] In a possible embodiment, the on-board diagnostic instrument further includes a lighting device; in terms of reacquiring a target image of the vehicle identification code according to the n character recognition results, the processor 1002 is further configured to perform the following operations:

[0235] If the overlap is lower than a preset threshold, the area to be filled with light in the target area is determined;

[0236] Determine the light intensity and light angle of the lighting device;

[0237] According to the light intensity and light angle, after the area to be filled with light is filled with light by the lighting device, the target image of the vehicle identification code is obtained again.

[0238] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement part or all of the steps of any vehicle identification code determination method recorded in the above method embodiments.

[0239] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any vehicle identification code determination method recorded in the above method embodiments.

[0240] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0241] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0242] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the modules, which is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or module can be electrical or other forms.

[0243] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0244] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software program modules.

[0245] If the integrated module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0246] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for determining a vehicle identification code, characterized in that: Applied to an on-board diagnostic instrument, the on-board diagnostic instrument includes at least one camera; the method includes: Acquire the camera environment parameters of the target area; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference level of the camera environment in the target area; Acquire n initial images of the vehicle identification code through the at least one camera according to the camera environment parameters; n is a positive integer; Determine the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients; Processing the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images; Construct a vehicle identification code recognition model; Determine a character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results; The vehicle identification code is determined according to the n character recognition results.

2. The method according to claim 1, characterized in that The camera environment parameters include lighting condition parameters and background condition parameters; the step of acquiring n initial images of the vehicle identification code through the at least one camera according to the camera environment parameters includes: determining a first interference score according to the lighting condition parameter; determining a second interference score based on the background condition parameter; determining the number of image acquisitions according to the first interference score and the second interference score; Acquiring the spatial position coordinates of the vehicle identification code through the at least one camera; Determine the image acquisition parameters of each camera in the at least one camera according to the image acquisition quantity, the lighting condition parameter, the background condition parameter and the spatial position coordinates, and obtain n image acquisition parameters; the image acquisition parameters include at least one of the following: resolution, contrast, saturation, focal length, shooting angle, number of shots, brightness, and exposure time; The n initial images are acquired through the at least one camera according to the image acquisition quantity and the n image acquisition parameters.

3. The method according to claim 1, characterized in that The processing of the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images includes: Determine the number of pixels of each initial image at each gray level in the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients, and obtain n grayscale histograms; Determine the maximum grayscale level and the minimum grayscale level of each of the n initial images according to the n grayscale histograms, and obtain n maximum grayscale levels and n minimum grayscale levels; Determining n original grayscale intervals according to the n maximum grayscale levels and the n minimum grayscale levels; Mapping the grayscale value of each pixel in the n original grayscale intervals to a preset grayscale range according to a preset grayscale mapping function to obtain a target grayscale value of each pixel in each of the n initial images; Determining a rotation angle and a deformation parameter of each of the n initial images to obtain n rotation angles and n deformation parameters; Determining n adjustment parameters according to the n rotation angles and the n deformation parameters; The n initial images are processed according to the target grayscale value of each pixel of each initial image in the n initial images and the n adjustment parameters to obtain the n reference images.

4. The method according to claim 1, characterized in that The constructing of the vehicle identification code recognition model comprises: Acquire k training images through the at least one camera according to k preset training conditions; k is an integer greater than 1; the different parts of any two preset training conditions in the k preset training conditions include at least one of the following: preset lighting conditions, preset shooting angles, and preset vehicle types; Obtaining k vehicle identification code labels corresponding to the k training images; the k vehicle identification code labels are used to reflect the actual vehicle identification code corresponding to each of the k training images; Determine the network structure parameters of the vehicle identification code recognition model according to the k training images and the k vehicle identification code labels; the network structure parameters include: learning rate, initial model, number of model layers, and number of neurons in each layer; The vehicle identification code recognition model is constructed according to the network structure parameters.

5. The method according to claim 4, characterized in that The step of determining the character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results includes: Determining the recognition difficulty of each reference image in the n reference images to obtain n recognition difficulties; Determining a recognition order of the n reference images according to the n recognition difficulties; the recognition order is used to determine a processing order of the vehicle identification code recognition model on the n reference images; Determine m feature points of a target reference image by using the vehicle identification code recognition model; m is a positive integer; the target reference image is any reference image among the n reference images; the m feature points are used to reflect the character position and character shape of the vehicle identification code of the target reference image; Determine a character recognition result of the target reference image according to the m feature points; The n character recognition results corresponding to the n reference images are determined according to the recognition order and the character recognition result of the target reference image.

6. The method according to any one of claims 1 to 5, characterized in that: The determining the vehicle identification code according to the n character recognition results comprises: Compare the first character recognition result with the character recognition results other than the first character recognition result in the n character recognition results one by one to obtain n-1 character comparison results; the first character recognition result is any character recognition result in the n character recognition results; Determining the similarity of the first character recognition result according to the n-1 character comparison results; the similarity is used to reflect the consistency between the first character recognition result and the character recognition results of the n character recognition results other than the first character recognition result; Determining n similarities corresponding to the n character recognition results according to the similarity of the first character recognition result; The character recognition result corresponding to the maximum value among the n similarities is used as the target character recognition result; Determining a confidence score for the target character recognition result; If the confidence score is higher than a preset score threshold, the target character recognition result is used as the vehicle identification code; Otherwise, the target image of the vehicle identification code is acquired again according to the n character recognition results, and the vehicle identification code is determined according to the target image.

7. The method according to claim 6, characterized in that The on-board diagnostic instrument further includes a self-cleaning device; the step of reacquiring the target image of the vehicle identification code according to the n character recognition results includes: Determine the interference area of ​​the vehicle identification code according to the n character recognition results; the interference area is used to reflect the area corresponding to the characters with inconsistent comparison in the n character recognition results; Determining the boundary definition and boundary shape of the interference area in the n initial images to obtain n boundary definition and n boundary shapes; Determining the overlap of the n interference regions according to the n boundary sharpnesses and the n boundary shapes; If the overlap degree is higher than a preset threshold, determining the area to be cleaned of the at least one camera, and obtaining at least one area to be cleaned; Determine the cleaning duration and cleaning intensity of each of the at least one area to be cleaned by the self-cleaning device to obtain at least one cleaning duration and at least one cleaning intensity; After the at least one area to be cleaned is cleaned by the self-cleaning device according to the at least one cleaning duration and the at least one cleaning strength, the target image of the vehicle identification code is acquired again.

8. The method according to claim 7, characterized in that The on-board diagnostic instrument further includes a lighting device; the target image of the vehicle identification code is obtained again according to the n character recognition results, and further includes: If the overlap degree is lower than a preset threshold, determining the area to be filled with light in the target area; Determining the light intensity and light angle of the lighting device; After the area to be supplemented with light is supplemented with light by the lighting device according to the light intensity and the light angle, the target image of the vehicle identification code is acquired again.

9. A vehicle identification code determination device, characterized in that: Applied to an on-board diagnostic instrument, the on-board diagnostic instrument comprises at least one camera; the device comprises an acquisition unit and a processing unit; The acquisition unit is used to acquire the camera environment parameters of the target area; the target area is the area where the vehicle identification code is located; the camera environment parameters are used to reflect the complexity or interference level of the camera environment in the target area; The processing unit is used to obtain n initial images of the vehicle identification code through the at least one camera according to the camera environment parameters; n is a positive integer; Determine the horizontal grayscale change gradient and the vertical grayscale change gradient of each of the n initial images to obtain n horizontal grayscale change gradients and n vertical grayscale change gradients; Processing the n initial images according to the n horizontal grayscale change gradients and the n vertical grayscale change gradients to obtain n reference images; Construct a vehicle identification code recognition model; Determine a character recognition result of each of the n reference images according to the vehicle identification code recognition model to obtain n character recognition results; The vehicle identification code is determined according to the n character recognition results.

10. An on-board diagnostic instrument, characterized in that: include: A processor and a memory, wherein the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory so that the on-board diagnostic instrument executes the method according to any one of claims 1 to 8.