A license plate recognition method and device, electronic equipment and storage medium
By generating degraded images and labeled images to train a neural network model, the problems of overexposure of fonts and stroke adhesion in license plate images were solved, thus restoring the quality of license plate images and improving recognition accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIVIEW TECH CO LTD
- Filing Date
- 2024-12-09
- Publication Date
- 2026-06-09
Smart Images

Figure CN122176680A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a license plate recognition method, device, electronic device, and storage medium. Background Technology
[0002] With the rapid development of transportation and image processing technologies, license plate recognition technology is increasingly widely used in scenarios such as parking fee collection, traffic violation detection, and road traffic monitoring. However, at night, under strong sunlight, or in situations with changing lighting, the font in license plate images is often overexposed, leading to problems such as strokes sticking together and blurring, which seriously affects image quality and the accuracy of license plate recognition.
[0003] In existing technologies, license plate images are typically processed by histogram equalization, contrast enhancement, or character width thinning. However, this method has limited effectiveness in restoring license plate images with overexposed fonts or overlapping strokes, thus affecting the accuracy of license plate recognition. Summary of the Invention
[0004] This invention provides a license plate recognition method, apparatus, electronic device, and storage medium to improve the quality of license plate images, thereby enhancing the accuracy and robustness of license plate recognition.
[0005] In a first aspect, embodiments of the present invention provide a license plate recognition method, the method comprising:
[0006] Determine the sample license plate image, and generate a degraded image and a label image based on the sample license plate image;
[0007] The degraded image and the labeled image are used to train a pre-set neural network model to obtain a license plate image processing model.
[0008] An initial license plate image to be identified is input into the license plate image processing model to obtain the target license plate image to be identified output by the license plate image processing model, and license plate recognition is performed based on the target license plate image to be identified.
[0009] Secondly, embodiments of the present invention also provide a license plate recognition device, the device comprising:
[0010] A degraded image and label image determination module is used to determine a sample license plate image and generate a degraded image and a label image based on the sample license plate image;
[0011] The license plate image processing model determination module is used to train a pre-set neural network model using the degraded image and the label image to obtain the license plate image processing model.
[0012] The license plate recognition module is used to input an initial license plate image to be recognized into the license plate image processing model to obtain a target license plate image to be recognized output by the license plate image processing model, and to perform license plate recognition based on the target license plate image.
[0013] Thirdly, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the license plate recognition method as described in any of the embodiments of the present invention.
[0014] Fourthly, embodiments of the present invention also provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the license plate recognition method as described in any of the embodiments of the present invention.
[0015] The technical solution of this invention processes sample license plate images to obtain degraded images and labeled images. A neural network model is trained based on the degraded and labeled images to obtain a license plate image processing model. This model is then used to process the initial license plate image to be recognized, resulting in a target license plate image. Finally, license plate recognition is performed based on the target license plate image. This solution solves the problem of poor image quality restoration in existing technologies for license plate images with overexposed fonts and overlapping strokes. It effectively restores the quality of license plate images, thereby improving the accuracy and robustness of license plate recognition.
[0016] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of a license plate recognition method provided in Embodiment 1 of the present invention;
[0019] Figure 2 This is a flowchart of a license plate recognition method provided in Embodiment 2 of the present invention;
[0020] Figure 3 This is a schematic diagram of an expansion core shape provided in Embodiment 2 of the present invention;
[0021] Figure 4 This is a schematic diagram of the structure of a license plate recognition device provided in Embodiment 3 of the present invention;
[0022] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices. In the embodiments of this application, certain software, components, models, and other existing industry solutions may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solutions of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0025] The acquisition, transmission, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.
[0026] Example 1
[0027] Figure 1 The flowchart of a license plate recognition method provided in Embodiment 1 of the present invention is applicable to situations where license plate images undergo quality restoration processing in order to perform license plate recognition based on the restored license plate images. This method can be executed by a license plate recognition device, which can be implemented in hardware and / or software and can be configured in an electronic device or a server.
[0028] like Figure 1 As shown, the method includes:
[0029] S110. Determine the sample license plate image, and generate a degraded image and a label image based on the sample license plate image.
[0030] The sample license plate images refer to license plate images with normal exposure and normal character stroke width. Sample license plate images can be obtained through open-source datasets, and this embodiment does not limit the number of sample license plate images or the acquisition method.
[0031] Furthermore, by determining the image brightness distribution histogram and other methods, the details of the bright and dark parts of the image can be judged, thereby determining whether the license plate image is properly exposed. For example, for a properly exposed license plate image, the pixel distribution of its histogram should cover all levels from dark to bright, and should not be too concentrated at the darkest or brightest end.
[0032] Furthermore, methods based on character edge detection, connected component detection, or deep learning models can be used to determine the width of character strokes in a license plate image and whether these widths fall within a pre-set range, thus determining whether the character stroke widths in the license plate image are normal. The character stroke width can be represented by the number of pixels, meaning its value is an integer greater than or equal to 1.
[0033] Determining the stroke width of characters in a license plate image can be achieved in several ways. Specifically, methods based on character edge detection involve using edge detection algorithms to detect character edges in the license plate image and identify parallel edges within those edges. The distance between these parallel edges is then determined, and the stroke width is based on this distance. Alternatively, methods based on connected component detection perform connected component detection on the license plate image, dividing the character's connected components into regions and determining the stroke width based on features such as the area or perimeter of these sub-regions. Finally, methods based on deep learning models train a deep learning model on license plate images pre-labeled with stroke width information, creating a character width recognition model. This model is then used to determine the stroke width of the characters in the license plate image.
[0034] A degraded image is an image obtained by processing a sample license plate image that has normal exposure and normal character stroke width. It is used to simulate real-world conditions such as overexposure and overlapping character strokes. One sample license plate image can correspond to one or more degraded images. Furthermore, one sample license plate image can correspond to multiple degraded images with different degrees of degradation, such as no degradation, low degradation, medium degradation, and high degradation images.
[0035] In an optional embodiment, generating a degraded image based on a sample license plate image may include: increasing the character edges of the characters in the sample license plate image layer by layer according to the character stroke width to thicken the character stroke width; and randomly brightening the sample license plate image.
[0036] Specifically, the range of values for the number of pixels added to the character edges can be determined based on the character stroke width of the sample license plate image, thus obtaining sample license plate images with different degrees of degradation. For example, if the character stroke width in the sample license plate image is 5 pixels (5px), then the range of values for the number of pixels added to the character edges can be 0-3px. Therefore, the character stroke widths obtained after adding character edges layer by layer are 5, 7, 9, and 11px.
[0037] Furthermore, weights can be set for the number of pixels added to the edges of each character. These weights can be the same or different. Taking the example above, the weights for the number of pixels added to the character edges from 0 to 3 pixels can be [0.25, 0.25, 0.25, 0.25]. This setting ensures that the number of degraded images with character stroke widths of 5, 7, 9, and 11 pixels is the same. Alternatively, the weights can be set to [0.4, 0.3, 0.2, 0.1]. This setting ensures that the ratio of the number of degraded images with character stroke widths of 5, 7, 9, and 11 pixels is 4:3:2:1.
[0038] Specifically, the sample license plate image is randomly brightened. Brightening refers to randomly increasing the brightness of pixels by adding a certain value to their original color pixel values (RGB (Red, Green, Blue)). The three color channels can be adjusted synchronously to maintain color balance. The randomness is reflected in randomly selecting a certain number of pixels from the sample license plate image for brightening, or applying different brightening levels to pixels in different areas. This embodiment does not limit the specific method used for random brightening; it can be implemented using a random brightening algorithm or image processing applications.
[0039] In this embodiment, for the sample license plate images, the character edges are gradually increased layer by layer according to the character stroke width to coarsen the character width and simulate the situation of character strokes sticking together. After the character width is coarsened, each sample license plate image is randomly brightened. This setting makes the processed degraded image closer to the actual overexposed license plate image with sticking character strokes, so that the trained license plate image processing model can restore the overexposed license plate image with sticking character strokes to a normal license plate image.
[0040] In another optional embodiment, generating a degraded image based on the sample license plate image may further include performing at least one of the following processes on the sample license plate image to obtain the degraded image: random dilation processing, random blurring processing, random noise processing, and random brightness enhancement processing.
[0041] Random dilation involves convolving the pixels of a sample license plate image with a dilation kernel of a specific structure or shape. This operation expands the highlighted or white areas in the sample license plate image, resulting in a larger highlighted area in the dilated image compared to the original. Understandably, the character areas in sample license plate images are typically white or light-colored, with stroke widths within a preset range. Random dilation increases the stroke width, simulating the situation where character strokes stick together due to environmental factors in real-world scenarios.
[0042] Random blurring refers to applying different types and degrees of blurring to regions of different positions and sizes in a sample license plate image. It is understandable that due to factors such as camera defocusing, vehicle movement, and overexposure, characters in actual license plate images may sometimes be blurred. Therefore, in this embodiment, random blurring is performed on the sample license plate image to simulate these situations and enhance the stability of subsequent license plate image processing model training.
[0043] Specifically, random blurring can include various types, such as Gaussian blur, motion blur, and median blur. Different types of random blur correspond to different parameters. For example, in Gaussian blur, different blur kernel sizes and standard deviations are randomly generated. Based on the Gaussian curve, a weighted average is applied to each pixel in the image with its surrounding pixels, removing image details and blurring the image. In motion blur, different motion directions and blur lengths are randomly generated to simulate the blurring effect produced by a moving vehicle. In median blur, neighborhood windows of different sizes are randomly selected, and the median value within the pixel's neighborhood is used to replace the value of the center pixel.
[0044] Random noise processing refers to adding different types and levels of noise to regions of varying locations and sizes within sample license plate images to simulate the various interferences that license plate images might experience in real-world scenarios. Understandably, real-world license plate images are subject to various noise interferences, such as noise from camera sensors and noise during transmission. In this embodiment, randomly adding noise to sample license plate images simulates real-world noise conditions, allowing for testing the accuracy and reliability of the license plate image processing model in noisy environments, and enhancing the robustness and stability of the model.
[0045] Specifically, random noise can include various types of noise, such as Gaussian noise and impulse noise. Gaussian noise manifests as random brightness variations in an image. After adding Gaussian noise to a sample license plate image, the grayscale values of some pixels will randomly increase or decrease, with the amplitude of the changes following a normal distribution. Impulse noise manifests as randomly appearing black and white dots in an image. After adding impulse noise to a sample license plate image, the color of some pixels will suddenly turn black or white, destroying the original color and texture of the sample license plate image.
[0046] Random brightness enhancement refers to randomly increasing the brightness values of certain pixels in a sample license plate image, thereby making the processed sample license plate image appear brighter overall or in certain areas. It is understood that real-world license plate images can be acquired under different lighting conditions. Therefore, by randomly brightening the sample license plate images in this embodiment, the actual situation of license plate images under different lighting conditions can be simulated, increasing the diversity of training data and improving the generalization ability of the license plate image processing model.
[0047] Specifically, some or all pixels in a sample license plate image can be randomly selected for brightening. Simultaneously, for the selected pixels, the brightening effect is achieved by increasing their brightness value. The increase in brightness value can be a fixed number or a random value within a certain range.
[0048] Furthermore, the sample license plate image can be randomly brightened using the following formula: g(x,y)=(α×f(x,y)+β) γ In this formula, f(x,y) represents the pixel value at position (x,y) in the sample license plate image, g(x,y) represents the pixel value at position (x,y) in the randomly brightened sample license plate image, and the values of f(x,y) and g(x,y) range from [0.0, 1.0]. α and β are linear brightening factors, with values ranging from [1.0, 2.0] and [0.01, 0.5] respectively, and γ represents a non-linear brightening factor, with a value ranging from [0.1, 1.0]. By randomly generating linear and non-linear brightening factors and using the above formula, the random brightening operation of each pixel in the sample license plate image is achieved.
[0049] The advantage of this setting is that by combining linear brightening and non-linear brightening, it can better fit the overexposure of license plate pixels caused by exposure boosting and gamma boosting when the ISP (Image Signal Processor) processes the pipeline, that is, when the ISP converts the original image into a high-quality, displayable sample license plate image.
[0050] It should be noted that in this embodiment, one or more of the following processes can be selected: random dilation, random blurring, random noise reduction, and random brightness enhancement, to process the sample license plate image and obtain a degraded image. When performing multiple random operations on the sample license plate image simultaneously, the operations can have different order; this embodiment does not impose any restrictions on this.
[0051] In this embodiment, by performing a series of operations on the sample license plate image, such as random dilation, random blurring, random noise reduction, and random brightness enhancement, the resulting degraded image can simulate license plate images in real-world situations, especially overexposed images and images with overlapping character strokes. As a result, the license plate image processing model trained on the degraded image can restore overexposed license plate images with overlapping character strokes to normal license plate images, thus improving the robustness and stability of the license plate image processing model.
[0052] A label image is a high-quality image with normal character stroke width obtained after processing a sample license plate image. A label image represents the image quality restoration result of a degraded image.
[0053] In an optional embodiment, a label image is generated based on the sample license plate image, which can be directly used as the label image. It is understood that since the sample license plate image itself is a license plate image with normal exposure and normal character stroke width, it can be directly used as the label image to indicate the effectiveness of image restoration in subsequent model training.
[0054] In another optional embodiment, generating a label image based on the sample license plate image may further include: performing black border suppression processing on the character edges of the sample license plate image, and / or normalizing the character width of each of the sample license plate images to obtain a label image.
[0055] Black border suppression refers to removing or reducing black or dark edges on the characters in the sample license plate image. It's understandable that if the camera used to capture the sample license plate image has significant sharpening, the black edges on the characters will be more noticeable. Therefore, this embodiment suppresses black edges on the character edges of the sample license plate image, ensuring that the character edges in the processed label image are normal. This allows the license plate image processing model trained on the label image to restore the image with normal character edges.
[0056] Specifically, character edge detection can be performed on sample license plate images, and black borders can be identified within these character edges. Specifically, if the pixel value corresponding to a character edge pixel is greater than or equal to a preset threshold, that pixel is considered a black border. The position and width of the black border are determined, and smoothing or interpolation operations are performed on the black border to reduce its width.
[0057] Normalizing the character widths of each sample license plate image means controlling the character widths of all sample license plate images within a certain range. Understandably, the character widths of each sample license plate image cannot be completely identical, which would slow down the convergence speed of the license plate image processing model during training. Therefore, in this embodiment, to accelerate model training, the character stroke widths of each sample license plate image are processed to ensure a high degree of consistency in character widths across all sample license plate images.
[0058] Specifically, the process of determining the character stroke width in the sample license plate image has been described in the above embodiments and will not be repeated here. If the character stroke width is greater than or equal to a preset character stroke width threshold, the character stroke width is reduced to be less than the character stroke width threshold. For example, the character edges can be reduced layer by layer to achieve refinement of the character stroke width.
[0059] In this embodiment, by suppressing black borders and normalizing character widths of the sample license plate images, the resulting labeled images have no black borders or have very small black borders and have high consistency in character width. On the one hand, this can improve the training speed and training effect of the license plate image processing model, and on the other hand, it can enable the trained license plate image processing model to achieve better image restoration results.
[0060] Furthermore, in this embodiment, whether generating a degraded image or a label image based on the sample license plate image, when determining the character stroke width, since the sample license plate image may simultaneously include Chinese characters, numbers, or letters, different types of characters may correspond to different ranges of character stroke width values. For example, the character stroke width of Chinese characters may be in the range of 2-4px, while the character stroke width of numbers and letters may be in the range of 3-7px. Furthermore, different Chinese characters, different numbers, or different letters may also correspond to different ranges of character stroke width values. Even further, for the same character, different regions may correspond to different ranges of character stroke width values. Therefore, in this embodiment, after determining the character stroke width and performing thickening / thinning processing on the character strokes, the character can be identified, and based on the type and specific content of the character, the range of character stroke width values corresponding to the character and its different regions can be determined, and then corresponding degrees of thickening / thinning processing can be applied.
[0061] Furthermore, in this embodiment, both the generation of degraded images and the generation of labeled images based on sample license plate images can be done offline and saved, or online during model training. Online generation of degraded / labeled images offers richer data diversity, resulting in better model training performance. This ensures the richness and representativeness of the model training data, providing a solid foundation for subsequent training of the license plate image processing model.
[0062] S120. Using the degraded image and the label image, a pre-set neural network model is trained to obtain a license plate image processing model.
[0063] The neural network model can be an FCN (Fully Convolutional Networks) model, a CNN (Convolutional Neural Networks) model, or a Deep CNN (Deep Convolutional Neural Networks) model, etc. This embodiment does not restrict the specific type of neural network model or the specific structure of the model.
[0064] Specifically, taking the training of a license plate image processing model using a fully convolutional network model (hereinafter referred to as FCN) as an example, SegNet, U-Net, and RefineNet can be chosen as specific implementation structures for FCN. SegNet and U-Net both consist of an encoder and a decoder, effectively learning and recovering detailed image information. The encoder extracts image features through convolution and pooling operations, while the decoder recovers the image resolution through deconvolution and upsampling operations. Unlike SegNet, U-Net introduces skip connections between the encoder and decoder, enabling the fusion of feature information at different scales. RefineNet consists of multiple RefineNet modules, each containing multiple residual convolutional units and a multi-resolution fusion module. After downsampling through ResNet (Residual Network), RefineNet undergoes upsampling through four RefineNet modules. The feature information generated by the encoder and the output information of the decoder from the previous stage are simultaneously used as inputs to the RefineNet modules. A series of convolutions, fusions, and pooling operations are performed in the RefineNet modules, resulting in a deeper fusion of multi-scale features. The FCN model can handle complex image information and improve the quality of the restored image.
[0065] It should be noted that the input and output of the neural network model are both color three-channel images of the same resolution, i.e., RGB images. This allows the trained license plate image processing model to handle complex image information and improve the quality of the reconstructed image.
[0066] In this embodiment, a pre-set neural network model is trained using degraded images and labeled images to obtain a license plate image processing model. Specifically, the degraded image is used as the input to the neural network model. After the neural network model performs image restoration on the degraded image, it outputs a new image, and the loss between the output image and the labeled image is calculated. The neural network model is iteratively trained until the model loss is less than or equal to a preset loss threshold, or the number of iterations of model training is greater than or equal to a preset number threshold.
[0067] Furthermore, the degraded image can be directly used as input to the neural network model, or a combination of the degraded image and smaller images obtained by randomly cropping the degraded image can be used as input. The size of the smaller images can be a pre-set fixed size, mainly depending on the number of downsampling operations performed by the neural network model, such as 32*32, 64*64, or 128*128. Using small, randomly cropped images of the degraded image as model input increases the diversity of training data, enhances the model's image restoration capabilities, and improves the generalization ability of the neural network model.
[0068] Furthermore, at least one of the following image processing techniques can be applied to the degraded image and the smaller images obtained by randomly cropping the degraded image: mirroring, rotation, hue adjustment, saturation adjustment, and contrast adjustment. This approach can further enhance the diversity of training data and improve the robustness of the license plate image processing model.
[0069] Furthermore, this embodiment can combine various loss functions when calculating the model loss, such as L1 Loss (absolute value loss) and GAN Loss (Generative Adversarial Network Loss). L1 Loss measures the pixel difference between the image restored by the neural network model and the labeled image, while GAN Loss improves the generative ability of the neural network model, making the restored image more realistic and natural. Through model training based on a combination of multiple loss functions, the trained license plate image processing model can optimize image restoration from multiple perspectives, achieving fine restoration of overexposed images and characters with overlapping strokes.
[0070] In this embodiment, degraded images and labeled images are generated based on sample license plate images, and the license plate image processing model is trained based on the degraded images and labeled images. This setup enables the trained license plate image processing model to handle license plate images in various complex environments in real-world situations. For example, it can restore license plate images that are overexposed or have overlapping character strokes to a normal state with normal character stroke thickness and no overlap, achieving good image quality restoration and providing clearer and more accurate image information for subsequent license plate recognition.
[0071] S130. Input the initial license plate image to be identified into the license plate image processing model to obtain the target license plate image to be identified output by the license plate image processing model, and perform license plate recognition based on the target license plate image to be identified.
[0072] The initial license plate image to be recognized refers to the image that needs to be identified. This initial image may be a license plate image of normal quality or a poor-quality image, such as one that is overexposed or has overlapping character strokes. The target license plate image to be recognized refers to the license plate image obtained by restoring the image quality of the initial license plate image through a license plate image processing model. The target license plate image has high image quality.
[0073] Understandably, in practice, environmental factors and algorithmic issues may cause image overexposure or character stroke adhesion, leading to inaccurate or even unrecognizable license plate recognition results. Therefore, in this embodiment, before performing license plate recognition on the initial license plate image, a step is added to restore the image quality of the initial license plate image using a license plate image processing model. This ensures that the obtained target license plate image has higher image quality, resulting in more accurate license plate recognition results.
[0074] License plate recognition can be achieved through a pre-set license plate recognition algorithm or a pre-trained license plate recognition model; this embodiment does not impose any restrictions on this.
[0075] In this embodiment, on the one hand, the degraded images and label images used for training the license plate image processing model are obtained by degrading sample license plate images to different degrees, and by optimizing the quality of sample license plate images, respectively. The training data has good diversity, richness, and representativeness. Therefore, the license plate image processing model has good image restoration performance. When the initial license plate image to be recognized has poor image quality, such as overexposure or stroke adhesion, the license plate image processing model can achieve a fine image quality restoration effect, thereby improving the robustness and accuracy of license plate recognition. On the other hand, when obtaining degraded images based on sample license plate images, a series of random processing is performed on the sample license plate images, including degraded images without degradation. This ensures that when the license plate image processing model is inferenced, if the initial license plate image to be recognized has normal image quality, it can maintain the normal character stroke width, thereby achieving an adaptive image quality restoration effect.
[0076] The technical solution of this invention processes sample license plate images to obtain degraded images and labeled images. A neural network model is trained based on the degraded and labeled images to obtain a license plate image processing model. This model is then used to process the initial license plate image to be recognized, resulting in a target license plate image. Finally, license plate recognition is performed based on the target license plate image. This solution solves the problem of poor image quality restoration in existing technologies for license plate images with overexposed fonts and overlapping strokes. It effectively restores the quality of license plate images, thereby improving the accuracy and robustness of license plate recognition.
[0077] Example 2
[0078] Figure 2 This is a flowchart of a license plate recognition method provided in Embodiment 2 of the present invention. Based on the above embodiments, the present invention further specifies the specific process of generating degraded images and label images, and adds a step of further suppressing black borders on the target license plate image to be recognized output by the license plate image processing model.
[0079] like Figure 2 As shown, the method includes:
[0080] S210. Determine the sample license plate image.
[0081] S220. Perform at least one of the following processing on the sample license plate image to obtain a degraded image: random dilation processing, random blur processing, random noise processing, and random brightness enhancement processing.
[0082] The above embodiments have described the specific process of determining the sample license plate image and the degraded image based on the sample license plate image, which will not be repeated here. This embodiment, based on the above embodiments, provides an implementation method for random dilation processing.
[0083] Furthermore, random dilation is applied to the sample license plate images to obtain degraded images, which can include:
[0084] A1. Determine the character width of the sample license plate image;
[0085] A2. Determine the range of values for the expansion kernel size based on the character width;
[0086] A3. Based on the pre-set number of dilation times, dilation kernel shape, probability of each dilation kernel shape, range of dilation kernel size values, and probability of each dilation kernel size value, the sample license plate image is randomly dilated to obtain a degraded image.
[0087] The specific method for determining the character width has been described in the above embodiments, and will not be repeated here.
[0088] Random dilation involves convolving the pixels of a sample license plate image with a dilation kernel of a specific structure or shape. Random dilation is achieved through this kernel. The kernel slides across the sample license plate image, comparing its value with the pixels in the sample image. If the pixel value at the center of the kernel coincides with the pixel value of a pixel in the sample license plate image, and at least one pixel in the kernel has a value of 1, then the corresponding pixel value is set to 1. In this way, random dilation can thicken the strokes of the characters in the sample license plate image.
[0089] In this embodiment, the value range of the dilation kernel size is determined based on the character width. Specifically, the value range of the dilation kernel size can be an integer [1, N]. The size of the dilation kernel starts from 1 (i.e., no dilation processing is applied to the sample license plate image). This setting ensures that the normal character stroke width remains unchanged during neural network model inference, thereby achieving an adaptive character stroke width restoration effect. The upper limit value N of the value range can be determined based on the character width. For example, different upper limit values N can be set for different character width ranges. For instance, a character width of [1, 3] px corresponds to N of 2, and a character width of [4, 7] px corresponds to N of 3. This embodiment does not impose any restrictions on this. Alternatively, the relationship between the character width and the upper limit value N can be limited by a mathematical formula. The larger the character width, the larger the corresponding upper limit value N. This embodiment does not restrict the specific form of the mathematical formula.
[0090] The number of dilation iterations refers to the number of times the sample license plate image is randomly dilated. The shape of the dilation kernel can include rectangles, circles, crosses, etc. Figure 3 A schematic diagram of the shape of the expanding core is provided, such as... Figure 3 As shown, when the expansion core size is 3*3, the shape of the expansion core can include square, cross, fork, horizontal, and vertical shapes, etc. The number of expansions and the shape of the expansion core can be preset.
[0091] In this embodiment, since the expansion kernel shape has various forms and the expansion kernel size has various values, corresponding probabilities can be preset for each form of the expansion kernel shape and each value of the expansion kernel size. The probabilities can be equal probabilities, for example, the probabilities of the five expansion kernel shapes can be [0.2, 0.2, 0.2, 0.2, 0.2], or differential probabilities, for example, the probabilities of the five expansion kernel shapes can be [0.4, 0.2, 0.1, 0.1, 0.2]. This embodiment does not limit the probability distribution of each expansion kernel shape and each expansion kernel size value.
[0092] In this embodiment, the random dilation operation sets the lower limit of the dilation kernel size to 1px and the upper limit based on the character stroke width. This allows the model to recover wider character strokes during subsequent inference while maintaining characters with normal widths, thus achieving adaptive character stroke width recovery. Furthermore, random dilation based on different kernel shapes and sizes enhances the diversity and richness of the degraded image, thereby improving the robustness and adaptability of the license plate image processing model.
[0093] S230. Perform black border suppression processing on the character edges of the sample license plate images, and / or normalize the character width of each sample license plate image to obtain a label image.
[0094] The above embodiments have described in detail the process of suppressing black borders at character edges and normalizing character width. Based on the above embodiments, this embodiment provides another specific implementation method for suppressing black borders at character edges and normalizing character width.
[0095] Furthermore, black border suppression processing on the character edges of the sample license plate images can include:
[0096] B1. Based on the high-frequency components of the current pixel in the sample license plate image, determine the high-frequency component index of the current pixel, whereby the high-frequency component index represents the probability that the current pixel is a high-frequency component.
[0097] B2. Determine the black high-frequency index of the current pixel based on the high-frequency component index of the current pixel. The black high-frequency index is used to represent the probability that the current pixel is a black high-frequency component.
[0098] B3. Determine the weighting of high-frequency components based on the black high-frequency index of the current pixel;
[0099] Among them, the larger the black high-frequency index, the smaller the weight of the high-frequency component superposition;
[0100] B4. Update the pixel value of the current pixel based on the low-frequency component, high-frequency component, and the weighted combination of the high-frequency components.
[0101] The current pixel is the pixel being processed in the sample license plate image. In this embodiment, each pixel in the sample license plate image is processed using the B1-B4 method to obtain the sample license plate image after suppressing the black borders of the characters.
[0102] Pixels containing high-frequency components typically exhibit large pixel value variations. For example, at the edges of a sample license plate image, pixel values change very rapidly from dark to light or vice versa; these edge regions correspond to high-frequency components. Therefore, in this embodiment, character edges in a sample license plate image can be detected by identifying the high-frequency components, facilitating subsequent black border suppression of these character edges.
[0103] In an optional embodiment, the high-frequency component of the current pixel can be determined by performing a Fourier transform on the sample license plate image to obtain the frequency domain image corresponding to the sample license plate image, using a high-pass filter to retain the high-frequency component and filter the low-frequency component in the frequency domain image to obtain each pixel corresponding to the high-frequency component, and then performing subsequent processing on each pixel corresponding to the high-frequency component.
[0104] In another optional embodiment, wavelet transform can be performed on the sample license plate image to obtain wavelet coefficients of different scales and directions. Wavelet coefficients of specific scales and directions are determined, and their corresponding pixels are used as pixels corresponding to high-frequency components. Then, each pixel corresponding to the high-frequency component is further processed.
[0105] In another optional embodiment, a frequency domain image corresponding to the sample license plate image can be obtained by performing a Fourier transform on the sample license plate image. The frequency domain image is then low-pass filtered to obtain the low-frequency components. Finally, the low-frequency components are subtracted from the frequency domain image to obtain the high-frequency components, and subsequent processing is performed on the pixels corresponding to the high-frequency components.
[0106] Specifically, the high-frequency components of the current pixel can be determined using the following formula: I(x, y) HMF=I(x,y)-I(x,y) LF Where I(x, y) represents the pixel value of the pixel at position (x, y) in the sample license plate image, with a value range of [0, 1.0]. HMF Let I(x, y) represent the high-frequency component of the pixel at position (x, y) in the sample license plate image. LF This represents the low-frequency component of the pixel at position (x,y) in the sample license plate image.
[0107] The high-frequency component index (HFFI) indicates the probability that the current pixel is a high-frequency component. The larger the HFFI, the closer the pixel value is to a high-frequency component. In other words, the higher the HFFI, the higher the probability that the pixel is a character edge.
[0108] In an optional embodiment, based on the high-frequency components of the current pixel in the sample license plate image, the high-frequency component index of the current pixel is determined. This allows for the determination of the maximum pixel value corresponding to each high-frequency component. The ratio of the high-frequency component value to the maximum pixel value of the current pixel is then used as the high-frequency component index. Specifically, this can be expressed by the following formula: Where max(I(x, y)) HMF Id(x, y) represents the maximum pixel value of the pixel corresponding to each high-frequency component. HMF It represents the high-frequency component index.
[0109] In another optional embodiment, based on the high-frequency components of the current pixel in the sample license plate image, the high-frequency component index of the current pixel is determined. This allows us to determine the minimum and maximum pixel values corresponding to each high-frequency component. The ratio of the difference between the high-frequency component value and the minimum pixel value of the current pixel to the difference between the maximum and minimum pixel values is used as the high-frequency component index. Specifically, this can be expressed by the following formula: Where, min(I(x,y)) HMF () indicates the minimum pixel value.
[0110] In another optional embodiment, the high-frequency component index of the current pixel is determined based on the high-frequency components of the current pixel in the sample license plate image. Furthermore, the mean and standard deviation of the pixel values corresponding to each high-frequency component can be determined, and the high-frequency component index is calculated based on the mean and standard deviation. Specifically, this can be expressed by the following formula: Where μ represents the mean pixel value of the pixel corresponding to each high-frequency component, and σ represents the standard deviation of the pixel value of the pixel corresponding to each high-frequency component.
[0111] The black high-frequency index, based on the high-frequency component index, further indicates the probability that the current pixel is a black high-frequency component. The higher the black high-frequency index, the greater the probability that the pixel is a black high-frequency component. In other words, the higher the black high-frequency index, the higher the probability that the pixel is a black edge on a character.
[0112] The black high-frequency index of the current pixel is determined based on the high-frequency component index of the current pixel. Specifically, it can be expressed by the following formula: Id(x,y) BMF =(I(x,y)-1) 2*n *Id(x,y) HMF Where, Id(x,y) BMF This represents the black high-frequency index of the current pixel. n is a positive integer greater than 1. The larger n is, the steeper the decreasing trend of the index in the range [0,1].
[0113] The high-frequency component superposition weight is used to indicate the intensity of high-frequency component folding for the current pixel value. The larger the black high-frequency index, the smaller the high-frequency component superposition weight. Understandably, a larger black high-frequency index indicates a higher probability that the pixel is a black edge of a character. In this case, a smaller high-frequency component superposition weight results in a weaker high-frequency component folding intensity, thus achieving a more significant black edge suppression effect.
[0114] In an optional embodiment, the weighting of the high-frequency components is determined based on the black high-frequency index of the current pixel, which can be expressed by the following formula: S(x,y)=1-Id(x,y) BMF , where S(x,y) represents the superposition weight of high-frequency components.
[0115] In another optional embodiment, different high-frequency component superposition weights can be set for different black high-frequency index intervals, and the high-frequency component superposition weights corresponding to the current pixel can be determined according to the interval where the black high-frequency index of the current pixel is located.
[0116] The pixel value of the current pixel is updated based on its low-frequency components, high-frequency components, and the weighted sum of the high-frequency components. This can be achieved by summing the products of the low-frequency components and the weighted sum of the high-frequency components, and using this sum as the new pixel value. Specifically, this can be expressed by the following formula: I(x, y)′=I(x, y) LF +S(x,y)*I(x,y) HMF .
[0117] In this embodiment, the probability of a pixel being a black edge of a character is represented by the black high-frequency index. Higher black high-frequency indices are assigned lower high-frequency component superposition weights, resulting in pixels with a higher probability of being a black edge having lower high-frequency component aliasing intensity and more significant black edge suppression. This achieves an adaptive black edge suppression effect, giving the label image good black edge suppression performance, thus making the image restoration effect of the license plate image processing model trained on the label image more natural and realistic.
[0118] Furthermore, normalizing the character width of each sample license plate image can also include:
[0119] C1. Determine the character width of each of the sample license plate images;
[0120] C2. If it is determined that the character width of the target sample license plate image is greater than or equal to a preset width threshold, then the target sample license plate image is subjected to erosion processing to obtain each of the sample license plate images after character width normalization.
[0121] The specific method for determining the character width of the sample license plate image has been described in the above embodiments, and will not be repeated here.
[0122] Different width thresholds can be set for different types of characters and different regions of the same character; this embodiment does not impose any restrictions on this. When the character width of the target sample license plate image is greater than or equal to the preset width threshold, since the sample license plate image itself is a license plate image with uniform lighting, normal exposure, no character strokes sticking together, and high clarity, the character stroke width can be directly refined through erosion operation.
[0123] Erosion is achieved through an erosion kernel. The kernel slides across the sample license plate image, comparing its value to pixels in the image. If the pixel value at the center of the kernel coincides with the pixel value of a pixel in the sample license plate image, and all pixel values in the kernel are 1, then the corresponding pixel value is set to 1. Otherwise, the value of the center pixel is set to 0. Taking a 3x3 square erosion kernel as an example, for a pixel in the sample license plate image, if its surrounding 3x3 area consists entirely of white pixels (1), then that pixel will remain white in the eroded image. If its surrounding 3x3 area contains one or more black pixels (0), then that pixel will become black in the eroded image. In this way, the erosion operation can thin the strokes of the characters in the sample license plate image.
[0124] Furthermore, the size of the erosion core can be determined based on the character stroke width. The number of erosions, the shape of the erosion core, the size of the erosion core, and the probabilities corresponding to the shape and size of the erosion core are all similar to the dilation operation, and will not be described in detail here.
[0125] In this embodiment, by performing an erosion operation on sample license plate images with excessively wide character strokes, the character stroke width is thinned, resulting in higher consistency in character width across all sample license plate images. This accelerates model convergence and improves the training speed of the license plate image processing model. Furthermore, the trained license plate image processing model, after reconstructing actual license plate images, exhibits more stable and normal character widths, thus enhancing the consistency and stability of the license plate image processing model.
[0126] S240. Using the degraded image and the label image, a pre-set neural network model is trained to obtain a license plate image processing model.
[0127] The above embodiments have described the specific process of using degraded images and labeled images as training data to train the neural network model, and this embodiment will not repeat it here.
[0128] S250. Input the initial license plate image to be recognized into the license plate image processing model to obtain the target license plate image to be recognized output by the license plate image processing model.
[0129] The above embodiments have described the specific process by which the license plate image processing model restores the image quality of the initial license plate image to obtain the target license plate image. This embodiment will not repeat the process here.
[0130] S260. Perform background color segmentation on the target license plate image to be identified to obtain a background color mask, and smooth the background color mask.
[0131] In this embodiment, after restoring the image quality of the initial license plate image to be identified through a license plate image processing model, an implementation method for further black border suppression of the target license plate image to be identified is provided.
[0132] Background color segmentation refers to the process of separating the main part of the target license plate image from the background color.
[0133] In an optional embodiment, the target license plate image to be identified is segmented by background color to obtain a background color mask. It is understood that license plates are usually blue or green, so the target license plate image to be identified can be binarized according to the color threshold range of the license plate background color in the RGB color space or the HSV (Hue Saturation Value) color space to obtain the background color mask M.
[0134] In another optional embodiment, the target license plate image is segmented by background color to obtain a background color mask. Alternatively, each pixel in the target license plate image can be converted into a color feature vector, and then these color feature vectors are clustered. Based on the clustering results, the color regions represented by each category are analyzed. Typically, the category to which the background color belongs can be determined by observing the color features of the cluster centers or examining the distribution of pixels within each category. The pixel values of the category to which the background color belongs are set to 1, and the pixel values of other categories are set to 0, thus obtaining the background color mask.
[0135] Smoothing the background mask can remove noise and jagged edges, making it smoother and more natural. Smoothing can be achieved by filtering the background mask, such as Gaussian filtering, median filtering, and bilateral filtering; or by applying erosion and dilation; or by performing opening and closing operations on the background mask.
[0136] Furthermore, opening and closing operations can be performed on the background mask for morphological smoothing. Specifically, opening operations can remove small noise and jagged edges from the background mask, while closing operations can fill small holes and gaps. Then, blurring can be applied to further smooth the edges of the background mask, achieving a better smoothing effect.
[0137] In this embodiment, by segmenting the background color of the target license plate image and smoothing the background color mask, black border suppression can be achieved simply and efficiently by replacing the background color area with the template color.
[0138] S270. Based on the smoothed background mask, perform image fusion between the target license plate image to be identified and the pre-set color template image to obtain the target license plate image after character black border suppression.
[0139] A color template image can refer to a solid color image with a defined color, such as a solid blue image. Specifically, the smoothed background mask can be used as a fusion weight to perform pixel-by-pixel fusion of the target license plate image and the color template image. This can be expressed by the following formula: I final (x,y)=I(x,y)*M blur (x,y)+T(x,y)*(1-M blur (x,y)), where (x,y) represents the pixel position in the image, I final (x,y) represents the pixel value of the target license plate image at position (x,y) after character black border suppression, M blur (x,y) represents the smoothed background mask value at position (x,y), and T(x,y) represents the pixel value of the color template image at position (x,y).
[0140] In this embodiment, pixel-by-pixel fusion based on the smoothed background mask can more finely control the transition between the target license plate image to be identified and the color template image, making the fused target license plate image to be identified look more natural and realistic. This can further optimize the image effect of the license plate image to be identified, thereby making the subsequent license plate recognition more accurate.
[0141] S280. Perform license plate recognition based on the target license plate image.
[0142] The specific process of license plate recognition based on the target license plate image has been described in the above embodiments, and will not be repeated here.
[0143] The technical solution in this embodiment generates degraded images by performing a series of random operations on sample license plate images. This simulates license plate images with poor image quality in real-world scenarios, such as overexposure or overlapping character strokes. It fully considers the diversity and complexity of interference factors, ensuring the richness and representativeness of the training data. By suppressing black borders and normalizing character widths in the sample license plate images, label images with better image quality, no or minimal black borders, and high consistency in character width are obtained. The license plate image processing model trained based on the degraded and label images can restore overexposed or overlapping license plate images to a normal state with consistent character stroke thickness and no overlap, achieving good image quality restoration and providing clearer and more accurate image information for subsequent license plate recognition. After the license plate image processing model processes the initial license plate image to obtain the target license plate image, it further fuses the target license plate image and the color template image through a smoothed background mask. This achieves simple and efficient black border suppression, optimizes the image effect of the license plate image, and makes subsequent license plate recognition more accurate.
[0144] Example 3
[0145] Figure 4 This is a schematic diagram of the structure of a license plate recognition device provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes:
[0146] The degraded image and label image determination module 310 is used to determine the sample license plate image and generate a degraded image and a label image based on the sample license plate image;
[0147] The license plate image processing model determination module 320 is used to train a pre-set neural network model using the degraded image and the label image to obtain a license plate image processing model.
[0148] The license plate recognition module 330 is used to input an initial license plate image to be recognized into the license plate image processing model to obtain a target license plate image to be recognized output by the license plate image processing model, and to perform license plate recognition based on the target license plate image.
[0149] The technical solution of this invention processes sample license plate images to obtain degraded images and labeled images. A neural network model is trained based on the degraded and labeled images to obtain a license plate image processing model. This model is then used to process the initial license plate image to be recognized, resulting in a target license plate image. Finally, license plate recognition is performed based on the target license plate image. This solution solves the problem of poor image quality restoration in existing technologies for license plate images with overexposed fonts and overlapping strokes. It effectively restores the quality of license plate images, thereby improving the accuracy and robustness of license plate recognition.
[0150] Based on the above embodiments, optionally, the degraded image and label image determination module 310 includes:
[0151] The degraded image determination unit is used to perform at least one of the following processes on the sample license plate image to obtain a degraded image: random dilation processing, random blur processing, random noise processing, and random brightness enhancement processing.
[0152] Based on the above embodiments, optionally, the degraded image determination unit is specifically used for:
[0153] Determine the character width of the sample license plate image;
[0154] Based on the character width, determine the range of values for the expansion kernel size;
[0155] Based on the pre-set number of dilation times, dilation kernel shape, probability of each dilation kernel shape, range of dilation kernel size values, and probability of each dilation kernel size value, the sample license plate image is randomly dilated to obtain a degraded image.
[0156] Based on the above embodiments, optionally, the degraded image and label image determination module 310 includes:
[0157] The label image determination unit is used to perform black border suppression processing on the character edges of the sample license plate images, and / or to normalize the character width of each sample license plate image to obtain a label image.
[0158] Based on the above embodiments, optionally, the label image determining unit is specifically used for:
[0159] Based on the high-frequency components of the current pixel in the sample license plate image, the high-frequency component index of the current pixel is determined, and the high-frequency component index is used to represent the probability that the current pixel is a high-frequency component.
[0160] Based on the high-frequency component index of the current pixel, the black high-frequency index of the current pixel is determined, and the black high-frequency index is used to represent the probability that the current pixel is a black high-frequency component.
[0161] The weighting of high-frequency components is determined based on the black high-frequency index of the current pixel.
[0162] Among them, the larger the black high-frequency index, the smaller the weight of the high-frequency component superposition;
[0163] The pixel value of the current pixel is updated based on the low-frequency component, high-frequency component, and the weighted combination of the high-frequency components.
[0164] Based on the above embodiments, optionally, the label image determining unit is specifically used for:
[0165] Determine the character width of each of the sample license plate images;
[0166] If it is determined that the character width of the target sample license plate image is greater than or equal to a preset width threshold, then the target sample license plate image is subjected to erosion processing to obtain each sample license plate image after character width normalization.
[0167] Optionally, based on the above embodiments, the apparatus further includes:
[0168] The background color mask determination module is used to perform background color segmentation on the target license plate image to be identified, obtain the background color mask, and perform smoothing processing on the background color mask;
[0169] The black border suppression module for the target license plate image is used to perform image fusion between the target license plate image and a pre-set color template image based on the smoothed background color mask, so as to obtain the target license plate image after character black border suppression.
[0170] The license plate recognition device provided in this embodiment of the invention can execute the license plate recognition method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.
[0171] Example 4
[0172] Figure 5A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0173] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0174] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0175] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as license plate recognition methods.
[0176] In some embodiments, the license plate recognition method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the license plate recognition method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the license plate recognition method by any other suitable means (e.g., by means of firmware).
[0177] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0178] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0179] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0180] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0181] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0182] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0183] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0184] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A license plate recognition method, characterized in that, include: Determine the sample license plate image, and generate a degraded image and a label image based on the sample license plate image; The degraded image and the labeled image are used to train a pre-set neural network model to obtain a license plate image processing model. An initial license plate image to be identified is input into the license plate image processing model to obtain the target license plate image to be identified output by the license plate image processing model, and license plate recognition is performed based on the target license plate image to be identified.
2. The method according to claim 1, characterized in that, Based on the sample license plate image, a degraded image is generated, including: The sample license plate image is subjected to at least one of the following processing methods to obtain a degraded image: random dilation processing, random blur processing, random noise processing, and random brightness enhancement processing.
3. The method according to claim 3, characterized in that, The sample license plate image is subjected to random dilation to obtain a degraded image, including: Determine the character width of the sample license plate image; Based on the character width, determine the range of values for the expansion kernel size; Based on the pre-set number of dilation times, dilation kernel shape, probability of each dilation kernel shape, range of dilation kernel size values, and probability of each dilation kernel size value, the sample license plate image is randomly dilated to obtain a degraded image.
4. The method according to claim 1, characterized in that, Based on the sample license plate image, a label image is generated, including: The character edges of the sample license plate images are suppressed by black borders, and / or the character widths of each sample license plate image are normalized to obtain a label image.
5. The method according to claim 4, characterized in that, The black border suppression processing for the character edges of the sample license plate images includes: Based on the high-frequency components of the current pixel in the sample license plate image, the high-frequency component index of the current pixel is determined, and the high-frequency component index is used to represent the probability that the current pixel is a high-frequency component. Based on the high-frequency component index of the current pixel, the black high-frequency index of the current pixel is determined, and the black high-frequency index is used to represent the probability that the current pixel is a black high-frequency component. The weighting of high-frequency components is determined based on the black high-frequency index of the current pixel. Among them, the larger the black high-frequency index, the smaller the weight of the high-frequency component superposition; The pixel value of the current pixel is updated based on the low-frequency component, high-frequency component, and the weighted combination of the high-frequency components.
6. The method according to claim 4, characterized in that, The character width of each of the sample license plate images is normalized, including: Determine the character width of each of the sample license plate images; If it is determined that the character width of the target sample license plate image is greater than or equal to a preset width threshold, then the target sample license plate image is subjected to erosion processing to obtain each sample license plate image after character width normalization.
7. The method according to claim 1, characterized in that, After obtaining the target license plate image output by the license plate image processing model, the process further includes: The background color of the target license plate image to be identified is segmented to obtain a background color mask, and the background color mask is then smoothed. Based on the smoothed background mask, the target license plate image to be identified is fused with a pre-set color template image to obtain the target license plate image after character black border suppression.
8. A license plate recognition device, characterized in that, include: A degraded image and label image determination module is used to determine a sample license plate image and generate a degraded image and a label image based on the sample license plate image; The license plate image processing model determination module is used to train a pre-set neural network model using the degraded image and the label image to obtain the license plate image processing model. The license plate recognition module is used to input an initial license plate image to be recognized into the license plate image processing model to obtain a target license plate image to be recognized output by the license plate image processing model, and to perform license plate recognition based on the target license plate image.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the license plate recognition method as described in any one of claims 1-7.
10. A storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the license plate recognition method as described in any one of claims 1-7.