CN117253217A - Charging station vehicle identification method and device, electronic equipment and storage medium - Google Patents
Charging station vehicle identification method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117253217A CN117253217A CN202311467278.5A CN202311467278A CN117253217A CN 117253217 A CN117253217 A CN 117253217A CN 202311467278 A CN202311467278 A CN 202311467278A CN 117253217 A CN117253217 A CN 117253217A
- Authority
- CN
- China
- Prior art keywords
- image
- module
- license plate
- vehicle
- charging station
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 49
- 238000001514 detection method Methods 0.000 claims abstract description 28
- 230000007246 mechanism Effects 0.000 claims description 44
- 238000012549 training Methods 0.000 claims description 41
- 238000012545 processing Methods 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 11
- 230000006870 function Effects 0.000 claims description 11
- 238000011176 pooling Methods 0.000 claims description 11
- 239000013598 vector Substances 0.000 claims description 11
- 238000002372 labelling Methods 0.000 claims description 10
- 238000010606 normalization Methods 0.000 claims description 10
- 238000003064 k means clustering Methods 0.000 claims description 9
- 238000007781 pre-processing Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 7
- 238000012795 verification Methods 0.000 claims description 7
- 230000004913 activation Effects 0.000 claims description 6
- 230000004927 fusion Effects 0.000 claims description 6
- 230000006872 improvement Effects 0.000 claims description 5
- 238000005070 sampling Methods 0.000 claims description 5
- 230000017105 transposition Effects 0.000 claims description 4
- 230000002708 enhancing effect Effects 0.000 claims description 2
- 238000005286 illumination Methods 0.000 abstract description 10
- 230000008569 process Effects 0.000 description 17
- 238000010586 diagram Methods 0.000 description 16
- 230000009471 action Effects 0.000 description 3
- 238000012544 monitoring process Methods 0.000 description 3
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000008014 freezing Effects 0.000 description 2
- 238000007710 freezing Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- HWKQNAWCHQMZHK-UHFFFAOYSA-N trolnitrate Chemical compound [O-][N+](=O)OCCN(CCO[N+]([O-])=O)CCO[N+]([O-])=O HWKQNAWCHQMZHK-UHFFFAOYSA-N 0.000 description 2
- 229960002485 trolnitrate Drugs 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000000137 annealing Methods 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003014 reinforcing effect Effects 0.000 description 1
- 238000011524 similarity measure Methods 0.000 description 1
- 238000010257 thawing Methods 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/50—Context or environment of the image
- G06V20/56—Context or environment of the image exterior to a vehicle by using sensors mounted on the vehicle
- G06V20/58—Recognition of moving objects or obstacles, e.g. vehicles or pedestrians; Recognition of traffic objects, e.g. traffic signs, traffic lights or roads
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/094—Adversarial learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/80—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
- G06V10/806—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/62—Text, e.g. of license plates, overlay texts or captions on TV images
- G06V20/625—License plates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V2201/00—Indexing scheme relating to image or video recognition or understanding
- G06V2201/08—Detecting or categorising vehicles
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Medical Informatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Databases & Information Systems (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the application provides a charging station vehicle identification method, a charging station vehicle identification device, electronic equipment and a storage medium, and relates to the technical field of image detection. The method includes acquiring a vehicle image; identifying the vehicle image by using an improved Yolov4 model to obtain a vehicle type and a license plate position; intercepting a license plate image to be identified by utilizing the license plate position; image enhancement is carried out on the license plate image by utilizing an EnLightGAN-based image enhancement algorithm; recognizing the license plate image after image enhancement by utilizing a character recognition algorithm to obtain a recognition result; according to the method, license plate positioning is performed based on an improved Yolov4 model, then the Enlight model is utilized to strengthen license plate image information, image recognition accuracy is improved, real-time recognition of license plates under complex scenes such as different illumination conditions and angle changes can be achieved, and the problems that the existing method is high in detection difficulty and long in detection time are solved.
Description
Technical Field
The present disclosure relates to the field of image detection technologies, and in particular, to a charging station vehicle identification method, a charging station vehicle identification device, an electronic device, and a storage medium.
Background
In the complex environment of the charging station, there are many interference factors, such as illumination change, weather conditions, background clutter, and the like, which affect the accuracy and stability of image recognition. Especially during peak hours, charging stations may have a large amount of vehicle and personnel activity, increasing the difficulty of image processing and analysis. In addition, in a charging station environment, the real-time monitoring has higher requirements, the calculated amount of the existing identification model is larger and larger, and the longer the detection feedback time is, the detection requirement of the real-time monitoring cannot be met.
Disclosure of Invention
An object of the embodiment of the application is to provide a charging station vehicle identification method, a device, electronic equipment and a storage medium, which are used for license plate positioning based on an improved Yolov4 model, and then reinforcing license plate image information by utilizing an Enlight model, so that the image identification accuracy is improved, and the real-time identification of license plates under complex scenes such as different illumination conditions, angle changes and the like can be realized, thereby solving the problems of high detection difficulty and long detection time of the existing method.
The embodiment of the application provides a charging station vehicle identification method, which comprises the following steps:
acquiring a vehicle image;
identifying the vehicle image by using an improved Yolov4 model to obtain a vehicle type and a license plate position;
intercepting a license plate image to be identified by utilizing the license plate position;
image enhancement is carried out on the license plate image by utilizing an EnLightGAN-based image enhancement algorithm;
and recognizing the license plate image after image enhancement by using a character recognition algorithm to obtain a recognition result.
In the implementation process, based on the improved Yolov4 vehicle identification positioning method, the type of the vehicle is identified by training a Yolov4 model, the license plate position is obtained, and then license plate image information is intercepted; the license plate image information is enhanced through the Enlight model, and finally the license plate information is acquired through OCR according to a character recognition algorithm, so that the license plate recognition accuracy is improved, the real-time recognition of the license plate under complex scenes such as different illumination conditions, angle changes and the like can be realized, and the problems of high detection difficulty and long detection time of the existing method are solved.
Further, before the step of identifying the vehicle image using the improved Yolov4 model, the method further comprises:
acquiring a vehicle image data set and labeling and classifying the vehicle image based on the vehicle type;
preprocessing the vehicle image to adjust the brightness and the size of the vehicle image, and dividing the vehicle image data set into a training set and a verification set;
resetting an Anchor value to preliminarily locate the license plate position by using a K-means clustering algorithm;
adding an attention mechanism module in a Yolov4 target detection algorithm model framework to obtain an improved Yolov4 model;
the improved Yolov4 model was trained.
In the implementation process, the Anchor value is reset, the initial positioning of the license plate position is realized, and the attention mechanism module is added in the YOLOv4 target detection algorithm model frame, so that the weighted feature vector is obtained, the model can selectively focus key information, the license plate position is further positioned, and the accuracy of the recognition result is improved.
Further, the resetting the Anchor value to perform preliminary positioning on the license plate position by using a K-means clustering algorithm includes:
extracting data corresponding to the size of the marked anchor frame in the vehicle image, and carrying out normalization processing to obtain an initialization data point;
randomly selecting K prediction frames as initial Anchor values;
calculating the distance from the data point corresponding to the prediction frame to the center point;
categorizing the data points into cluster centers nearest thereto based on the distance;
updating the position of the center point, and recalculating the distance from the center point until the position of the center point is not changed;
and calculating the average value of the K prediction frames, and taking the average value result as a reset Anchor value.
In the implementation process, the Anchor value is reset, and the accuracy of the Anchor value is ensured by updating and iterating.
Further, the adding an attention mechanism module in the YOLOv4 target detection algorithm model framework to obtain an improved YOLOv4 model includes:
before feature fusion of the PANet network, an attention mechanism module is added after convolution of a block_body (52,52,256) x 8 module and a block_body (26,26,256) x 8 module respectively so as to add attention weight to the input image feature vector.
In the implementation process, attention weight is added to the feature vectors through the attention mechanism adding module to represent the importance degrees of different feature vectors, and the model can focus on key information through weighting, so that the attention to irrelevant information is reduced.
Further, before the step of image enhancing the license plate image using the EnlightGAN based image enhancement algorithm, the method further comprises training the EnlightGAN based image enhancement algorithm:
acquiring a training image;
adding an attention mechanism module under a maximum pooling layer to construct a U-net generator network, wherein the attention mechanism module comprises global average pooling, a full connection layer, an activation function and Sigmoid;
inputting the training image into an attention mechanism module to perform image up-sampling, and fusing an output image with the image processed by the third convolution module;
and sequentially decoding the output image through a first attention module, a second attention module and a third attention module, sequentially performing transposition convolution and convolution modules, fusing the image passing through the first attention module with the image passing through the second convolution module, fusing the image passing through the second attention module with the image passing through the first convolution module, fusing the image passing through the attention mechanism module with the image passing through the third convolution module, and generating the image enhanced by EnLightGAN.
In the implementation process, image enhancement is realized through image fusion, so that the problem that the recognition accuracy is reduced due to the fact that license plate image quality is possibly poor due to the influence of factors such as illumination conditions and angle change is solved.
The embodiment of the application also provides a charging station vehicle identification device, which comprises:
the image acquisition module is used for acquiring vehicle images;
the license plate positioning module is used for identifying the vehicle image by utilizing the improved Yolov4 model to obtain the vehicle type and the license plate position;
the image intercepting module is used for intercepting license plate images to be identified by utilizing the license plate positions;
the image enhancement module is used for carrying out image enhancement on the license plate image by utilizing an EnLightGAN-based image enhancement algorithm;
and the recognition module is used for recognizing the license plate image after the image enhancement by utilizing a character recognition algorithm to obtain a recognition result.
In the implementation process, based on the improved Yolov4 vehicle identification positioning method, the type of the vehicle is identified by training a Yolov4 model, the license plate position is obtained, and then license plate image information is intercepted; the license plate image information is enhanced through the Enlight model, and finally the license plate information is acquired through OCR according to a character recognition algorithm, so that the license plate recognition accuracy is improved, the real-time recognition of the license plate under complex scenes such as different illumination conditions, angle changes and the like can be realized, and the problems of high detection difficulty and long detection time of the existing method are solved.
Further, the apparatus further comprises:
the labeling module is used for acquiring a vehicle image data set and labeling and classifying the vehicle image based on the vehicle type;
the preprocessing module is used for preprocessing the vehicle image to adjust the brightness and the size of the vehicle image and dividing the vehicle image data set into a training set and a verification set;
the preliminary positioning module is used for resetting the Anchor value so as to perform preliminary positioning on the license plate position by using a K-means clustering algorithm;
the model improvement module is used for adding an attention mechanism module in the Yolov4 target detection algorithm model framework so as to obtain an improved Yolov4 model;
and the training module is used for training the improved Yolov4 model.
In the implementation process, the Anchor value is reset, the initial positioning of the license plate position is realized, and the attention mechanism module is added in the YOLOv4 target detection algorithm model frame, so that the weighted feature vector is obtained, the model can selectively focus key information, the license plate position is further positioned, and the accuracy of the recognition result is improved.
Further, the preliminary positioning module includes:
the normalization processing module is used for extracting data corresponding to the size of the marked anchor frame in the vehicle image, and carrying out normalization processing to obtain initialized data points;
the initialization module is used for randomly selecting K prediction frames as initial Anchor values;
the distance calculation module is used for calculating the distance from the data point corresponding to the prediction frame to the center point;
a categorizing module for categorizing the data points into cluster centers nearest thereto based on the distance;
the updating module is used for updating the position of the center point and recalculating the distance from the center point until the position of the center point is not changed;
and the average value calculation module is used for calculating the average value of the K prediction frames and taking the average value result as a reset Anchor value.
In the implementation process, the Anchor value is reset, and the accuracy of the Anchor value is ensured by updating and iterating.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor runs the computer program to enable the electronic equipment to execute the charging station vehicle identification method.
The embodiment of the application also provides a readable storage medium, wherein the readable storage medium stores computer program instructions, and when the computer program instructions are read and run by a processor, the method for identifying the charging station vehicle is executed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a charging station vehicle identification method provided in an embodiment of the present application;
fig. 2 is a specific flowchart of license plate detection provided in an embodiment of the present application;
FIG. 3 is a flowchart of an improved Yolov4 model training process provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of an attention mechanism module according to an embodiment of the present application;
fig. 5 is a flowchart of an embodiment of the present application for resetting an Anchor value;
FIG. 6 is a flowchart of a specific implementation of a clustering algorithm provided in an embodiment of the present application;
fig. 7 is an enchtgan model training flowchart provided in an embodiment of the present application;
FIG. 8 is a schematic diagram of an attention mechanism module according to an embodiment of the present disclosure;
fig. 9 is a schematic diagram of an enchtgan model provided in an embodiment of the present application;
fig. 10 is a block diagram of a charging station vehicle identification apparatus according to an embodiment of the present application;
fig. 11 is a block diagram of another charging station vehicle identification apparatus according to an embodiment of the present application.
Icon:
100-an image acquisition module; 110-a labeling module; 120-a pretreatment module; 130-a preliminary positioning module; 131-normalizing the processing module; 132-initializing a module; 133-a distance calculation module; 134-a classification module; 135-update module; 136-a mean calculation module; 140-a model improvement module; 150-a training module; 200-license plate positioning module; 300-an image intercepting module; 310-EnLightGAN model training module; 400-an image enhancement module; 500-an identification module.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a charging station vehicle identification method according to an embodiment of the present application.
The method specifically comprises the following steps:
step S100: acquiring a vehicle image;
specifically, the captured image data is processed through the image captured by the camera in real time, so that the position and license plate information of the vehicle are automatically identified.
Step S200: identifying the vehicle image by using an improved Yolov4 model to obtain a vehicle type and a license plate position;
the output recognition result comprises vehicle position information, vehicle type and license plate position information.
Step S300: intercepting a license plate image to be identified by utilizing the license plate position;
step S400: image enhancement is carried out on the license plate image by utilizing an EnLightGAN-based image enhancement algorithm;
license plate identification is an important task in the fields of vehicle monitoring, traffic management and the like. However, due to the influence of factors such as illumination conditions, angle variation, etc., license plate image quality may be poor, resulting in degradation of recognition accuracy. Therefore, there is a need for a method that can improve license plate image quality and improve recognition accuracy, which can be achieved using the enchtgan-based image enhancement algorithm.
Step S500: and recognizing the license plate image after image enhancement by using a character recognition algorithm to obtain a recognition result.
Fig. 2 is a specific flowchart of license plate detection. The method for identifying the license plate mainly comprises two parts, wherein the first part is a vehicle identification positioning method based on Yolov4, the type and the position of the vehicle are identified by training a Yolov4 model, the position of the license plate is obtained, and then license plate image information is intercepted; the second part is to strengthen license plate image information through the Enlight model, and finally obtain license plate information according to the OCR.
And acquiring the real-time field condition of the charging pile through an image acquisition system, and performing license plate positioning and extraction on the enhanced image by using a YOLOv4 target detection algorithm to acquire license plate position information. And (3) applying a character recognition algorithm OCR to the extracted license plate image, recognizing the license plate number, and outputting a recognition result including the license plate number, the license plate color and whether the license plate is charged or not.
As shown in fig. 3, to improve the Yolov4 model training flowchart, before step S200, the method further includes:
step S110: acquiring a vehicle image data set and labeling and classifying the vehicle image based on the vehicle type;
for example, a data set BIT-Vehicle may be employed, which has 9850 pieces of Vehicle image data in total, and labels and classifies vehicles in the image, and is divided into three main types of vehicles: passenger cars, coaches, SUVs.
Step S120: preprocessing the vehicle image to adjust the brightness and the size of the vehicle image, and dividing the vehicle image data set into a training set and a verification set;
specifically, the vehicle image is scaled, cut and brightness adjusted in different proportions, for example, the vehicle image is set as 618 x 618, the richness of the image is enhanced, and the vehicle image data set is further processed according to 9: the scale of 1 is divided into training and validation sets.
Step S130: resetting an Anchor value to preliminarily locate the license plate position by using a K-means clustering algorithm;
step S140: adding an attention mechanism module in a Yolov4 target detection algorithm model framework to obtain an improved Yolov4 model;
specifically: before feature fusion of the PANet network, an attention mechanism module is added after convolution of a block_body (52,52,256) x 8 module and a block_body (26,26,256) x 8 module respectively so as to add attention weight to the input image feature vector.
As shown in fig. 4, a schematic diagram of the attention mechanism module is provided, and the main purpose of the attention mechanism module is to enable the model to dynamically pay attention to the most relevant and important parts in the input data when processing the input data, so as to improve the expressive power and generalization power of the model.
Firstly, inputting training images, extracting image features through a backlight module, and secondly, calculating the input feature vectors through an attention mechanism to generate attention weights, wherein the attention weights represent the importance degrees of different feature vectors, so that weighted feature vectors are obtained. Finally, the weighted feature vectors are fused (step S330). The attention mechanism module enables the model to selectively focus on key information by weighting different portions of the input data, reducing attention to extraneous information.
In the PANet network of YOLOv4 model, two CBAM modules (attention mechanism modules) are added at positions before feature fusion. Specifically:
the position before feature fusion in the PANet network is found, and a CBAM module is added after the convolution of a Resblock_body (52,52,256) x 8 module and a Resblock_body (26,26,256) x 8 module respectively. Two CBAM modules are respectively connected to the backbone feature of the network and each of the branch features in the PANet network. The CBAM module is connected to the feature map using a confcate or the like operation.
Step S150: the improved Yolov4 model was trained.
For example, the oubang diagram system may be used as an experimental operating system, the graphic card is two pieces of english-weida 2080, the memory is 64gb, and the cuda version is 12.1. The YOLOv4 model was constructed using the pythoch deep learning framework, with python version 3.8 and pythoch version 1.7.
The size of the input picture set by the experiment is 608 x 608, and the training process is divided into two stages:
the first stage: freezing the network weight parameters of the first 431 layers of the network, namely a Backbone part, setting the model parameters of the first 50 epochs for freezing and training, and fine-tuning the parameters of the SPP and PANet network layers in the training process. The model learning rate was set to 0.001, the Batchsize was set to 8, and its parameters were optimized using an Adam optimizer, and the weight decay weight was set to 5e-4. The learning rate adjustment strategy adopts a cosine annealing attenuation strategy, wherein T_max (int) is set to be 5, namely, the learning rate is reset after 5 epochs, eta_min (float) is set to be 1e-5, namely, the learning rate is reduced to 1e-5 in one period.
And a second stage: thawing the network backhaul part, setting the learning rate to 0.0001, the batch size to 4, and setting the weight decay weight to 5e-4 by using an Adam optimizer. With the cosine anneal decay strategy, T_max (int) is set to 5 and eta_min (float) is set to 1e-5.
In the whole training process, num_worker is set to 2, namely, training is performed simultaneously by adopting double GPUs, and label_smoothening is set to 0.01. In order to improve model accuracy, mosaic data enhancement is performed on training set samples, and random mosaic enhancement is not performed on the verification set.
As shown in fig. 5, the step S130 specifically includes the following steps:
step S131: extracting data corresponding to the size of the marked anchor frame in the vehicle image, and carrying out normalization processing to obtain an initialization data point;
specifically, as shown in fig. 6, a flowchart of a specific implementation of the clustering algorithm is shown. In order to adapt to the size of each type of vehicle anchor frame in the image, extracting image data corresponding to the anchor frame size in all image annotation data, and carrying out normalization initialization processing on the data so that the pixel value is between 0 and 1.
Step S132: randomly selecting K prediction frames as initial Anchor values;
step S133: calculating the distance from the data point corresponding to the prediction frame to the center point;
step S134: categorizing the data points into cluster centers nearest thereto based on the distance;
step S135: updating the position of the center point, and recalculating the distance from the center point until the position of the center point is not changed;
taking the Anchor value as the clustering number value of classification, namely, K=9, and randomly selecting 9 prediction frames as initial Anchor values; calculating the interval from the prediction frame value to the center point by taking the similarity measure as a calculation standard, and distributing each initialized data point to the cluster center nearest to the data point; the center point position is then updated based on the assigned data points recomputed and iterated until no more changes in the position of the center point occur.
Step S136: and calculating the average value of the K prediction frames, and taking the average value result as a reset Anchor value.
Because the initial point of the K-means clustering algorithm is random, the calculated results are inconsistent each time, in order to ensure the reliability of the finally selected Anchor value, a mean value method is adopted to process, the average value is taken for the 9 groups of different calculated results calculated randomly, the average value result is taken as the reset Anchor value, and the Anchor value can be specifically expressed as:
wherein x and y represent coordinate values corresponding to the prediction frame; n represents the number of prediction frames.
As shown in fig. 7, which is an enlight gan model training flowchart, before step S400, the method further includes:
step S310: acquiring a training image;
for example, an image acquisition module may be mounted above the charging stake to acquire captured vehicle images.
Step S320: adding an attention mechanism module under a maximum pooling layer to construct a U-net generator network, wherein the attention mechanism module comprises global average pooling, a full connection layer, an activation function and Sigmoid;
constructing a generator network: the application adopts a U-net network structure to construct a generator, and adds an attention mechanism module below a corresponding maximum pooling layer, as shown in fig. 8, which is a specific schematic diagram of the attention mechanism module. The attention mechanism module consists of global average pooling, a full connection layer, an activation function ReLU and Sigmoid. The image is output after being fused with the original image after passing through the attention mechanism module, and is output after being processed by the convolution and activation function ReLU for two times.
Step S330: inputting the training image into an attention mechanism module to perform image up-sampling, and fusing an output image with the image processed by the third convolution module;
step S340: and sequentially decoding the output image through a first attention module, a second attention module and a third attention module, sequentially performing transposition convolution and convolution modules, fusing the image passing through the first attention module with the image passing through the second convolution module, fusing the image passing through the second attention module with the image passing through the first convolution module, fusing the image passing through the attention mechanism module with the image passing through the third convolution module, and generating the image enhanced by EnLightGAN.
As shown in fig. 9, which is a schematic diagram of the EnlightGAN model, after an image passes through the attention mechanism module, the image is respectively processed by the maximum pooling and attention mechanism module to complete up-sampling of the image, so as to obtain 1024 x 3 data blocks, and according to the structural characteristics of the U-net network, the up-sampled image needs to be decoded, and the decoding needs to be completed after being processed by the three transpose convolution and convolution modules.
Specifically, in order to better complete the decoding process, the image passing through the second attention module is fused with the image passing through the first convolution module, the image passing through the first attention module is fused with the image passing through the second convolution module, the image passing through the attention mechanism is fused with the image passing through the third convolution module, and the image enhanced by the EnLightGAN network is generated after the completion.
After the image enhancement function of the image enhancement algorithm based on EnLightGAN, the image quality can be improved: through preprocessing and image enhancement of EnLightGAN algorithm, noise and illumination can be removed, quality of license plate images is improved, and recognition effect is enhanced.
Improving recognition accuracy: the enhanced image is clearer and clearer, which is helpful for the target detection and character recognition algorithm to accurately extract license plate information and improve recognition accuracy.
The adaptability is strong: the method can be suitable for license plate recognition tasks under complex scenes such as different illumination conditions, angle changes and the like.
Optimizing system performance: through image enhancement, the performance of the whole license plate recognition system can be improved, and the processing speed and accuracy are improved.
Example 2
An embodiment of the present application provides a charging station vehicle identification device, which is applied to the charging station vehicle identification method described in embodiment 1, and as shown in fig. 10, is a structural block diagram of the charging station vehicle identification device, and the device includes, but is not limited to:
an image acquisition module 100 for acquiring a vehicle image;
the license plate positioning module 200 is used for identifying the vehicle image by utilizing the improved Yolov4 model to obtain the vehicle type and the license plate position;
the image intercepting module 300 is used for intercepting license plate images to be identified by utilizing the license plate positions;
the image enhancement module 400 is configured to perform image enhancement on the license plate image by using an image enhancement algorithm based on EnlightGAN;
the recognition module 500 is configured to recognize the license plate image after image enhancement by using a character recognition algorithm, so as to obtain a recognition result.
As shown in fig. 11, there is shown a block diagram of another charging station vehicle identification apparatus, the apparatus further comprising:
the labeling module 110 is used for acquiring a vehicle image data set and labeling and classifying the vehicle image based on the vehicle type;
a preprocessing module 120, configured to preprocess the vehicle image to adjust brightness and size of the vehicle image, and divide the vehicle image dataset into a training set and a verification set;
the preliminary positioning module 130 is used for resetting the Anchor value so as to perform preliminary positioning on the license plate position by using a K-means clustering algorithm;
a model improvement module 140 for adding an attention mechanism module to the YOLOv4 object detection algorithm model framework to obtain an improved YOLOv4 model;
a training module 150, configured to train the improved Yolov4 model.
Wherein, preliminary positioning module 130 includes:
the normalization processing module 131 is configured to extract data corresponding to the size of the anchor frame of the label in the vehicle image, and perform normalization processing to obtain an initialized data point;
an initialization module 132, configured to randomly select K prediction frames as an initial Anchor value;
a distance calculating module 133, configured to calculate a distance from a data point corresponding to the prediction frame to a center point;
a categorizing module 134 for categorizing the data points into cluster centers nearest thereto based on the distance;
an updating module 135, configured to update the position of the center point, and recalculate the distance to the center point until the position of the center point is no longer changed;
the average calculating module 136 is configured to calculate an average of the K prediction frames, and take the average result as a reset Anchor value.
The apparatus further comprises an enchtgan model training module 310 for training an enchtgan-based image enhancement algorithm:
acquiring a training image;
adding an attention mechanism module under a maximum pooling layer to construct a U-net generator network, wherein the attention mechanism module comprises global average pooling, a full connection layer, an activation function and Sigmoid;
inputting the training image into an attention mechanism module to perform image up-sampling, and fusing an output image with the image processed by the third convolution module;
and sequentially decoding the output image through a first attention module, a second attention module and a third attention module, sequentially performing transposition convolution and convolution modules, fusing the image passing through the first attention module with the image passing through the second convolution module, fusing the image passing through the second attention module with the image passing through the first convolution module, fusing the image passing through the attention mechanism module with the image passing through the third convolution module, and generating the image enhanced by EnLightGAN.
Based on the improved Yolov4 vehicle identification positioning method, the type of the vehicle is identified by training a Yolov4 model, the license plate position is obtained, and then license plate image information is intercepted; the license plate image information is enhanced through the Enlight model, and finally the license plate information is acquired through OCR according to a character recognition algorithm, so that the license plate recognition accuracy is improved, the real-time recognition of the license plate under complex scenes such as different illumination conditions, angle changes and the like can be realized, and the problems of high detection difficulty and long detection time of the existing method are solved.
An embodiment of the present application provides an electronic device, where the electronic device includes a memory and a processor, where the memory is configured to store a computer program, and the processor is configured to execute the computer program to cause the electronic device to execute the charging station vehicle identification method described in embodiment 1.
The present embodiment provides a readable storage medium having stored therein computer program instructions which, when read and executed by a processor, perform the charging station vehicle identification method of embodiment 1.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely exemplary embodiments of the present application and is not intended to limit the scope of the present application, and various modifications and variations may be suggested to one skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Claims (10)
1. A method of charging station vehicle identification, the method comprising:
acquiring a vehicle image;
identifying the vehicle image by using an improved Yolov4 model to obtain a vehicle type and a license plate position;
intercepting a license plate image to be identified by utilizing the license plate position;
image enhancement is carried out on the license plate image by utilizing an EnLightGAN-based image enhancement algorithm;
and recognizing the license plate image after image enhancement by using a character recognition algorithm to obtain a recognition result.
2. The charging station vehicle identification method of claim 1, wherein prior to the step of identifying the vehicle image using the modified Yolov4 model, the method further comprises:
acquiring a vehicle image data set and labeling and classifying the vehicle image based on the vehicle type;
preprocessing the vehicle image to adjust the brightness and the size of the vehicle image, and dividing the vehicle image data set into a training set and a verification set;
resetting an Anchor value to preliminarily locate the license plate position by using a K-means clustering algorithm;
adding an attention mechanism module in a Yolov4 target detection algorithm model framework to obtain an improved Yolov4 model;
the improved Yolov4 model was trained.
3. The charging station vehicle identification method of claim 2, wherein resetting the Anchor value to initially locate the license plate location using a K-means clustering algorithm comprises:
extracting data corresponding to the size of the marked anchor frame in the vehicle image, and carrying out normalization processing to obtain an initialization data point;
randomly selecting K prediction frames as initial Anchor values;
calculating the distance from the data point corresponding to the prediction frame to the center point;
categorizing the data points into cluster centers nearest thereto based on the distance;
updating the position of the center point, and recalculating the distance from the center point until the position of the center point is not changed;
and calculating the average value of the K prediction frames, and taking the average value result as a reset Anchor value.
4. The charging station vehicle identification method of claim 2, wherein adding an attention mechanism module in the YOLOv4 target detection algorithm model framework to obtain an improved YOLOv4 model comprises:
before feature fusion of the PANet network, an attention mechanism module is added after convolution of a block_body (52,52,256) x 8 module and a block_body (26,26,256) x 8 module respectively so as to add attention weight to the input image feature vector.
5. The charging station vehicle identification method of claim 1, wherein prior to the step of image enhancing the license plate image using an EnlightGAN-based image enhancement algorithm, the method further comprises training an EnlightGAN-based image enhancement algorithm:
acquiring a training image;
adding an attention mechanism module under a maximum pooling layer to construct a U-net generator network, wherein the attention mechanism module comprises global average pooling, a full connection layer, an activation function and Sigmoid;
inputting the training image into an attention mechanism module to perform image up-sampling, and fusing an output image with the image processed by the third convolution module;
and sequentially decoding the output image through a first attention module, a second attention module and a third attention module, sequentially performing transposition convolution and convolution modules, fusing the image passing through the first attention module with the image passing through the second convolution module, fusing the image passing through the second attention module with the image passing through the first convolution module, fusing the image passing through the attention mechanism module with the image passing through the third convolution module, and generating the image enhanced by EnLightGAN.
6. A charging station vehicle identification apparatus, the apparatus comprising:
the image acquisition module is used for acquiring vehicle images;
the license plate positioning module is used for identifying the vehicle image by utilizing the improved Yolov4 model to obtain the vehicle type and the license plate position;
the image intercepting module is used for intercepting license plate images to be identified by utilizing the license plate positions;
the image enhancement module is used for carrying out image enhancement on the license plate image by utilizing an EnLightGAN-based image enhancement algorithm;
and the recognition module is used for recognizing the license plate image after the image enhancement by utilizing a character recognition algorithm to obtain a recognition result.
7. The charging station vehicle identification apparatus of claim 6, wherein the apparatus further comprises:
the labeling module is used for acquiring a vehicle image data set and labeling and classifying the vehicle image based on the vehicle type;
the preprocessing module is used for preprocessing the vehicle image to adjust the brightness and the size of the vehicle image and dividing the vehicle image data set into a training set and a verification set;
the preliminary positioning module is used for resetting the Anchor value so as to perform preliminary positioning on the license plate position by using a K-means clustering algorithm;
the model improvement module is used for adding an attention mechanism module in the Yolov4 target detection algorithm model framework so as to obtain an improved Yolov4 model;
and the training module is used for training the improved Yolov4 model.
8. The charging station vehicle identification apparatus of claim 7, wherein the preliminary positioning module comprises:
the normalization processing module is used for extracting data corresponding to the size of the marked anchor frame in the vehicle image, and carrying out normalization processing to obtain initialized data points;
the initialization module is used for randomly selecting K prediction frames as initial Anchor values;
the distance calculation module is used for calculating the distance from the data point corresponding to the prediction frame to the center point;
a categorizing module for categorizing the data points into cluster centers nearest thereto based on the distance;
the updating module is used for updating the position of the center point and recalculating the distance from the center point until the position of the center point is not changed;
and the average value calculation module is used for calculating the average value of the K prediction frames and taking the average value result as a reset Anchor value.
9. An electronic device comprising a memory for storing a computer program and a processor that runs the computer program to cause the electronic device to perform the charging station vehicle identification method according to any one of claims 1 to 5.
10. A readable storage medium having stored therein computer program instructions which, when read and executed by a processor, perform the charging station vehicle identification method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311467278.5A CN117253217A (en) | 2023-11-03 | 2023-11-03 | Charging station vehicle identification method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311467278.5A CN117253217A (en) | 2023-11-03 | 2023-11-03 | Charging station vehicle identification method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117253217A true CN117253217A (en) | 2023-12-19 |
Family
ID=89131529
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311467278.5A Pending CN117253217A (en) | 2023-11-03 | 2023-11-03 | Charging station vehicle identification method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117253217A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118314565A (en) * | 2024-06-11 | 2024-07-09 | 广汽埃安新能源汽车股份有限公司 | License plate recognition management method and device for automobile charging potential |
-
2023
- 2023-11-03 CN CN202311467278.5A patent/CN117253217A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118314565A (en) * | 2024-06-11 | 2024-07-09 | 广汽埃安新能源汽车股份有限公司 | License plate recognition management method and device for automobile charging potential |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110033002B (en) | License plate detection method based on multitask cascade convolution neural network | |
CN111027493B (en) | Pedestrian detection method based on deep learning multi-network soft fusion | |
CN108197326B (en) | Vehicle retrieval method and device, electronic equipment and storage medium | |
CN111461039B (en) | Landmark identification method based on multi-scale feature fusion | |
EP3690741B1 (en) | Method for automatically evaluating labeling reliability of training images for use in deep learning network to analyze images, and reliability-evaluating device using the same | |
CN111369581A (en) | Image processing method, device, equipment and storage medium | |
CN109800682B (en) | Driver attribute identification method and related product | |
CN113255659B (en) | License plate correction detection and identification method based on MSAFF-yolk 3 | |
CN105868700A (en) | Vehicle type recognition and tracking method and system based on monitoring video | |
US20240257423A1 (en) | Image processing method and apparatus, and computer readable storage medium | |
US20240161304A1 (en) | Systems and methods for processing images | |
CN117253217A (en) | Charging station vehicle identification method and device, electronic equipment and storage medium | |
CN112613387A (en) | Traffic sign detection method based on YOLOv3 | |
CN110852327A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN115731422A (en) | Training method, classification method and device of multi-label classification model | |
CN115995042A (en) | Video SAR moving target detection method and device | |
CN115953744A (en) | Vehicle identification tracking method based on deep learning | |
CN114155363A (en) | Converter station vehicle identification method and device, computer equipment and storage medium | |
Luo et al. | Seatbelt detection in road surveillance images based on improved dense residual network with two-level attention mechanism | |
CN117392508A (en) | Target detection method and device based on coordinate attention mechanism | |
CN111832463A (en) | Deep learning-based traffic sign detection method | |
CN116958615A (en) | Picture identification method, device, equipment and medium | |
CN114927236A (en) | Detection method and system for multiple target images | |
CN114694042A (en) | Disguised person target detection method based on improved Scaled-YOLOv4 | |
CN114429602A (en) | Semantic segmentation method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |