A method for detecting vehicle emissions

Through the combination of video image recognition and OBD port configuration database, the problems of low accuracy and high cost of automotive exhaust emission monitoring in the prior art are solved, and higher accuracy and lower cost of automotive emission detection are achieved.

CN118675122BActive Publication Date: 2025-06-20平邑县交通运输事业服务中心
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410994927.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2025-06-20
Estimated Expiration
2044-07-24

AI Technical Summary

Technical Problem

The test samples of existing automobile exhaust emission monitoring methods are limited, which cannot fully reflect the overall emission status of all vehicles in use in urban environments. In addition, traditional monitoring equipment is expensive, making it difficult to distinguish the emission contributions of vehicles of different models of vehicles.

Method used

By obtaining video images and road information of vehicle monitoring on the detected road section, using image recognition to obtain vehicle brand and model information, combining the OBD port configuration database to subclassify the vehicles, and using different detection methods to obtain emission data.

Benefits of technology

It improves the detection accuracy of automobile emissions, can more accurately reflect the overall emission status of all vehicles in use in urban environments, reduces detection costs, and can distinguish the emission contribution of different vehicle models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118675122B_ABST
    Figure CN118675122B_ABST
Patent Text Reader

Abstract

The present application discloses a method for detecting vehicle emissions, belonging to the technical field of energy emissions, including: obtaining video images and road information of vehicle monitoring on a detection section; using image recognition to obtain vehicle information in the video images; according to the obtained vehicle information, dividing the vehicles into first detection vehicles and second detection vehicles according to a preset OBD port configuration database, where the first detection vehicles are vehicles equipped with OBD ports, and the second detection vehicles are vehicles not equipped with OBD ports; for the first detection vehicles, obtaining vehicle instantaneous emission data through wireless communication with in-vehicle OBD devices, and calculating the emissions within a preset time period as the first predicted emissions; for the second detection vehicles, using a vehicle emission prediction model trained based on a machine learning algorithm to obtain the second predicted emissions; according to the obtained road information, correcting the predicted emissions through a correction coefficient; aiming at the problem of low detection accuracy of emissions, the present application improves the detection accuracy through vehicle subclassification, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of energy emissions, and particularly to a method for detecting vehicle emissions. Background Art

[0002] With the rapid development of the economy, the expansion of urban scale, and the rapid increase in the number of motor vehicles, various emissions in vehicle exhaust, such as nitrogen oxides and hydrocarbons, are one of the main sources of urban air pollution. Vehicle exhaust emissions cause serious harm to human health and the ecological environment. How to accurately monitor and evaluate vehicle exhaust emissions in the urban environment has become an important task for environmental protection departments.

[0003] Currently, portable emission testers are often used to measure sample vehicles on-site for vehicle exhaust emission monitoring. However, the samples tested by this method are limited and cannot comprehensively reflect the overall emission status of all in-use vehicles in the urban environment. Another monitoring method is to set up roadside emission monitoring stations and estimate by monitoring the emissions of vehicles on the road section. However, the equipment cost of traditional monitoring stations is high, and it is difficult to distinguish the emission contributions of different vehicle types. Some video image detection systems based on simple matching models can distinguish emissions based on vehicle types, but the recognition accuracy is limited, and differences such as vehicle age and OBD ports are not considered, resulting in large emission prediction errors. Therefore, how to accurately obtain vehicle information using image technology and establish a precise emission prediction model is a technical problem in improving the accuracy of vehicle emission monitoring.

[0004] In related technologies, for example, Chinese Patent Document CN116704761A provides a method, system, device, and medium for detecting vehicle emissions, including the following steps: obtaining road information of a detection road section and vehicle monitoring videos in the detection road section within a detection time scale; obtaining vehicle information of the detected vehicles according to the vehicle monitoring videos; classifying the detected vehicles according to the vehicle information, and dividing the detected vehicles into first detected vehicles and second detected vehicles; calculating the first vehicle emissions of the first detected vehicles based on a first emission detection method; calculating the second vehicle emissions of the second detected vehicles based on a second emission detection method; and determining the total vehicle emissions of the detection road section within the detection time scale according to the first vehicle emissions and the second vehicle emissions. However, this application only makes a simple classification by judging vehicle types from the monitoring videos and cannot accurately reflect the actual emission levels of each vehicle, and the accuracy of emission detection needs to be further improved. Summary of the Invention

[0005] 1. Technical Problems to be Solved

[0006] Aiming at the problem of low accuracy of emission detection in the prior art, the present invention provides a method for detecting vehicle emissions, which improves the accuracy of vehicle emission detection through technologies such as detailed classification of vehicles and adoption of different detection methods.

[0007] 2. Technical solution

[0008] The embodiment of this specification provides a method for detecting vehicle emissions, including: obtaining video images and road information of vehicle monitoring on the detection section, where the road information includes the number of lanes, road speed limit, traffic conditions, and environmental temperature and humidity;

[0009] Using image recognition to obtain vehicle information in the video image, where the vehicle information includes vehicle brand and vehicle model; for vehicles of different brands and models, there are differences in their engines and emission systems, and their emission characteristics are also different. By obtaining accurate brand and model information through image recognition, a personalized emission prediction model for different vehicle models can be established. Compared with simple vehicle model matching methods, image recognition can obtain richer vehicle information and improve the accuracy of information acquisition. The convolutional neural network using the attention mechanism can improve the accuracy of brand recognition. Combining year information can distinguish the differences between vehicles of the same model but different ages and improve the model recognition effect. Applying advanced image recognition technologies such as deep learning can improve the accuracy of vehicle information extraction. Obtaining refined vehicle brand and model information helps to establish a high-precision emission prediction model and achieve personalized prediction. Image recognition can perform non-contact and dynamic vehicle detection, expand the detection range, and improve the detection efficiency. Using the technical solution of image recognition of vehicle brand and model, rich and accurate vehicle information can be obtained, and a refined emission prediction model can be established, thereby improving the detection accuracy and effect of vehicle emission monitoring.

[0010] According to the acquired vehicle information, the vehicles in the detection section are divided into the first detection vehicles and the second detection vehicles according to the preset OBD port configuration database. Among them, the first detection vehicles are the vehicles equipped with OBD ports, and the second detection vehicles are the vehicles not equipped with OBD ports. The OBD port can directly obtain the operating data of the vehicle-mounted electronic control system and is an important means for detecting vehicle emissions. However, not all vehicle models are equipped with OBD ports. Differentiating vehicles according to the OBD port can targetedly apply different detection methods. For the first detection vehicles equipped with OBD ports, the real-time emission data of the vehicles can be directly obtained through the OBD ports. For the second detection vehicles not equipped with OBD ports, video image recognition and emission prediction models are required for detection. Classifying vehicle types clarifies the detection strategies for different vehicles and is conducive to improving the detection accuracy. The preset OBD port configuration database can accurately judge the OBD port situation of vehicles and conduct precise classification. This application combines two methods of OBD emission data and model prediction, expands the detection range, and improves the detection accuracy. Adopting personalized detection strategies for different types of vehicles conforms to the refined and intelligent design concept. This application can apply the optimal detection method in combination with the actual situation of the vehicle to enhance the overall monitoring effect. In summary, this application can conduct targeted emission detection according to the OBD port configuration of the vehicle and improve the accuracy by combining different detection methods.

[0011] For the first detection vehicles, the instantaneous emission data of the vehicles is obtained through wireless communication with the vehicle-mounted OBD device, and the emissions within a preset time period are calculated as the first predicted emissions. An internationally standardized wireless communication protocol is adopted, such as the DSRC protocol designed specifically for the vehicle network, to ensure the security and reliability of the communication process. Several communication base stations are set up in the detection section, and the vehicle-mounted OBD device automatically connects to the base station after entering the communication range. The OBD device embeds a unique ID and is registered by binding with the vehicle VIN to ensure the authenticity and reliability of the data source. The OBD device collects the engine operating parameters at a certain frequency and calculates the instantaneous emissions. The base station aggregates the instantaneous emissions within the time period and calculates the total emissions according to the preset algorithm model. The total emissions calculation algorithm takes into account the influence of factors such as vehicle speed, load, and idling, and adopts a verified emission mapping relationship. To reduce the communication volume, the OBD device can perform preliminary data filtering and integration locally and upload the refined results. The base station adopts a data caching and redundancy mechanism to ensure that the original data uploaded by the OBD is not lost. The instantaneous emission data is encrypted securely to avoid being illegally modified during wireless transmission.

[0012] For the second test vehicle, use the vehicle emission prediction model trained based on the machine learning algorithm to obtain the second predicted emissions; collect the vehicle static data and dynamic data containing multi-dimensional information such as vehicle model, vehicle age, driving speed, and road conditions to construct a sample data set. Preprocess the data set, remove the abnormal data, perform one-hot encoding on the categorical data, and normalize the data. Construct an end-to-end deep learning emission prediction model based on the convolutional neural network, and the model includes structures such as convolutional layers, pooling layers, and fully connected layers. Use the Adam optimization algorithm to train the model, adopt the early stopping method to avoid overfitting, and at the same time use L2 regularization to prevent the model from being overly complex. Use k-fold cross-validation to evaluate the training effect of the model, and select the model with the smallest cross-validation loss. Use the test set to evaluate the model accuracy, and the adopted metrics include R2Score, mean absolute error, etc. When the model accuracy reaches the preset threshold requirement, save the model for prediction. For the detected second test vehicle, extract the feature information and input it into the trained emission prediction model to obtain the emission prediction results of indicators such as CO2, HC, and NOx. Set the confidence interval for the model prediction results and filter out the prediction samples with insufficient confidence. Accumulate the filtered samples by time and calculate the total emission prediction amount of the second test vehicle.

[0013] According to the obtained road information, correct the first predicted emissions and the second predicted emissions respectively through the correction coefficient; the first predicted emissions come from the vehicle OBD system, and the data is accurate and reliable, but there may be system biases. The second predicted emissions come from model prediction and may have errors due to environmental impacts. The road information reflects the actual operating environment of the vehicle and can be used to correct the prediction bias. The correction coefficient can be calculated based on factors such as road speed limits and traffic conditions. Separately correcting the two types of emissions can make the correction more accurate and targeted. The corrected emissions can better reflect the emission level under the actual road conditions. Correcting with the help of road information can reduce the systematic error of the predicted emissions. This application combines the vehicle's own data and the operating environment data, making the prediction results more accurate. The correction technology conforms to the design idea of using multi-source heterogeneous data to improve the detection accuracy. This application combines the detection and correction technologies, which can effectively improve the accuracy of emission prediction. In summary, this application follows the idea of data fusion and improves the accuracy of emission prediction through correction.

[0014] The total emissions of the detected road section are calculated based on the corrected first predicted emissions and the second predicted emissions; the first predicted emissions (vehicles equipped with OBD ports) and the second predicted emissions (vehicles not equipped with OBD ports) have been adjusted by the correction coefficient and have high accuracy. The predicted emissions of the two types of vehicles are combined to evaluate the overall emission level of the entire road section. Compared with the detection of only one type of vehicle, the detection range can be expanded and the representativeness can be improved. Combined with personalized detection of different types of vehicles, the total emission calculation can be more accurate. Calculating vehicle flow based on video images can accurately reflect the actual number of vehicles on the road section. Combined with flow parameters, the absolute amount of overall emissions of the road section can be quantified. Compared with existing detection that only obtains instantaneous emissions in a certain period of time, this application can comprehensively evaluate the overall emission contribution of the road section. Calculating the total emissions of the road section meets the monitoring objectives of evaluating regional emission pollution. This application integrates multi-source data for overall detection, expands the scope of monitoring, and improves the systematic nature of detection. Calculating total emissions is a key output indicator for accurate and dynamic emission monitoring. In summary, this application can make full use of images, models and corrected prediction results to comprehensively calculate the total emissions of road sections and improve the accuracy and effectiveness of emission monitoring.

[0015] Among them, the road speed limit is the speed limit of the detection section; the traffic condition is the traffic flow and average speed of the detection section. The road speed limit directly affects the actual operating speed of the vehicle and is a necessary parameter for establishing an accurate emission prediction model. The traffic flow determines the number of vehicles on the road section and is the basis for calculating the total emissions. The average speed reflects the actual operating status of the vehicle and is highly correlated with the emission characteristics. The combination of speed limit and average speed can accurately infer the acceleration and deceleration of the vehicle. By mastering the detailed traffic conditions of the road section, an emission prediction model can be established in a targeted manner. Obtaining the parameters of the traffic conditions is the supervisory information for model training. The traffic conditions directly determine the working state of the vehicle, and obtaining relevant data can reduce the state judgment error. Accurate parameters can improve the environmental adaptability and robustness of the emission prediction model. Obtaining key influencing factors as model input is an important part of building an accurate model. Full consideration of parameters helps to improve the detection accuracy of the model on actual roads. In summary, obtaining parameters such as speed limit and traffic conditions is the basis for establishing a refined emission prediction model and a necessary means to improve the actual detection accuracy.

[0016] Furthermore, vehicle information in video images is obtained using image recognition. The vehicle information includes the vehicle brand and model, and the steps are as follows: For the obtained video images, an interpretable instance segmentation algorithm is used to obtain vehicle pictures containing the entire vehicle; Instance segmentation can accurately extract the image region containing the complete vehicle. Compared with bounding boxes, instance segmentation can provide richer overall vehicle feature information. The attention mechanism can output the explanation of vehicle region extraction, improving the transparency of the algorithm. Obtaining the overall vehicle image can represent vehicle features more comprehensively. The overall vehicle image is beneficial to the extraction of large-scale features in the subsequent process, such as body lines, etc. Extracting the complete vehicle image can significantly improve the recognition effect of vehicle model details.

[0017] High-quality vehicle images are beneficial to the accuracy of subsequent vehicle model and brand recognition. Extracting the overall vehicle image is an important preprocessing step for obtaining fine vehicle information. Improving the quality of vehicle region extraction will directly affect the subsequent effects of feature extraction and recognition. In summary, this application lays a data foundation for constructing a fine emission prediction model by improving the integrity of vehicle image acquisition. Advanced instance segmentation algorithms such as Mask RCNN can achieve accurate vehicle extraction, and also include: PN (Feature Pyramid Network) FPN uses multi-scale features for instance segmentation, can detect objects of different sizes, and is suitable for vehicle extraction; YOLACT is a fast instance segmentation algorithm, with high speed and accuracy, suitable for real-time vehicle segmentation; Polar Mask transforms instance segmentation into a multi-classification problem in polar coordinates, improving the segmentation speed; Blend Mask fuses semantic segmentation networks and instance segmentation networks to achieve high-quality instance segmentation; Center Mask uses center point detection to assist instance segmentation, improving the segmentation effect of small targets; YOLACT Edge is a lightweight real-time instance segmentation algorithm, suitable for edge computing.

[0018] The obtained vehicle images are processed by a deep learning-based image dehazing algorithm for filtering and noise reduction; the deep learning dehazing algorithm can directly remove haze from the images through an end-to-end network structure. The multi-scale feature extraction and long-distance skip connection design can capture the features affected by fog at different distances. By adopting an encoder-decoder structure containing a residual network, end-to-end dehazing and restoration can be achieved. Median filtering can effectively suppress Gaussian noise and smooth the vehicle images. The deep learning denoising network performs image denoising through an autoencoder structure and can extract clear vehicle features. High-quality vehicle images will significantly improve the subsequent vehicle model recognition and body information extraction effects. Extracting refined body and brand features can establish a more accurate emission prediction model. Clear vehicle images can restore more effective details, which is beneficial for feature extraction. Image enhancement can strengthen the contrast and contours, further highlighting vehicle differences. Image filtering and noise reduction are the key steps to obtain an ideal vehicle information source. In summary, this application improves the image quality through deep learning, provides a reliable source for obtaining fine vehicle information, and will help improve the accuracy of subsequent emission predictions.

[0019] The processed vehicle images are input into a convolutional neural network based on the attention mechanism to obtain the vehicle brand; a feature extraction model based on networks such as ResNet is used to learn global and local features from the vehicle images. The spatial and frequency domain attention mechanisms are utilized to enable the network to focus on the key features of the logo area. The attention mechanism can enhance the expression ability of the logo features through weight assignment. The global and local features are fused and input into the brand classification network for multi-label classification. Anchor boxes for the logo area and the body area are set to improve the positioning ability of detecting the logo. Angle classification is adopted to improve the detection of logos in different directions. The network outputs the logo area box and the classification result, indicating the detected brand information. A large amount of vehicle brand data is used for network training to improve the detection robustness. The relationships between logos are mined as prior knowledge to guide more accurate brand detection. Deep learning improves the brand recognition ability in complex environments. Precise brand information is obtained to construct a refined emission prediction model for different brands. In summary, this application can effectively obtain vehicle brand information, providing the possibility for improving subsequent emission predictions.

[0020] Input the processed vehicle pictures into a convolutional neural network combined with vehicle model year classification to obtain the vehicle models containing year information; construct a vehicle model feature extraction model based on networks such as VGG and Inception to learn features such as body lines. Set the classification heads for vehicle model data of different years for multi-task joint learning. Use the year classification head to predict the vehicle age and obtain the production time information. The year classification head can adopt a CNN structure based on time series. Incorporate the year prediction as auxiliary information into the vehicle model classification head. The vehicle model classification head outputs the specific vehicle model classification results. When training the network, optimize the two tasks of vehicle model classification and year classification simultaneously. Vehicle model data of different vehicle ages can better construct time-related features. Obtain vehicle model data containing accurate year information. Establish a model associating vehicle age with emissions to improve prediction accuracy. Distinguish the emission differences of vehicles of the same model but different vehicle ages. In summary, this application can obtain rich vehicle model and year information, providing strong support for constructing a refined emission prediction model.

[0021] Input the obtained vehicle brand and vehicle model into a convolutional neural network based on a confidence fusion algorithm to obtain the vehicle information recognition result. Respectively obtain the prediction results and confidence levels of vehicle brand recognition and vehicle model recognition. Analyze the confidence levels of the two recognition tasks and set the confidence level weights. When the confidence level of a certain task is low, assign a higher weight to the other task. Input the two recognition results and weights into the fusion module. The fusion module includes a cascaded structure of a convolutional network and a fully connected network. The network learns the associated features of the brand and model results for confidence fusion. Output the final vehicle information recognition result that combines the two tasks. Confidence fusion improves the recognition robustness through weight adjustment. The combination of the two types of information can be used for mutual verification and correction. The cascaded network gradually adjusts the weights for deep fusion. Finally, output the accurate brand and model information of the vehicle. Fine vehicle information can establish a highly targeted emission prediction model. In summary, this application improves the recognition stability through confidence fusion, obtains fine vehicle information, and provides support for subsequent improvement of emission detection accuracy.

[0022] Furthermore, for the acquired video images, the steps of obtaining vehicle pictures containing the entire vehicle by using an interpretable instance segmentation algorithm are as follows: Jointly train the Mask RCNN instance segmentation model using the real vehicle image sample dataset and the fake vehicle sample dataset generated based on the generative adversarial network; Collect and annotate a large number of real vehicle images to construct a high-quality sample dataset. Use generative models such as Style GAN to learn the real sample distribution and generate fake vehicle images. The generated samples maintain the consistency of vehicle texture and color style, enhancing sample diversity. Mix the real samples and the generated samples in a certain proportion and then conduct batch training. The generated samples are used as negative samples, and the real samples are used as positive samples for adversarial training. The MaskRCNN model contains modules such as RPN and RoI Align for vehicle extraction scoring. Adversarial training strengthens the model's recognition ability for real vehicles. Mixing sample training improves the model's robustness to complex scenarios. Diverse training samples avoid model overfitting and enhance generalization. Obtain more accurate and stable vehicle instance segmentation results. Improve the effects of subsequent vehicle feature extraction and brand recognition. Precise vehicle segmentation is beneficial to constructing an efficient emission prediction model. In summary, the adversarial training and data augmentation of this application can improve the effect of instance segmentation and provide stable support for subsequent emission prediction. Among them, the Generative Adversarial Networks (GAN) is a generative model that can learn the distribution characteristics of training data through adversarial training and can generate new samples. In this solution, GAN is used to generate fake vehicle images as additional training samples. The specific steps include: Collect real vehicle images as real samples, including images of various vehicle models and scenarios. Use generative models such as the Variational Autoencoder (VAE) to learn the feature distribution of real samples. Establish a GAN model structure containing a generator and a discriminator. The generator attempts to generate realistic fake vehicle samples, and the discriminator attempts to distinguish between real and fake samples. Through adversarial training, the generator produces high-quality fake vehicle images with a feature distribution consistent with that of real samples. Mix the fake samples generated by GAN with the real samples and use them as the training data for Mask RCNN. Increase the number and diversity of samples and improve the generalization ability of the model. The synthetic data augmentation technology expands the model's adaptation range and enhances the model's robustness. In summary, the fake vehicle samples generated by GAN are simulations of the real distribution and can improve the effect of the instance segmentation model as supplementary samples.

[0023] Add an attention mechanism to the Mask RCNN instance segmentation model to extract pictures of the target vehicle area; add an attention branch after the Feature Pyramid Network (FPN) module of Mask RCNN. The attention module learns the attention weights of each area and outputs an attention map. Perform attention weighting on the FPN feature map to enhance the feature expression of the target vehicle. Set spatial attention and channel attention to focus on key positions and semantic features respectively. The attention mechanism provides model segmentation explanations and increases the interpretability of the results. Mask RCNN extracts target area features based on RoI Align. Output pictures containing the complete vehicle according to the Mask prediction results. Attention strengthens the features of the target vehicle and improves the segmentation effect of small and occluded targets. Extract high-quality and complete vehicle pictures, which is beneficial for subsequent vehicle model recognition. Clear whole vehicle pictures provide a richer feature information source. Improve the instance segmentation accuracy and obtain more accurate vehicle information. Facilitate the construction of an efficient vehicle emission prediction model. In summary, this application can enhance the segmentation effect of the target vehicle and obtain better pictures of the vehicle area. Among them, the target vehicle area refers to the image area of a single vehicle obtained after instance segmentation by the Mask RCNN model. In this application, in order to improve the feature extraction ability of the key area, an attention mechanism is introduced into Mask RCNN. Specifically, similar attention modules such as CBAM or ECA are added to the backbone feature extraction network of the model. These modules can learn to focus on key features in the spatial position or channel direction, thereby enhancing the feature expression of the target area. When performing vehicle instance segmentation, the attention module will generate a higher activation coefficient for the area containing the vehicle. In subsequent operations such as RoI Align, the vehicle target area will receive more focused feature extraction. Finally, Mask RCNN can segment the target area image with obvious vehicle features. This instance segmentation network integrating the attention mechanism can significantly improve the recognition and localization ability of specific targets, thereby improving the effects of subsequent vehicle model recognition and VIN code reading.

[0024] Use the trained Mask RCNN instance segmentation model to perform instance segmentation on the input video images to obtain the segmentation result pictures containing the target vehicles; for the input vehicle video images, use the ImageNet pre-trained model to extract spatial semantic features. Obtain multi-scale semantic feature maps based on the Feature Pyramid Network (FPN). The attention module learns the attention of each region to enhance the features of the target vehicle. Generate potential vehicle proposals based on the anchor boxes and the Proposal network. The RoI Align module accurately extracts the features of the proposed regions. The prediction sub-network outputs the instance segmentation Mask results. Extract the target vehicle region images according to the Mask. The model is trained end-to-end to achieve vehicle instance segmentation. The Mask RCNN integrated framework improves the real-time performance. The attention mechanism enhances the segmentation effect of small targets and occluded vehicles. Extract high-definition whole vehicle images, which is beneficial for subsequent acquisition of detailed features. High-quality vehicle segmentation images are beneficial for constructing an accurate emission prediction model. In summary, this application can achieve accurate video vehicle segmentation and obtain key vehicle region images.

[0025] Perform semantic segmentation on the obtained segmented result image to obtain a binary vehicle body mask image containing pixels of the vehicle body, windows, and headlights as the vehicle image. Use a fully convolutional network based on an encoder-decoder for semantic segmentation. The encoder extracts semantic features through networks such as ResNet. The decoder upsamples to restore the resolution and outputs semantic prediction results. The network performs multi-class prediction for categories such as the vehicle body, windows, and headlights. Use image cascading to improve the segmentation effect of small targets like headlights. The prediction result undergoes post-processing to generate a binary mask of the vehicle body. The mask retains the contour features of the vehicle body, facilitating vehicle model recognition. The positions of the windows and headlights hint at the body structure, which is beneficial for detailed analysis. The precise binary vehicle body mask facilitates efficient background removal. Extract key vehicle components and construct refined features. The high-quality vehicle body region map will enhance the subsequent brand recognition effect. It is beneficial to establish a fine-grained emission prediction model considering more factors. In summary, this application can obtain key vehicle body features. Among them, after obtaining the vehicle region image output by the Mask RCNN instance segmentation network, further semantic segmentation can be performed to extract the main components of the vehicle. Here, a semantic segmentation model based on a fully convolutional network is used, which can classify each pixel and obtain images of different semantic categories. The model will identify key parts such as the "body", "windows", and "headlights" in the vehicle image. Then, according to the semantic masks of these components, a binary mask image representing the vehicle body region is generated. Specifically, the semantic masks of vehicle components such as the "body", "windows", and "headlights" are superimposed to obtain the pixel distribution of the vehicle body features. According to this pixel distribution, a binary mask image is generated, only retaining the regions with significant vehicle body features and removing the irrelevant background. The obtained binary vehicle body mask image can completely contain the main recognition feature information of the vehicle. It provides more accurate positioning support for subsequent vehicle model and brand recognition and VIN code detection, improving the processing effect. The introduction of this additional semantic segmentation processing link can further improve the accuracy of vehicle information recognition.

[0026] Furthermore, the process of filtering and noise reduction on the obtained vehicle images using a deep learning-based image dehazing algorithm includes the following steps: Adopt a deep neural network dehazing algorithm based on dark channel prior to dehaze the fog components in the vehicle images; construct an end-to-end multi-scale convolutional neural network and input the foggy images for dehazing. The network includes a detail enhancement module to learn the local features of the image and restore the vehicle details. The network predicts the dark channel prior to estimate the atmospheric light value. The network predicts the transmission map, which represents the transmittance of each region of the image. Based on the atmospheric light and the transmission map, image dehazing and restoration are performed. The interpretable attention module outputs dehazing explanations to improve the credibility of the algorithm. Fog causes losses in the fusion of vehicle edges and details, and dehazing can restore clear features. Clear vehicle contours are beneficial for accurate identification of vehicle models and logos. Removing fog can restore the true color of the vehicle body, which is conducive to extracting color features. Restoring the windows and headlights can prompt the vehicle body structure and obtain additional features. High-quality dehazed images will greatly improve the effect of subsequent vehicle information extraction. Extracting more accurate vehicle features can establish a more reliable emission prediction model.

[0027] Use the median filtering algorithm to perform filtering preprocessing on the dehazed vehicle images; median filtering calculates the median of the pixels within the image region and replaces the central pixel value. Median filtering can smoothly remove salt-and-pepper noise and retain edge details. Calculate the median of the local window of the image, and the parameter can adjust the window size. Perform sliding window median filtering on the entire dehazed vehicle image. Remove the image noise points and enhance the clear continuity of the vehicle contours and lines. Median filtering retains the edge features of the vehicle body and will not blur the logo texture. Restore the boundaries of the headlights and windows to prompt the vehicle body structure information. Ensure that the key texture features of the vehicle are not interfered by noise and enhance the feature expression. Smooth the vehicle body color to help extract the main color tone of the vehicle body. The preprocessing improves the robustness of the subsequent vehicle model recognition algorithm. Clear and continuous edges are beneficial for establishing contour features such as find Contours. The main steps of the findContours function are: find the contour points in the element, and these points form a closed curve. Classify all the contour points to identify which contour points form the boundary of the same object. Extract the contour features of the object, including the contour area, perimeter, center point coordinates, etc. Optimize the extracted contours to remove redundant points, and the APPROXPOLY method can achieve the polygon approximation of the contours. The final output includes the organizational information (list of point sets) of each independent contour. High-quality preprocessed images will improve the vehicle detail analysis effect.

[0028] Using a deep denoising neural network based on the encoder-decoder structure, denoise the vehicle pictures preprocessed by filtering; the encoder uses networks such as ResNet to extract the global semantic information of the vehicle images. The decoder module gradually upsamples to restore the high-resolution images. Set skip connections to retain the low-level detail features at the encoder end. The network is trained end-to-end to learn the prior knowledge of denoising. The autoencoder network structure reconstructs the denoised vehicle images. Use the method of residual learning to predict and remove the noise. The attention mechanism focuses on denoising the key areas of the logo and contour. After denoising, the clarity and continuity of the logo and the vehicle body edge can be restored. The contours of the windows and headlights are clearer, which is used to indicate the body structure. Restore the original details of the body color and paint. Clear detail features are beneficial to constructing the feature expression of the vehicle model. High-quality vehicle images can improve the subsequent brand recognition effect. Denoising improves the stability of feature extraction, which is beneficial to the accuracy of emission prediction.

[0029] Adopt an image enhancement algorithm based on adaptive Gamma correction to enhance the denoised vehicle pictures. Calculate the global Gamma value of the image and perform Gamma adjustment on the areas with too low contrast. Use local Gamma mapping to only enhance the contrast of the dark logo and contour areas. The calculation of the Gamma value combines the analysis results of the image histogram. Adaptively determine the enhancement strength to avoid color distortion of the vehicle body. Gamma correction can restore the edge gradient of the logo and enhance its texture features. The saliency of the contour, window, and headlight boundaries is improved, which is beneficial to structural analysis. Integrate global and local enhancement to enhance the image hierarchy. Enhance the main body color of the vehicle body and the details of the logo, which is beneficial to feature expression. Retain the original visual effect of the vehicle to ensure the authenticity of enhancement. The enhanced fine features are beneficial to constructing a vehicle model discrimination model. Clear vehicle details are beneficial to subsequent brand recognition. Image enhancement improves stability and provides a high-quality visual source for emission prediction. In summary, this image enhancement technology can improve vehicle feature expression and provide support for subsequent improvement of emission detection accuracy.

[0030] Furthermore, the filtering preprocessing of the dehazed vehicle images using the median filtering algorithm includes the following steps: Collect noise-free vehicle images and vehicle image samples with different degrees of Gaussian noise added; collect a large number of high-definition vehicle images as noise-free samples. Add Gaussian noise with different parameters to the sample images to simulate different degrees of noise. The Gaussian noise parameters include the mean, standard deviation, etc., to control the noise magnitude. The added noise type can be extended to salt-and-pepper noise, etc., to increase the sample diversity. The noise samples focus on key areas such as the vehicle logo, vehicle edges, and contours. Construct image pairs with different noise degrees as the training data for the image denoising network. Train the network to learn the prior knowledge and mapping relationship of denoising. The noise data enhances the robustness of the network and improves the denoising ability in different environments. Clear vehicle images provide richer features such as edges and contours. It is beneficial to construct more stable vehicle type recognition and vehicle detection models. Reduce the interference of environmental noise on subsequent feature extraction. Improve the quality of vehicle information acquisition and is conducive to improving the accuracy of emission prediction. In summary, constructing a noise data sample set will improve the denoising performance.

[0031] Train a convolutional neural network model to judge the noise type and noise point density of the image, and output the noise type and the corresponding noise point distribution characteristics; construct an image data set containing different noise types, such as Gaussian noise, salt-and-pepper noise, etc. Use a convolutional neural network, including structures such as convolutional layers and pooling layers. The network inputs an image and outputs a multi-classification judgment of the noise type. Add a sub-branch to predict the noise point density distribution feature map. The feature map retains the spatial distribution information of the noise points. Jointly judge the noise type and density distribution to obtain fine-grained noise information. The noise type judgment guides the use of different denoising algorithm strategies. The noise distribution prompts spatial attention for targeted denoising. Improve the adaptability of the model to different types of noise. Fine-grained noise analysis can make denoising more accurate. Reduce the impact of noise on subsequent vehicle feature extraction. Improve the quality of vehicle images and provide support for improving the accuracy of emission prediction. In summary, this application can judge noise information, facilitate precise and targeted image denoising, and thus improve the quality of subsequent vehicle feature analysis and emission prediction.

[0032] When it is detected as Gaussian noise and the density of noise points is greater than the threshold T1, a median filter kernel with a size of M1×M1 is selected; when it is detected as salt-and-pepper noise and the density of noise points is less than the threshold T2, a median filter kernel with a size of M2×M2 is selected; Gaussian noise points are smoother and more continuous, and a larger filter kernel M1 is selected to remove them. Salt-and-pepper noise points are finer and more abrupt, and a smaller filter kernel M2 is selected for processing. Corresponding thresholds are set according to the noise density to dynamically adjust the filter kernel. T1 is set as the maximum acceptable density of Gaussian noise, and T2 is the minimum density of salt-and-pepper noise. M1 and M2 are customized according to the noise type and the vehicle image resolution. Median filtering preserves the vehicle contour without excessive smoothing. Adaptive filtering is performed according to different noise type and density division strategies. Targeted filtering reduces the loss of vehicle details. The key texture features of the vehicle are restored, which is beneficial to subsequent vehicle type recognition. The continuity of the vehicle edge and contour is improved. Adaptive preprocessing enhances the robustness of the model and adapts to more scenarios. It is beneficial to construct a more stable and efficient vehicle emission prediction model. In summary, this application can perform adaptive filtering according to the noise situation, adopt optimal strategies for different noise types, and improve the expression quality of vehicle features. Among them, Gaussian noise: is a statistical noise, and its mathematical model conforms to the Gaussian distribution, also known as the normal distribution noise. It is manifested in the image as a smooth change in the overall color and brightness of the image. Salt-and-pepper noise: is a randomly occurring white and black dot noise, similar to pepper being sprinkled on the image, hence the name salt-and-pepper noise. It is manifested in the digital image as randomly scattered white and black dots. In this application: detect the type of image noise and determine whether it is Gaussian noise or salt-and-pepper noise. Count the proportion of noise points in the total number of pixels in the entire image to obtain the noise point density. Select median filter kernels of different sizes according to the noise type and density threshold. Use median filtering to smooth different types of noise points and remove the noise. Adaptive selection of the filter kernel can effectively process various types of noise and improve the image quality.

[0033] Filter and denoise the vehicle image using the selected median filter kernel; M1 is greater than M2; the filter kernel has a square structure. Calculate the values of all pixels within the square filter window and replace the central pixel with the median. For Gaussian noise, use a larger window M1 to include more surrounding pixel information. For salt-and-pepper noise, use a smaller window M2 to avoid losing details. The sizes of M1 and M2 are customized according to the noise distribution and image details. The square kernel has a small computational amount and is easy to optimize and implement. Slide the square kernel through all positions of the image to perform full-image filtering. Median filtering can effectively suppress Gaussian noise and retain the vehicle edges. Median filtering can repair the damaged pixels caused by salt-and-pepper noise. Restore the coherent contours of areas such as the vehicle body, windows, and headlights. Through the adaptive filter kernel, balance the denoising effect and detail retention. Improve the image quality and provide source materials for subsequent vehicle feature extraction. Reduce the impact of environmental noise on vehicle detection and recognition. Facilitate the construction of a more accurate and robust vehicle emission prediction model. In summary, this application can perform adaptive filtering for different noise types, improve the quality of vehicle images, and provide support for subsequent improvement of emission prediction accuracy.

[0034] Further, use a deep neural network defogging algorithm based on dark channel prior to defog the fog component in the vehicle image, which includes the following steps: The deep neural network based on dark channel prior includes a feature extraction module and a defogging module; the feature extraction module uses a convolutional network to extract global and local features of the image. The convolutional kernel size and stride are reasonably designed to retain the vehicle detail features. Set multi-scale parallel convolutions to obtain multi-scale features of the vehicle. Add an attention mechanism to focus on key areas such as the vehicle logo and contour. The defogging module predicts the global atmospheric light value, representing the background light intensity. The defogging module also predicts the transmission rate of each pixel, representing the distance of the image. According to the atmospheric light and transmission rate, restore a clear vehicle image. Train the end-to-end network to learn defogging and image prior knowledge. Remove the fog shadows in the window and light areas for judging the vehicle body structure. Restore the continuity of the vehicle logo and contour boundaries, which is conducive to feature expression. Improve the clarity of vehicle color and detail features. Image defogging can restore the real vehicle visual effect. Facilitate the construction of a more accurate and robust vehicle emission prediction model.

[0035] The feature extraction module is used to extract the dark channel prior features from the input vehicle images, obtaining the dark channel prior feature maps. Among them, the feature extraction module includes multiple layers of convolution and pooling operations; small convolution kernels are used to extract the local dark channel prior features of the vehicle images. The stride is set reasonably to ensure the resolution of the feature maps and the text information. Features with different receptive fields are extracted through multiple layers of convolution. The pooling operation obtains the features of the local areas of the road signs and the vehicle body. Semantic features at different levels are extracted through multiple layers of convolution. The output feature maps retain the dark channel prior information of the key areas of the vehicle. The high-response areas in the feature maps correspond to the dark channel areas of the images. The dark channel prior can judge the distance relationship between the vehicle body and the glass. It is used to guide the subsequent prediction of the image transmission rate. The dark channel feature maps are extracted to provide a basis for image dehazing and reconstruction. The finer color and texture features of the vehicle are restored. It is beneficial to construct a more accurate and robust vehicle feature representation. It provides a high-quality visual source for subsequent vehicle type recognition and emission prediction. In summary, extracting the dark channel prior feature maps can provide guidance for subsequent dehazing, thereby improving the quality of vehicle images.

[0036] The extracted dark channel prior feature maps are input into the dehazing module for dehazing processing. The dehazing module includes a conditional generative adversarial network based on prior features; the extracted dark channel prior features are used for conditional constraints. A generator is set to predict a clear vehicle image according to the prior features. A discriminator is set to judge the authenticity of the generated image. The generator and the discriminator perform adversarial training. The generator is guided by the dark channel prior to pay attention to the relationship between the vehicle body and the glass. Clear vehicle windows, headlights, and vehicle body edges are generated. The key texture features of the vehicle logo and the vehicle body are retained. Selective image generation is performed according to the prior features. The adversarial process makes the generated image more realistic. The conditional adversarial network can avoid image color deviation. The original visual effect of the vehicle is restored. High-quality vehicle images are provided, which is beneficial to subsequent feature expression. It provides support for constructing a more accurate vehicle type recognition and emission prediction model. In summary, the dehazing module can perform conditional generation according to the dark channel prior, improving the realism and quality of the images, and providing support for subsequent improvement of the emission prediction accuracy.

[0037] In a conditional generative adversarial network, the dark channel prior feature map is used as a conditional input to the generator, and the generator learns the distribution of dehazed vehicle images; the generator adopts an encoder-decoder structure. The encoder extracts the global features of the dark channel prior. The decoder gradually upsamples and outputs a high-resolution dehazed image. Skip connections are set to retain the detailed features at the encoding end. The prior features are injected into each layer through the skip connections to guide the generation process. The generator outputs a realistic dehazed vehicle image. It learns to map the foggy image to the dehazed image space. The key contours and color texture features of the vehicle are retained. The window and headlight areas are clear, which is conducive to judging the body structure. The continuity of the vehicle logo and the vehicle edge is restored. High-quality vehicle visual source information is provided. It is beneficial to construct a more robust vehicle model recognition and emission prediction model. The robustness of the model in dealing with different haze weather is improved. In summary, the generator uses prior features for constrained dehazed generation, which can improve the authenticity and quality of the image. Among them, the generator: As a generative model in the conditional adversarial network, it inputs the foggy image and prior features. It learns the distribution features of fog-free vehicle images through a convolutional network. It outputs the generated simulated dehazed vehicle image. The purpose is to deceive the discriminator into judging that the output image is a real fog-free image. The discriminator: As a discriminative model in the adversarial network, it inputs the output image of the generator or real samples. It determines whether the input image is a real fog-free sample or the output of the generator through a convolutional network. It outputs the discriminative result of the authenticity of the input image. The purpose is to distinguish the generated samples and real samples as much as possible. Through continuous confrontation, the output of the generator becomes more realistic. The adversarial interaction between the generator and the discriminator promotes the training of the dehazing model.

[0038] The distribution of the dehazed vehicle images output by the generator is input into the discriminator, and the discriminator judges the similarity between the generated dehazed vehicle images and the fog-free vehicle images; the discriminator uses a convolutional network to extract features to judge authenticity. It judges the quality of the generated image from both local and global perspectives. It compares the key region features in the vehicle image. It judges the clarity of the logo, window, and contour regions. It analyzes the consistency of the color hierarchy of the generated image with the real image. It detects the degree of continuity of the edges and contours. It compares the similarity of the detailed texture features. It learns to distinguish the differences between the original fog-free image and the generated dehazed image. The generator gradually improves the generation quality according to the feedback of the discriminator. The adversarial process enhances the realism of the generator output. It provides realistic and high-quality vehicle images. It is beneficial to construct a more robust vehicle feature representation. It provides a high-quality visual source for subsequent vehicle model recognition and emission prediction. In summary, the discriminator judges the quality of the generated image, guides the generator to produce more realistic results, thereby improving the quality of vehicle images.

[0039] According to the discrimination result output by the discriminator, update the parameters of the generator through backpropagation of the loss function; among them, use vehicle images with different fog concentrations to train the defogging algorithm and learn the defogging mapping relationship. Construct a dataset containing vehicle images with different concentrations of haze. The loss function includes adversarial loss and pixel reconstruction loss. The adversarial loss minimizes the probability that the generated image is judged as a real sample. The pixel reconstruction loss maintains the consistency of the detailed features of the generated image. Update the generator parameters through backpropagation to approximate the real vehicle distribution. Train on samples with different fog concentrations to improve the generalization ability of the model. Learn the influence law of fog on the visual effect of vehicles. Master the defogging mapping relationship under different fog concentrations. Generate clear and recognizable key components of vehicles. Improve the robustness of the model in the face of different haze weather. Provide high-quality visual sources for subsequent vehicle structure analysis. Facilitate the construction of a powerful vehicle type recognition and emission prediction model. Expand the application scope of the model in complex environments. In summary, learning defogging knowledge for different fog concentrations can improve the generalization ability of the model and enhance the environmental adaptability for subsequent emission prediction improvement. Among them, the defogging mapping relationship refers to the mapping function learned by the defogging algorithm from a foggy image to a fog-free clear image. When using a generative adversarial network to train the defogging algorithm, the defogging mapping relationship specifically refers to: the generator learns the mapping conversion function from a foggy input image to a fog-free target image. This is a mapping relationship from the foggy image space to the clear image space. The generator gradually learns the parameters of this mapping conversion through differentiable network layers. The discriminator judges whether the generated image is realistic and clear enough. Continuously approximate the defogging mapping relationship through the adversarial mechanism and output a clear fog-free result. Samples with different concentrations of fog expand the applicable range of the mapping relationship. The learned defogging mapping relationship can convert a foggy input into a fog-free image with better enhancement effect. Provide a clear input for subsequent vehicle image processing algorithms and improve the performance. This defogging mapping relationship learning mechanism is the key to enhancing the defogging ability of the model.

[0040] Further, according to the obtained vehicle information, dividing the vehicles in the detection section into first detection vehicles and second detection vehicles according to the preset OBD port configuration database includes the following steps: Establish an OBD port configuration database, which contains vehicle model string information, vehicle model corresponding year information, vehicle model corresponding VIN code range, and vehicle model corresponding OBD port configuration information; Collect OBD port information of vehicles of different brands, different models, and different years. The OBD port configuration information includes port location, connector model, communication protocol, etc. Construct the corresponding relationship between the vehicle model string and the year, VIN code range. The vehicle model string accurately locates the vehicle model, and the VIN code determines the vehicle individual. Associate and store the OBD port configuration information with the vehicle model string and VIN code. Construct a standardized and structured database table structure. Provide a database interface to query the OBD port configuration according to the vehicle model or VIN code. The database can be extended to include OBD port data of more vehicle models. Reduce the access trial-and-error cost of the OBD acquisition device. Facilitate the improvement of OBD data acquisition efficiency. Provide a stable and accurate underlying data source for subsequent emission detection algorithms. Enhance the effectiveness and consistency of emission prediction. Provide support for applications such as emission over-standard warning. In summary, constructing an OBD port configuration database can provide an accurate reference for collecting OBD signals, thereby improving the efficiency and quality of subsequent emission detection. Among them, the VIN code, whose full name is Vehicle Identification Number, is the unique code used to identify a single vehicle. The VIN code is formulated according to international standards, and the same vehicle model around the world uses the same VIN code. The VIN code generally consists of 17 letters and numbers. The first 3 digits represent the manufacturer and manufacturer information, the middle 6 digits are the vehicle model information, and the last 8 digits are the serial number information. Through the VIN code, specific information such as the specific brand, manufacturer, year, and model of the vehicle can be traced and determined. The VIN code plate is generally pasted on the upper right of the vehicle intake grille or can also be printed on the inner side of the engine cover. By identifying and parsing the VIN code, specific information of the vehicle can be obtained for OBD configuration matching. The VIN code is the unique identifier for determining individual vehicle information and plays a key role in the vehicle detection system. Establishing an OBD configuration database with VIN code range mapping is an important link to achieve accurate identification.

[0041] Using the Levenshtein edit distance algorithm, set the edit distance threshold for vehicle type strings; the Levenshtein edit distance algorithm is an algorithm used to measure the difference between two sequences. Its main idea is to calculate the minimum number of edit operations required to convert one string into another. Edit operations include insertion, deletion, and substitution. For example: string 1 is "kitten"; string 2 is "sitting". Converting "kitten" to "sitting" requires 3 edit operations; replacing "k" with "s"; inserting "i" between "e" and "t"; replacing "n" with "g". So the Levenshtein distance between these two strings is 3. Generally, the steps to calculate the Levenshtein distance between two strings are as follows: Initialize a matrix as a two-dimensional matrix with the lengths of the two strings plus 1. Initialize the values in the 0th column and 0th row to 0 to the length of the string. Starting from the upper left corner of the matrix, calculate the value of each position one by one: If the two characters are equal, the value at this position in the matrix is equal to the value in its upper left corner; if the two characters are not equal, the value at this position in the matrix is the minimum of the values in its left, upper, and upper left positions plus 1; the value in the lower right corner of the matrix is the edit distance between the two strings. So the Levenshtein edit distance algorithm mainly uses the method of dynamic programming to calculate the minimum number of edit operations required to convert one string into another, thereby reflecting the difference between the two strings.

[0042] Set the allowable error range for the vehicle type year using the maximum allowable error range parameter; perform vehicle type matching based on the edit distance threshold and the vehicle type year error range; read the database and load data such as vehicle type strings and corresponding years into memory. Obtain the vehicle type string input by the user. Traverse all vehicle type strings in the database and calculate the edit distance. For the results with an edit distance less than the preset threshold, further determine whether the year error is within the allowable range. Compare the edit distances and year errors of different candidate results one by one and select the optimal matching item. Return the vehicle type information and OBD port configuration of the best matching item to the user. The edit distance calculation can use dynamic programming to solve the string comparison problem. The year error judgment can be simplified to an integer comparison operation. Indexing, hashing, etc. can be used to optimize the string search speed. Multi-process and distributed computing can process large-scale matching in parallel. The vehicle type string can be preprocessed to improve the comparison efficiency. The algorithm and parameters can be adjusted and optimized according to the actual situation to balance accuracy and efficiency. Modular design is convenient for code maintenance and optimization and upgrade.

[0043] When the vehicle model matching fails, perform VIN matching on the vehicle picture; according to the matching result, divide the vehicles into the first detection vehicles and the second detection vehicles; obtain the vehicle pictures and use OCR technology to identify the VIN information in the pictures. Search for the identified VIN in the database and judge the matching result. If the VIN matching is successful, query the corresponding OBD configuration according to the matched VIN information. If the VIN matching fails, divide the vehicle into the second detection vehicles. For the first detection vehicles, directly call the corresponding OBD configuration to start the detection. For the second detection vehicles, first perform automatic parameter identification to determine the communication protocol and the hardware line sequence. Image processing can improve the OCR recognition accuracy. Optimize the OCR algorithm to improve the robustness of VIN code recognition. The database can establish an index from the VIN code to the vehicle model to accelerate the search speed. The classification results can be saved in the database to avoid repeated recognition. The modular design decouples functions such as OCR recognition, VIN matching, and vehicle classification. The classification results can be used as feedback for data training and model optimization. It is beneficial to increase the detection coverage and improve the algorithm accuracy. In summary, OCR recognizes the VIN and uses the result for vehicle classification, which can expand the detection range, thereby improving the coverage and effectiveness of emission detection.

[0044] Among them, the vehicle model matching fails when the edit distance of the vehicle model string exceeds the distance threshold or the difference between the recognized year information and the year in the OBD port configuration database exceeds the allowable error range. Calculate the edit distance between the input vehicle model string and all strings in the database. Judge whether the edit distance exceeds the preset threshold. If it exceeds, the vehicle model matching fails. If the edit distance is within the threshold, further obtain the year corresponding to the input vehicle model. Search for the most matching vehicle model year information in the database. Calculate the absolute value of the difference between the two years. If the year difference exceeds the preset allowable error range, the matching fails. Optimize the edit distance algorithm to improve the calculation efficiency. The year information can be simplified to integer comparison to reduce the calculation requirements. Preprocess the vehicle model string to reduce unnecessary comparisons. Optimize the database index to accelerate the access to key information. Setting the failure condition threshold parameter can flexibly adjust the matching strategy. The modular implementation of vehicle model matching and year verification makes the code structure clear. Recording the reasons for failure can be used to analyze and optimize the subsequent matching strategy. In summary, analyzing the definition of matching failure from the execution process is beneficial to guiding algorithm optimization and improving the efficiency and success rate of vehicle model and OBD information matching.

[0045] Furthermore, VIN matching for vehicle pictures includes the following steps: Use the Faster RCNN object detection algorithm to identify the VIN code area in the vehicle picture; construct a VIN code area dataset and label the VIN code position. Train the Faster RCNN model to learn to detect the VIN code area. Input the vehicle picture and extract the basic feature map. Generate region proposals and predict possible candidate bounding boxes for the VIN area. Use ROI pooling to obtain the feature of each candidate box area. Based on the region features, classify and regress to predict the VIN code area. Further screen the detection boxes with high confidence as the VIN area. Optimize the network structure to improve the detection accuracy. Data augmentation is used to increase the training sample size of vehicle pictures. Online hard example mining further improves the detection effect. Reduce the candidate boxes to accelerate the detection speed. Use the prior position information to filter out unreasonable detection results. The extracted VIN code area is used for subsequent OCR recognition. In summary, Faster RCNN can effectively detect the VIN code position, provide support for improving the subsequent OCR recognition effect, and thus improve the vehicle model matching and emission detection quality.

[0046] A sequence image recognition model using the CTC loss function to recognize the VIN code sequence; in this application, multi-scenario vehicle VIN code images containing different vehicle models and different shooting angles are collected, and the training set, validation set, and test set are divided in a ratio of 7:2:1. The VIN code region is labeled using the object detection algorithm based on YOLOv5 to obtain a dataset containing VIN code images and the corresponding annotation box coordinates. A convolutional neural network based on ResNet is used as the feature extractor of the sequence image recognition model, and two fully connected layers are connected behind it to output the text sequence. The CTC loss function is connected to the last fully connected layer to measure the edit distance between the predicted output sequence and the target sequence. The model is trained using the Adam optimizer, with the initial learning rate set to 0.001 and decayed by a factor of 0.1 every 10 epochs. The training batch size is set to 64. The early stopping method is used, and training is stopped early when the validation set loss does not decrease for 3 consecutive epochs, and the best model is saved. For the input vehicle image, the trained YOLOv5 object detection model is used to recognize the VIN code region, and the VIN code sub-image is cropped. The VIN code sub-image is resized to an appropriate size and input into the sequence image recognition model to output the text sequence. According to the composition structure of the VIN code, the recognition result is parsed. Check whether the recognition result conforms to the VIN code rules. If it passes the check, the matching VIN code and the corresponding OBD port configuration information are searched in the established OBD configuration database. Collect more various VIN code scenario images to continue to optimize the model, such as using a more efficient network structure like Efficient Net, increasing the model capacity to improve the recognition ability, and using methods such as image enhancement to improve the generalization ability of the model. In this way, by comprehensively using the object detection and sequence image recognition models, the accurate recognition rate of the VIN code can be effectively improved, thereby improving the accuracy of subsequent obtaining OBD configuration information and providing support for improving the overall vehicle emissions detection accuracy. Among them, the CTC loss function, CTC (Connectionist Temporal Classification) is a loss function used for sequence recognition tasks, usually applied in fields such as speech recognition and scene text recognition. The full name of the CTC loss function is Connectionist Temporal Classification. It can directly train variable-length input sequences without alignment annotations. Blank labels are introduced, allowing the output to not correspond to the symbols of the input. Calculate the matching cost between all possible output sequences and the target sequence. Take the negative logarithm of the sum of the costs of all paths as the final CTC loss. It aims to solve the annotation alignment problem and reduce the difficulty of sequence learning. The use of this loss function greatly simplifies the training process of the sequence prediction task. In VIN code image recognition, it can directly perform end-to-end learning without precisely positioning and cropping each character. It avoids the complex character segmentation, recognition, and splicing processes, making the model training simpler and more effective.

[0047] According to the VIN code specification, the parsed and recognized VIN code sequence is matched with the VIN in the established OBD port configuration database. In this application, according to the international standard ISO3779 and the national standard GB / T29791, the composition structure of the VIN code is parsed, which includes three regions: World Manufacturer Identifier (WMI): identifying the manufacturer, Vehicle Descriptor: describing information such as brand and model, and Check Digit: verifying the correctness of the VIN code; for the recognition result, the WMI information is extracted using regular expressions to determine the vehicle manufacturer, and a bidirectional LSTM model with voice prosody features is used to recognize the Chinese vehicle model information included in the vehicle descriptor, calculate the check digit, and verify whether the recognition sequence is correct; in the established OBD configuration database, it contains the VIN code range information of different vehicle models under each manufacturer. The parsed WMI and vehicle descriptor information are matched in the database. If the match is successful, the corresponding OBD port configuration information is returned; attempt to connect to the returned OBD port configuration and read the real-time data, and compare the read OBD data with the vehicle information in the picture. If they are consistent, confirm that the match is successful; if they are inconsistent, re-recognize the VIN code; collect more VIN code scenario data, continue to train the model to improve the recognition robustness, expand the database to include more comprehensive VIN-OBD corresponding information, adopt interpretable AI technology to analyze the recognition error situation, and adjust the model to improve the accuracy; by parsing the VIN composition structure, database matching, and OBD information verification, it can ensure the correctness of the VIN recognition result, thereby accurately obtaining the OBD port configuration information, providing guarantee for subsequent vehicle emission detection, and improving the accuracy of the overall vehicle emission detection.

[0048] Further, according to the obtained road information, correcting the first predicted emissions and the second predicted emissions by correction factors includes the following steps: calculating the vehicle traffic volume of the detection section according to the number of lanes; calculating the average driving speed of the vehicle according to the road speed limit and traffic conditions; calculating the number of lanes and the vehicle traffic volume. In the video image, using semantic segmentation technology to identify each lane area, separately detecting and tracking vehicles in each lane area, and counting the number of vehicles passing through each lane per unit time, that is, the vehicle traffic volume. Summarize the traffic volume of each lane to obtain the total vehicle traffic volume of the section; determining the speed limit and traffic conditions, obtaining the speed limit sign through image recognition to determine the road speed limit, using the vehicle detection algorithm based on YOLO to count the number of vehicles per unit time, judging the congestion state, and judging the traffic conditions according to the congestion state, headway, etc.; calculating the average vehicle speed, tracking the same vehicle in the video image, calculating the time t to pass through the section, counting the passing times of a large number of vehicles, removing outliers, calculating the average passing time t_avg, and then dividing it by the section length L to obtain the average vehicle speed V_avg; model optimization, collecting data sets of various traffic scenarios, improving the adaptability of the model to complex environments, adopting the strategy of machine learning model fusion to improve the robustness of vehicle detection and tracking, adding multi-source data such as meteorological sensors, and improving the accuracy of traffic condition judgment. Through the above technical means, the vehicle traffic volume and average speed information can be accurately obtained, providing key inputs for subsequent emissions calculation and model correction, thereby improving the overall accuracy of vehicle emissions detection.

[0049] Based on the calculated vehicle traffic volume and average driving speed, establish an emission mapping model based on vehicle power to calculate the vehicle emissions corresponding to different speeds; data collection: under a standardized test environment, measure the fuel consumption of different brand models at different speeds, convert it into fuel consumption per kilometer and emissions per kilometer, and collect technical indicators such as the power parameters of the vehicle; model establishment, use the vehicle fuel consumption and technical parameter data to establish a vehicle fuel consumption prediction model based on a BP neural network, establish a proportional relationship model between emissions and fuel consumption, combine the above models, and establish an emissions prediction model based on vehicle power; emission calculation, input the detected vehicle traffic volume and average speed, calculate the proportion of the occupied brands and models according to the distribution of passing vehicle models, query the power parameters of each brand model, substitute them into the emission prediction model, and calculate the corresponding emissions at different speeds; model optimization, collect more actual road detection data, expand the model training set, adopt deep learning methods, construct more powerful prediction models such as convolutional neural networks, add inputs such as vehicle models and environmental factors, and improve the applicability of the model. By constructing an emission prediction model and combining measured traffic parameters, the emissions corresponding to different speeds can be accurately calculated, providing an accurate mapping relationship for subsequent model correction.

[0050] Obtain the vehicle emission data of the detection section, construct a random forest regression model as the correction model, and input the average driving speed, vehicle model, ambient temperature and humidity, and the vehicle emissions output by the emission mapping model; Emission data collection

[0051] Set up emission monitoring equipment on the detection section to obtain actual vehicle emission data. At the same time, record the average speed, brand model, and ambient temperature and humidity data of the corresponding vehicles, clean and process the data, remove outliers, and construct the training set of the correction model; Random forest model construction, use the average speed, vehicle type, temperature and humidity as feature inputs, and the output of the emission mapping model as an additional input feature. Set the number of trees, select the maximum number of features and samples, and use the training set data to train the random forest regression model; Model correction, for the first vehicle, according to its speed and model, use the model to predict the correction coefficient. For the second vehicle, substitute the average speed and the corresponding brand into the model to predict the correction coefficient, and multiply the predicted emissions by the correction coefficient to obtain the correction result; Model optimization, collect more emission data from other sections, expand the sample size, improve the robustness of the model, conduct comparative tests using popular regression algorithms such as GBDT, select the model with the best effect, and optimize the model hyperparameters, such as the number of trees, the maximum number of features, etc., to prevent overfitting. By constructing an accurate correction model and combining the actual collected data, the correction coefficient can be accurately predicted, thereby improving the accuracy of vehicle emissions prediction and providing support for subsequent emission monitoring work.

[0052] For the first predicted emissions, according to the speed and vehicle model of the corresponding vehicle, use the correction model to obtain the first correction coefficient and correct the first predicted emissions; First predicted emissions acquisition, for vehicles equipped with OBD ports, obtain real-time emission data through OBD devices, calculate the emissions corresponding to each vehicle as the first predicted emissions; Correction coefficient calculation, use parameters such as vehicle average speed and brand model, input these parameters into the pre-trained random forest regression model, and the model outputs the first correction coefficient; Emissions correction, multiply the first predicted emissions by the corresponding first correction coefficient to obtain the corrected first predicted emissions; Correction evaluation, compare the emissions differences before and after correction, analyze the correction effect, such as the correlation and error distribution before and after correction, and evaluate the effectiveness of the correction model; Model optimization, collect more actual vehicle emission data and parameters, expand the training samples of the correction model, tune the parameters to optimize the random forest model, improve the regression accuracy, and try algorithms such as ensemble learning to construct a more powerful correction model. By performing model correction on the real-time emission data of the first group of vehicles, the data accuracy collected by OBD can be improved.

[0053] For the second predicted emissions, according to the average driving speed of the corresponding vehicle model, a second correction coefficient is obtained using the correction model to correct the second predicted emissions. Calculation of the second predicted emissions: For vehicles without an OBD port, the emission mapping model is used to predict emissions, and the predicted emissions corresponding to each vehicle are calculated as the second predicted emissions; Calculation of the correction coefficient: Using the average speed parameter of the corresponding vehicle model, the parameter is input into a pre-trained random forest regression model, and the model outputs the second correction coefficient; Emission correction: Multiply the second predicted emissions by the corresponding second correction coefficient to obtain the corrected second predicted emissions; Correction evaluation: Compare the second predicted emissions before and after correction, analyze the effect of the correction on the second vehicle, and evaluate the applicability of the correction model to the second vehicle; Model optimization: Collect more actual emission data and speed parameters of the second vehicle as samples, optimize the structure and hyperparameters of the regression model, improve the fitting effect on the second vehicle, try different combinations of models, and construct a more powerful correction model for the second vehicle. By performing model correction on the second vehicle group, the prediction effect based on the mapping model can be improved, making it closer to the actual situation, thereby enhancing the overall quality of vehicle emission monitoring.

[0054] Further, the emission mapping model is a recursive neural network model. Measured emission data of vehicles with different models and different vehicle ages at different speeds are collected as the training data set. The vehicle speed is encoded as a one-hot vector as the model input. A recursive neural network model with a bidirectional LSTM network architecture is adopted. The input layer is the one-hot vector of the speed. After extracting the speed time series features through the bidirectional LSTM, a fully connected layer is finally connected to obtain the emission prediction corresponding to the speed. The number of hidden nodes in the LSTM layer is set to 128, and the regularization method is early stopping to avoid overfitting. The mean squared error is used as the loss function, and the Adam Optimizer is used as the optimizer. After training is completed, the RMSE and R2 scores of the model's predicted emissions are evaluated using the test set. The Grid Search method is used to tune the parameters to determine hyperparameters such as the number of LSTM layers and nodes. Case analysis is performed on samples with large test errors to find the reasons for the model's underfitting, and then the model structure is optimized. The model integration method is adopted, combined with the random forest model for prediction, to improve the generalization ability. An automatic model performance monitoring and updating mechanism is established to automatically retrain the model after detecting a decline in model performance.

[0055] 3. Beneficial effects

[0056] Compared with the prior art, the advantages of the present invention are as follows:

[0057] (1) Identify the vehicle brand and model through video images, and classify the vehicles in detail according to the preset OBD port configuration database. For vehicles equipped with OBD ports, obtain OBD emission data, and for vehicles without OBD ports, use a machine learning model to predict emissions. This idea of combining OBD data and machine learning prediction can improve the accuracy of emissions detection for different types of vehicles;

[0058] (2) In terms of vehicle information identification, a convolutional neural network with an attention mechanism is used to identify the brand, a convolutional neural network combined with year classification is used to identify the model, and various deep learning technologies such as VIN code identification are adopted. The use of these technologies can effectively improve the accuracy of vehicle information extraction, reduce the misjudgment rate, and thus improve the accuracy of subsequent emissions prediction;

[0059] (3) An emission mapping model considering speed and environmental factors is established, and a random forest model is used to obtain correction coefficients to correct the predicted emissions. This idea of combining a physical model with a data-driven model for emission correction can make the final emissions prediction result more accurate and reliable, effectively improving the detection accuracy. Description of the Drawings

[0060] This specification will be further described in the form of exemplary embodiments, and these exemplary embodiments will be described in detail through the drawings. These embodiments are not restrictive. In these embodiments, the same numbers represent the same structures, where:

[0061] Figure 1 is an exemplary flowchart of a method for detecting vehicle emissions according to some embodiments of this specification;

[0062] Figure 2 is an exemplary flowchart of obtaining vehicle information according to some embodiments of this specification;

[0063] Figure 3 is an exemplary flowchart of classifying the types of vehicles to be detected according to some embodiments of this specification;

[0064] Figure 4 is an exemplary flowchart of obtaining correction coefficients according to some embodiments of this specification. Detailed Embodiments

[0065] To more clearly illustrate the technical solutions of the embodiments of this specification, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some examples or embodiments of this specification. For those of ordinary skill in the art, without creative efforts, this specification can also be applied to other similar scenarios based on these drawings. Unless obvious from the language context or otherwise stated, the same reference numerals in the figures represent the same structure or operation.

[0066] The following will detail the methods and systems provided by the embodiments of this specification in conjunction with the accompanying drawings.

[0067] Figure 1 is an exemplary flowchart of a method for detecting vehicle emissions shown according to some embodiments of this specification, as Figure 1As shown in the figure, a method for detecting vehicle emissions includes: S110 obtaining video images and road information of vehicle monitoring on the detection section, where the road information includes the number of lanes, road speed limit, traffic conditions, and environmental temperature and humidity; the video images can accurately identify vehicle brands and models and are the key source for obtaining vehicle information. Compared with simple vehicle model matching, image recognition can improve the accuracy of information acquisition. The number of lanes reflects the traffic flow on the section and is a necessary parameter for calculating the total emissions of the section. The speed limit and traffic conditions determine the average driving speed of the vehicle, and vehicle speed is an important factor affecting emissions. These data help to establish an accurate emission prediction model. Environmental temperature and humidity affect engine combustion efficiency and thus emissions. Considering these factors can improve the environmental adaptability of the prediction model. By obtaining refined vehicle information and road parameters, a personalized emission prediction model for different vehicle models, speeds, and environments can be established. The video images collect vehicle data without the need for the vehicle to stop testing, and all passing vehicles can be detected, with a wide coverage. With the help of image recognition and intelligent algorithms, the problems of small sample size and limited detection range in existing vehicle emission monitoring can be effectively solved. In summary, this application can comprehensively obtain information on various factors affecting emissions, construct a refined emission prediction model, and thus improve the accuracy and scope of vehicle emission monitoring. S120 obtaining vehicle information in the video images by using image recognition, where the vehicle information includes vehicle brand and vehicle model; S130 dividing the vehicles on the detection section into first detection vehicles and second detection vehicles according to the obtained vehicle information and the preset OBD port configuration database, where the first detection vehicles are vehicles equipped with OBD ports and the second detection vehicles are vehicles not equipped with OBD ports; S140 for the first detection vehicles, obtaining vehicle instantaneous emission data through wireless communication with in-vehicle OBD devices and calculating the emissions within a preset time period as the first predicted emissions; for the second detection vehicles, obtaining the second predicted emissions by using a vehicle emission prediction model trained based on a machine learning algorithm; S150 correcting the first predicted emissions and the second predicted emissions respectively through correction factors according to the obtained road information; S160 calculating the total emissions of the detection section according to the corrected first predicted emissions and the second predicted emissions; where the road speed limit is the speed limit of the detection section; the traffic conditions are the traffic flow and average vehicle speed of the detection section.

[0068] Among them, video images and road information are obtained, and vehicle brands and models are obtained by image recognition. According to the vehicle information, the vehicles are divided into the first detected vehicles equipped with OBD ports and the second detected vehicles not equipped with OBD ports according to the OBD port configuration database. For the first detected vehicles, real-time emission data is obtained through OBD devices to calculate the first predicted emission amount. For the second detected vehicles, a machine learning model is used to predict the second predicted emission amount. According to the road information, correction factors are obtained to correct the first and second predicted emission amounts respectively. The sum of the two groups of corrected predicted emission amounts is calculated to obtain the total emission amount of the detected section. Algorithms such as image segmentation, defogging, filtering, and enhancement are used to improve the accuracy of vehicle information recognition. An OBD port configuration database is established, and the OBD configuration of the vehicle is determined by matching the vehicle model and VIN. An emission mapping model based on vehicle power and speed is established as a correction model to correct the predicted emission amount. Using a recurrent neural network as the emission mapping model can improve the detection accuracy. Generally speaking, this method realizes the detection and calculation of vehicle emissions in a complex environment through a combination of technical means such as image recognition, on-vehicle sensor collection, and machine learning prediction, and uses multiple models for correction to improve the detection accuracy.

[0069] In summary, classifying the vehicles in the detected section into vehicles equipped with OBD ports and vehicles not equipped with OBD ports can more accurately obtain the emission data of different types of vehicles. For vehicles equipped with OBD ports, instantaneous emission data can be obtained through the real-time communication of on-vehicle OBD devices, and the actual emission situation of the vehicle can be directly obtained, which is not affected by vehicle models and usage conditions, improving the detection accuracy. For vehicles not equipped with OBD ports, a machine learning-based model is used to predict the emission amount, and the model can be trained according to factors such as vehicle models and usage conditions to improve the prediction accuracy. Introducing the correction factor of road information to correct the predicted emission amount can reduce the impact of road conditions on emissions and improve the accuracy of the corrected result. Considering more influencing factors, such as the number of lanes, speed limits, traffic flow, environmental temperature and humidity, etc., can compensate for the deviation of emission prediction from more dimensions and improve the accuracy. Detecting and predicting the emission amounts of the two types of vehicles respectively, correcting the deviation, and comprehensively calculating the total emission amount can improve the overall accuracy and reliability of vehicle emission detection. Through the above improvement measures, the single-vehicle emission data can be obtained more accurately, and the result can be corrected according to the actual road conditions, thereby improving the overall accuracy of this vehicle emission detection method and obtaining a more accurate and reliable emission statistics result.

[0070] In a specific embodiment of the present application, a detection section is set up on a certain highway, equipped with high-definition cameras to obtain vehicle video images. The length of the detection section is 20 kilometers, with 6 lanes in both directions and a speed limit of 120 km / h. Through image recognition, 500 electric vehicles of the BYD e6 model are detected. According to the preset OBD port configuration database, all BYD e6 vehicles are equipped with OBD ports. Then these 500 vehicles are determined as the first detection vehicles. Through the wireless communication module of the in-vehicle OBD device, data such as the instantaneous vehicle speed, motor output power, and battery voltage of these 500 electric vehicles are collected every 5 minutes, and the instantaneous emissions of each vehicle are calculated through a detection algorithm. For the other 2000 fuel vehicles detected, after determining the vehicle model and displacement through picture recognition, a machine learning emission prediction model trained for different vehicle models is used to obtain the predicted emissions of each fuel vehicle. According to the traffic flow and environmental temperature data during the detection period, a correction coefficient is introduced to correct the detection and prediction results of the first detection vehicles and the second detection vehicles. By comprehensively considering the corrected emissions of the two types of vehicles, the total emissions of the detection section are calculated. By applying technical means such as OBD direct communication, machine learning prediction, and correction coefficients, the accuracy and effectiveness of vehicle emission detection can be improved, and more accurate road emission statistics can be obtained.

[0071] Figure 2 is an exemplary flowchart for obtaining vehicle information according to some embodiments of this specification, as Figure 2 shown, to obtain vehicle information in the video image using image recognition, the vehicle information includes vehicle brand and vehicle model, and the steps are as follows: S121 For the obtained video image, an interpretable instance segmentation algorithm is used to obtain a vehicle picture containing the entire vehicle; the obtained vehicle picture is processed by a deep learning-based image dehazing algorithm for filtering and noise reduction; S122 The processed vehicle picture is input into a convolutional neural network based on an attention mechanism to obtain the vehicle brand; S123 The processed vehicle picture is input into a convolutional neural network combined with vehicle model year classification to obtain the vehicle model containing year information; S124 The obtained vehicle brand and vehicle model are input into a convolutional neural network based on a confidence fusion algorithm to obtain the vehicle information recognition result.

[0072] Among them, by using an interpretable instance segmentation algorithm, pictures containing the entire vehicle can be more accurately extracted from video images, laying a foundation for subsequent recognition and processing. By using an image dehazing filtering algorithm, the impact of environmental haze on vehicle pictures can be reduced, improving the robustness of subsequent recognition. By using a convolutional neural network based on the attention mechanism to recognize vehicle brands, the accuracy of logo recognition can be improved. By using a convolutional neural network that considers vehicle model year classification to recognize vehicle models, the recognition ability for vehicle models of different years can be increased, improving the accuracy of vehicle model recognition. By adopting multi-network collaboration based on confidence fusion, the advantages of different networks can be integrated, and the reliability of the vehicle model and brand recognition results can be screened, reducing recognition errors. Obtaining vehicle model information containing the year can provide a basis for subsequent determination of vehicle OBD configurations, improving the accuracy of obtaining vehicle configuration information. The overall process combines technologies such as interpretable segmentation, image enhancement, attention mechanism, and multi-network fusion, which can effectively improve the recognition accuracy of vehicle brands and models, lay a foundation for subsequent emission detection, and improve the overall effect of vehicle emission detection. By applying advanced computer vision and deep learning technologies, the ability to automatically extract vehicle information from video images can be greatly improved, and more accurate and reliable vehicle brand and model information can be obtained, which is beneficial for subsequent emission detection and calculation.

[0073] Specifically, by using real vehicle pictures and fake vehicle picture samples generated by a generative adversarial network, the adaptability of the model to complex actual scenarios can be improved, enhancing the robustness of the model. By adding an attention mechanism to Mask RCNN, it can focus on the target vehicle area, improving the extraction accuracy of the vehicle. By using the enhanced-trained Mask RCNN for instance segmentation of video images, the segmentation accuracy of the area containing the entire vehicle can be effectively improved. By performing semantic segmentation to obtain the vehicle body mask, irrelevant background interference can be excluded, and higher-quality vehicle pictures can be obtained. The entire process makes full use of technologies such as generative adversarial networks, attention mechanisms, instance segmentation, and semantic segmentation, which can significantly improve the ability to accurately extract pictures of the entire vehicle from complex scenarios. Obtaining high-quality vehicle pictures provides a reliable guarantee for subsequent vehicle model and brand recognition, thereby improving the overall effect of vehicle emission detection. This vehicle picture extraction scheme can provide an input source for the vehicle emission detection system and is an important link to improve detection accuracy. In summary, using multiple advanced deep learning technologies to collaboratively improve the vehicle picture extraction effect is the key to enhancing the performance of the entire vehicle emission detection system.

[0074] Specifically, the dehazing algorithm based on the dark channel prior can effectively remove the fog component in vehicle images and improve the image quality. Median filtering, as a preprocessing step, can smooth the image, effectively reduce sampling noise, and prepare for noise reduction. The deep denoising network based on the encoder-decoder can efficiently remove noises such as burrs and spots in the image and enhance the image quality. Adaptive Gamma correction, as a postprocessing step, can enhance the image contrast and details and strengthen vehicle features. The entire process combines classical image processing and deep learning dehazing and denoising techniques, which can significantly improve the quality of vehicle images and provide high-quality inputs for subsequent recognition tasks. High-quality vehicle images are beneficial to improving the accuracy of brand and model recognition, and thus improving the accuracy of vehicle emission detection. Image enhancement is an important preprocessing module in the vehicle emission detection system and has a direct impact on the system performance. Selecting a suitable algorithm process is crucial.

[0075] More specifically, collecting vehicle image samples with no noise and different added noises can improve the model accuracy for judging the noise type and noise point distribution. Using a convolutional neural network to judge the noise type and noise point density distribution can accurately obtain the noise characteristics of the image and provide a basis for selecting the filter kernel. Using filter kernels of different sizes according to different types and densities of noises can smooth noise points of different degrees in a targeted manner and prevent the image from being blurred due to filtering. Selecting a larger-size M1 filter kernel for the case of a large Gaussian noise point density can more effectively smooth the high-density noise points. Selecting a smaller-size M2 filter kernel for the case of a small salt-and-pepper noise point density can avoid over-smoothing the image details. The square filter kernel has a simple and efficient structure, is suitable for hardware implementation, and can reduce the algorithm calculation amount. This adaptive median filtering scheme can effectively smooth different types and densities of noises and retain vehicle features, providing higher-quality images for subsequent recognition. Improving the quality of vehicle images is an important link in enhancing the vehicle emission detection effect, and this filtering algorithm is of great significance. In summary, this median filtering preprocessing scheme is technically mature and reliable and plays an important role in improving the accuracy of vehicle emission detection.

[0076] Specifically, in this embodiment, for Gaussian noise, when the noise point density is greater than 0.01 (i.e., the proportion of noise points in the picture exceeds 1%), a median filter kernel with a size of 5×5 is selected. For salt-and-pepper noise, when the noise point density is less than 0.005 (i.e., the proportion of noise points in the picture is less than 0.5%), a median filter kernel with a size of 3×3 is selected. In practical applications, 100 vehicle picture samples with different degrees of noise are collected for testing. The convolutional neural network is used to judge the noise type and noise point density for the sample pictures. According to the judgment results, the filter kernel with the corresponding size is automatically selected for filtering. A 5×5 filter kernel is used for the sample pictures with Gaussian noise, and a 3×3 filter kernel is used for the sample pictures with salt-and-pepper noise. The noise in the processed sample pictures is significantly reduced, and the vehicle features are effectively retained. Through this embodiment, the effectiveness of adaptively selecting the filter kernel size according to the noise characteristics is verified. This application can effectively smooth different noises, improve the quality of vehicle pictures, and has positive significance for improving the accuracy of subsequent vehicle emission detection.

[0077] More specifically, the dark channel prior feature extraction module can efficiently obtain the fog distribution information of the image and provide important prior knowledge for the defogging module. Taking the dark channel feature as a condition and introducing a conditional generative adversarial network for defogging can effectively utilize the prior to constrain image defogging. The generator learns the distribution of the defogged image, and the discriminator judges the defogging effect, and the ideal defogging mapping relationship can be continuously approximated. By continuously updating the generator parameters through adversarial learning, it is possible to learn defogging directly from unlabeled data without relying on a large dataset of matching pairs. Training with foggy pictures of different concentrations can improve the defogging generalization ability of the model for different degrees of haze. This defogging framework fully integrates the capabilities of classical image priors and generative adversarial networks, and can effectively improve the image defogging effect. Improving the quality of vehicle pictures has a direct promoting effect on the accuracy of vehicle emission detection and has important technical value.

[0078] In a specific embodiment of the present application: A detection section is set on a certain road section, and high-definition cameras are used to obtain video images of vehicles on the road section. The Mask RCNN instance segmentation model is used to process the video images to extract pictures containing target vehicles. The instance segmentation model used is pre-trained on a vehicle picture dataset. A deep neural network based on the dark channel prior is used to de-haze the segmented vehicle pictures. The de-hazing model is trained on pictures of different haze concentrations. A convolutional neural network is used to judge the noise type and distribution of the de-hazed pictures, and a median filter kernel is selected to adaptively filter different noises. A deep learning denoising with an encoder-decoder structure is used to automatically remove the noise. An enhancement algorithm is used to enhance the contrast and details of the filtered and denoised pictures. The enhanced pictures are input into a convolutional neural network with an attention mechanism designed for vehicle brands to identify the brand. The enhanced pictures are input into a convolutional neural network considering the vehicle model year to identify the vehicle model containing year information. The two recognition results are input into a confidence fusion convolutional neural network to obtain the final vehicle information. According to the vehicle information, vehicles equipped with OBD are distinguished and different detection methods are adopted. It can be seen from this example that this vehicle emission detection scheme combines image processing with multiple deep learning models, and can effectively obtain accurate vehicle information, thereby improving the accuracy of subsequent emission prediction.

[0079] Figure 3 is an exemplary flowchart for dividing and detecting vehicle types according to some embodiments of this specification, as Figure 3 shown, according to the obtained vehicle information, dividing the vehicles in the detection section into first detection vehicles and second detection vehicles according to a preset OBD port configuration database includes the following steps: S131 Establish an OBD port configuration database, which includes vehicle model string information, vehicle model corresponding year information, vehicle model corresponding VIN code range, and vehicle model corresponding OBD port configuration information; S132 Use the Levenshtein edit distance algorithm to set the vehicle model string edit distance threshold; S133 Use the maximum allowable error range parameter to set the allowable error range of the vehicle model year; S134 According to the edit distance threshold and the vehicle model year error range, perform vehicle model matching; S135 When the vehicle model matching fails, perform VIN matching on the vehicle pictures; S136 According to the matching results, divide the vehicles into first detection vehicles and second detection vehicles; wherein, the vehicle model matching fails when the edit distance of the vehicle model string exceeds the distance threshold or the difference between the recognized year information and the year in the OBD port configuration database exceeds the allowable error range.

[0080] Building a database containing rich vehicle models, years, VIN codes, and OBD configuration information can provide a reliable basis for vehicle type classification. Using the edit distance algorithm for vehicle model string matching can improve the matching accuracy and reduce the probability of incorrect matching. Setting the edit distance threshold can control the flexibility of the matching. Setting the allowable error range for vehicle model years can tolerate small errors in vehicle model year information recognition and improve the matching robustness. Prioritizing quick matching judgment based on vehicle model strings and years and then using VIN code images for accurate matching when it fails can make the matching process more robust and reliable. Classifying the detected vehicle types is the basis for implementing different detection strategies and is crucial for improving the subsequent detection accuracy. This vehicle determination scheme makes full use of the associated information of vehicle models, years, and VIN codes and uses the edit distance algorithm and error tolerance setting to improve the accuracy and robustness of the matching.

[0081] Using the Faster RCNN detection algorithm can quickly and accurately locate the VIN code area in the picture and improve the efficiency of subsequent recognition. The sequence image recognition model combined with the CTC loss function can directly learn the character sequence in the VIN code end-to-end without single-character segmentation. The VIN code conforms to a unified specification, and the recognition result can be parsed according to the specification and converted into a standardized VIN code. Searching for the VIN code in the constructed OBD configuration database can quickly obtain the OBD port information of the target vehicle. The VIN code contains the vehicle's unique identification information, and using VIN code matching can accurately determine the vehicle configuration and improve the detection accuracy. This VIN matching technical process fully integrates the advantages of a variety of deep learning and digital image processing algorithms and can significantly improve the matching accuracy. Improving the recognition and matching accuracy of the VIN code is of great significance for enhancing the performance of the vehicle emission detection system.

[0082] In a specific embodiment of this application, an OBD configuration database containing 100,000 records is built, recording the years, VIN code ranges, and OBD port type information of different vehicle models of mainstream brands. Detection equipment is set up at a highway toll station in Beijing to obtain the video images of passing vehicles. Using Mask RCNN instance segmentation on the video images to obtain pictures of individual vehicles. Using a CNN model based on the attention mechanism to identify the brand and vehicle models containing year information. Comparing the recognition results with the database, setting the edit distance threshold to 3 and the year error range to 2 years. When the vehicle model information comparison fails, using Faster RCNN to detect the VIN code area and using a sequence recognition model trained with CTC loss to recognize the VIN code. Parsing the result according to the VIN code specification, searching for the matching VIN code range in the database, and obtaining the OBD port information. Classifying the passing vehicles into detected vehicles with OBD ports and detected vehicles without OBD ports according to the matching results. Using different emission detection equipment and algorithms to detect the two types of vehicles respectively.

[0083] Figure 4 is an exemplary flowchart for obtaining a correction coefficient shown in some embodiments of this specification. As Figure 4 shown, according to the obtained road information, correcting the first predicted emission amount and the second predicted emission amount by the correction coefficient respectively includes the following steps: S151 Calculate the vehicle traffic volume of the detection section according to the number of lanes; calculate the average driving speed of the vehicle according to the road speed limit and traffic conditions; S152 Based on the calculated vehicle traffic volume and average driving speed, establish an emission mapping model based on vehicle power, and calculate the corresponding vehicle emission amounts at different speeds; S153 Obtain the vehicle emission data of the detection section, construct a random forest regression model as the correction model, and input the average driving speed, vehicle model, environmental temperature and humidity, and the vehicle emission amount output by the emission mapping model; S154 For the first predicted emission amount, according to the speed and vehicle model of the corresponding vehicle, obtain the first correction coefficient by using the correction model, and correct the first predicted emission amount; S155 For the second predicted emission amount, according to the average driving speed of the corresponding vehicle model, obtain the second correction coefficient by using the correction model, and correct the second predicted emission amount.

[0084] Among them, calculate the traffic volume of the road section according to the number of lanes, and estimate the average vehicle speed in combination with the speed limit and traffic conditions. Based on the traffic volume and average speed, establish an emission mapping model to predict the emission levels at different speeds. The emission mapping model is a recursive neural network model. Collect the measured emission data of the road section and train a random forest regression model as the correction model. For vehicles equipped with OBD, predict the preliminary emission amount according to the vehicle speed, vehicle model, etc., and obtain the first correction coefficient through correction by the correction model for correction. For vehicles without OBD, predict the preliminary emission amount according to the average speed and vehicle model information, and obtain the second correction coefficient through the correction model for correction. The emission mapping model reasonably sets the emission levels at different speeds. The correction model is trained through big data for detailed individual correction. The two-stage prediction + correction process greatly improves the result accuracy. It is applicable to the unified emission detection of various types of vehicles to obtain accurate and reliable results. It provides an accurate basis for subsequent vehicle emission supervision.

[0085] In a specific embodiment of the present application, an automatic detection device is set up on a six-lane section of a certain detection road section, and the traffic flow within a week is counted as an average of 2,000 vehicles per hour. The vehicle speeds at different time periods within a week on this road section are counted, and the average vehicle speed is calculated to be 45 km / h. A recursive neural network is used to establish an emission mapping model, and the flow rate of 2,000 vehicles / h and the average vehicle speed of 45 km / h are input to predict the preliminary emissions. Measured emission data and parameters such as vehicle speed, vehicle type, temperature, and humidity of 5,000 vehicles of different models are collected on this road section. The collected data is used to train a random forest regression model as a correction model. For a sedan equipped with an OBD, according to its vehicle speed of 60 km / h and Audi A6 model, the emission mapping model predicts the preliminary emissions. By inputting parameters such as speed and vehicle type, the correction model outputs a first correction coefficient of 0.9 to obtain the corrected emissions. For a truck without an OBD, by inputting an average speed of 45 km / h and Jiefang brand CA6 model, the emission mapping model predicts the preliminary quantity, and the second correction coefficient output by the correction model is used to obtain the corrected emissions. The emission prediction results of the two types of vehicles after correction conform to the measured values, verifying the effectiveness of the present application.

Claims

1. A method for detecting automobile emissions, characterized in that: include: Obtain video images and road information from vehicle monitoring on the detection section. The road information includes the number of lanes, road speed limit, traffic conditions, and ambient temperature and humidity; Using image recognition to obtain vehicle information in the video image, the vehicle information includes vehicle brand and vehicle model; According to the acquired vehicle information, the vehicles on the detection section are divided into first detection vehicles and second detection vehicles according to the preset OBD port configuration database, wherein the first detection vehicle is a vehicle configured with an OBD port, and the second detection vehicle is a vehicle not configured with an OBD port; For the first detection vehicle, the instantaneous emission data of the vehicle is obtained by wirelessly communicating with the vehicle-mounted OBD device, and the emission amount within a preset time period is calculated as the first predicted emission amount; For the second detected vehicle, using a vehicle emission prediction model trained based on a machine learning algorithm to obtain a second predicted emission amount; According to the acquired road information, respectively correct the first predicted emission and the second predicted emission by using a correction coefficient; Calculating the total emission of the detection section according to the corrected first predicted emission and the second predicted emission; The road speed limit is the speed limit of the detection section; the traffic condition is the traffic flow and average vehicle speed of the detection section; The step of obtaining the second predicted emission includes the following steps: Collect information including vehicle model, age, driving speed and road conditions to build a sample data set; Preprocess the sample data set, perform one hot encoding on the data, and normalize the data; According to the preprocessed sample data set, a vehicle emission prediction model based on convolutional neural network is constructed. The vehicle emission prediction model includes convolution layer, pooling layer and fully connected layer. The Adam algorithm is used to train the vehicle emission prediction model; K-fold cross validation was used to evaluate the training effect of the vehicle emission prediction model, and the model with the smallest cross validation loss was selected as the final vehicle emission prediction model; For the second test vehicle to be tested, data including vehicle model, vehicle age, driving speed and road conditions are obtained and input into the vehicle emission prediction model trained to obtain emission prediction results of indicators, where the indicators include CO2, HC and NOx; Set the confidence interval of the vehicle emission prediction model and filter the prediction results based on the confidence interval; The filtered prediction results are accumulated according to the time dimension to obtain a total emission prediction value of the second detected vehicle as the second predicted emission.

2. The method for detecting vehicle emissions according to claim 1, characterized in that: Using image recognition to obtain vehicle information in a video image, the vehicle information includes the vehicle brand and vehicle model, and includes the following steps: For the acquired video images, an explainable instance segmentation algorithm is used to obtain a vehicle image containing the entire vehicle; The acquired vehicle images are filtered and denoised using an image defogging algorithm based on deep learning; Input the processed vehicle image into the convolutional neural network based on the attention mechanism to obtain the vehicle brand; Input the processed vehicle images into the convolutional neural network combined with the model year classification to obtain the vehicle model containing the year information; The acquired vehicle brand and vehicle model are input into a convolutional neural network based on a confidence fusion algorithm to obtain a vehicle information recognition result; Wherein, obtaining the vehicle information recognition result includes the following steps: Obtain the prediction results and confidence levels of vehicle brand recognition and vehicle model recognition respectively; When the confidence of vehicle brand recognition is low, the weight of the vehicle model is set to be greater than the weight of the vehicle brand. Conversely, the weight of the vehicle model is set to be less than the weight of the vehicle brand. The results of vehicle brand recognition and vehicle model recognition, as well as the set weights, are input into a convolutional neural network based on a confidence fusion algorithm. The convolutional neural network based on a confidence fusion algorithm includes a cascade structure of a convolutional neural network and a fully connected network. A convolutional neural network based on the confidence fusion algorithm is used to perform confidence fusion and output the final vehicle information recognition result.

3. The method for detecting automobile emissions according to claim 2, characterized in that: For the acquired video image, an explainable instance segmentation algorithm is used to obtain a vehicle image containing the entire vehicle, including the following steps: The Mask RCNN instance segmentation model is jointly trained using a real vehicle image sample dataset and a fake vehicle sample dataset generated based on a generative adversarial network. Add an attention mechanism to the Mask RCNN instance segmentation model to extract images of the target vehicle area; Use the trained Mask RCNN instance segmentation model to perform instance segmentation on the input video image to obtain a segmentation result image containing the target vehicle; The obtained segmentation result image is semantically segmented to obtain a binary vehicle body mask image containing vehicle body, window and headlight pixels as the vehicle image.

4. The method for detecting vehicle emissions according to claim 2, characterized in that: The processing of filtering and denoising the acquired vehicle images using the image defogging algorithm based on deep learning includes the following steps: A deep neural network defogging algorithm based on dark channel prior is used to defog the fog components in vehicle images; Use the median filter algorithm to filter and preprocess the defogging vehicle image; The vehicle images pre-processed by filtering are denoised using a deep denoising neural network based on an encoder-decoder structure. An image enhancement algorithm based on adaptive Gamma correction is used to enhance the denoised vehicle images.

5. The method for detecting automobile emissions according to claim 4, characterized in that: The filtering preprocessing of the defogging vehicle image using the median filtering algorithm includes the following steps: Collect noise-free vehicle images and vehicle image samples with different degrees of Gaussian noise added; Train the convolutional neural network model to determine the image noise type and noise point density, and output the noise type and corresponding noise point distribution characteristics; When the detection is Gaussian noise and the noise point density is greater than the threshold T1, a median filter kernel with a size of M1×M1 is selected; when the detection is salt and pepper noise and the noise point density is less than the threshold T2, a median filter kernel with a size of M2×M2 is selected; Use the selected median filter kernel to filter and denoise the vehicle image; M1 is greater than M2; the filter kernel has a square structure.

6. The method for detecting automobile emissions according to claim 4, characterized in that: Using a deep neural network defogging algorithm based on dark channel prior, the defogging process for the fog component in the vehicle image includes the following steps: The deep neural network based on dark channel prior includes a feature extraction module and a dehazing module; A feature extraction module is used to extract dark channel prior features from the input vehicle image to obtain a dark channel prior feature map, wherein the feature extraction module includes multi-layer convolution and pooling operations; The extracted dark channel prior feature map is input into the defogging module for defogging. The defogging module includes a conditional generative adversarial network based on prior features. In the conditional generative adversarial network, the dark channel prior feature map is used as a conditional input to the generator, and the generator learns the distribution of vehicle images after defogging; The defogging vehicle image distribution output by the generator is input into the discriminator, and the discriminator determines the similarity between the generated defogging vehicle image and the non-fogging vehicle image; According to the discrimination result output by the discriminator, the parameters of the generator are updated through back propagation of the loss function; Among them, the defogging algorithm is trained using vehicle pictures with different fog concentrations to learn the defogging mapping relationship.

7. The method for detecting automobile emissions according to claim 2, characterized in that: According to the acquired vehicle information, dividing the vehicles on the detection section into first detection vehicles and second detection vehicles according to the preset OBD port configuration database includes the following steps: Establish an OBD port configuration database, which contains vehicle model string information, vehicle model corresponding year information, vehicle model corresponding VIN code range and vehicle model corresponding OBD port configuration information; Use the Levenshtein edit distance algorithm to set the edit distance threshold of the vehicle type string; Use the maximum allowable error range parameter to set the allowable error range for the model year; Car models are matched based on the edit distance threshold and the car model year error range; When the vehicle model matching fails, VIN matching is performed on the vehicle image; According to the matching result, the vehicle is divided into a first detection vehicle and a second detection vehicle; Among them, the vehicle model matching failure means that the edit distance of the vehicle model string exceeds the distance threshold or the difference between the recognized year information and the year in the OBD port configuration database exceeds the allowable error range.

8. The method for detecting automobile emissions according to claim 7, characterized in that: VIN matching of vehicle images includes the following steps: Use the Faster RCNN target detection algorithm to identify the VIN code area of ​​the vehicle image; Use the CTC loss function to recognize the VIN code sequence. According to the VIN code specification, the VIN code sequence obtained by parsing and identifying is performed, and VIN matching is performed in the established OBD port configuration database.

9. The method for detecting automobile emissions according to claim 1, characterized in that: According to the acquired road information, respectively correcting the first predicted emission amount and the second predicted emission amount by using the correction coefficient comprises the following steps: Calculate the vehicle traffic volume of the detection section according to the number of lanes; Calculate the average speed of vehicles based on road speed limits and traffic conditions; According to the calculated vehicle traffic volume and average driving speed, an emission mapping model based on vehicle power is established to calculate the corresponding vehicle emissions at different speeds; Obtain vehicle emission data on the detected road section, build a random forest regression model as a correction model, and input the average driving speed, vehicle model, ambient temperature and humidity, and vehicle emissions output by the emission mapping model; For the first predicted emission, according to the speed and vehicle model of the corresponding vehicle, a first correction coefficient is obtained by using a correction model to correct the first predicted emission; For the second predicted emission, the second correction coefficient is obtained by using the correction model according to the average driving speed of the corresponding vehicle model, and the second predicted emission is corrected.

10. The method for detecting automobile emissions according to claim 9, characterized in that: The emission mapping model is a recurrent neural network model.

Citation Information

Patent Citations

  • Automobile emission detection method, system, equipment and medium

    CN116704761A

  • Pollutant discharge monitoring, preventing and controlling system, method and device and medium

    CN111340280A

  • Carbon emission measuring method, device and equipment applied to large construction equipment

    CN116165334A