A method for intelligently judging the black smoke level of diesel vehicles using monitoring images of a ring inspection line
By combining computer vision and machine learning technology, the background difference and light color analysis algorithms are used to capture suspicious areas of black smoke, and the Gradient Boosting classifier is used to eliminate false detection areas, which solves the problem of false detection and missed detection of black smoke in motor vehicle environmental inspections, and achieves Accurate black smoke level determination in complex scenes.
Patent Information
- Application Number
- CN202311692914.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-11
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-12-11
AI Technical Summary
The existing technology has problems with misdetection and missed detection of black smoke during environmental inspection of motor vehicles, and it is difficult to accurately quantify the level of black smoke emissions. Especially in environmental inspection scenarios with complex backgrounds, the existing technology is difficult to apply.
Combining computer vision technology and machine learning technology, the background difference algorithm and light color analysis algorithm are used to capture suspicious areas of black smoke, and the false detection areas are eliminated through the Gradient Boosting classifier, and the black smoke is interpolated into a pure white background for Ringelmann blackness level determination.
It effectively avoids missed detections, improves the accuracy of black smoke detection, reduces the amount of training samples, reduces computing costs, and achieves consistent black smoke level determination in different scenarios.
Smart Images

Figure CN117746111B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of motor vehicle environmental inspection, and in particular to a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of an environmental inspection line. Background Art
[0002] Motor vehicle environmental inspection (hereinafter referred to as "environmental inspection") is an important part of motor vehicle inspection, which aims to inspect motor vehicles for environmental protection such as exhaust pollution in accordance with relevant national regulations and technical standards. According to the "China Ecological Environment Statistical Yearbook (2021)" and the "China Mobile Source Environmental Management Annual Report (2022)", the national mobile source nitrogen oxides (NO X ) emissions accounted for 58.9%, the largest contributing source, and volatile organic compounds (VOCs) emissions accounted for 33.9%, only slightly lower than the 35.2% of industrial sources; it is particularly noteworthy that in the mobile source NO X Among the emissions, diesel vehicles account for as much as 88.3%. In addition, according to the "China Ecological Environment Bulletin (2022)", among the 339 cities at or above the prefecture level in China, PM 2.5 Cities with excessive levels of NO and ozone accounted for 25.4% and 27.1%, respectively, which are the two pollutants that exceeded the standards the most. X and VOCs are PM 2.5 Mobile source emissions are common precursors of pollutants and ozone, so the control of mobile source emissions is an important "focus" for improving my country's air quality, and environmental inspections are the effective "tools" of the ecological environment department in mobile source control, among which the Ringelmann blackness level is one of the important indicators of environmental inspections.
[0003] Black smoke recognition is the basis for the determination of Ringelmann blackness level. With the increasing maturity of computer vision technology and the rise of machine learning technology, intelligent black smoke recognition methods have emerged rapidly. For example, the document "Improved black smoke detection algorithm based on ResNet34" successively uses a three-frame target detection algorithm and cumulative Hough transform to extract the vehicle exhaust area, and then sends it to the ResNet34 network model for detection; the patent "A black smoke vehicle detection method and system" segments the black smoke area based on the improved maximum stable extreme area; the patent "A lightweight vehicle black smoke detection method based on a three-dimensional convolutional network" uses the YOLOv4 detection model to extract black smoke candidate areas, and then uses three-dimensional convolution and non-local attention mechanisms to build a classifier to classify black smoke vehicles and non-black smoke vehicles. However, most technologies use computer vision technology or machine learning technology alone, and there are problems such as false detection and missed detection when the ambient inspection background changes dynamically; in addition, the single use of machine learning technology usually requires a large number of training samples, which brings high manpower and computing costs.
[0004] On the other hand, most of the existing technical methods only stay at the level of qualitative identification of black smoke, and few of them quantify the "concentration" of black smoke. A few quantification methods include the patent "A black smoke detection and DG calculation method based on black smoke motion characteristics", which relies on the motion vector and grayscale change of the current frame and the adjacent frame to segment the black smoke area, and then uses the brightness mean and variance of the black smoke area to calculate the Ringelmann level; the patent "A video-based black smoke vehicle and Ringelmann blackness level intelligent detection method" first uses YOLOv5 to detect vehicles and black smoke areas, and then uses a three-dimensional convolutional neural network for identification, and finally subtracts the black smoke area from the background model to further determine the Ringelmann level. Although there are a few technologies for quantifying black smoke, these technologies are mainly used in road scenes, which require relatively simple environmental inspection scenes; in addition, their quantification process usually does not fully consider the interference of the background, or only performs a simple subtraction process on the background. Therefore, it is difficult to apply the few existing Ringelmann blackness determination technologies for road scenes to environmental inspection scenes with complex backgrounds. Summary of the invention
[0005] In order to solve the problems of false detection and missed detection of black smoke from motor vehicles and accurately quantify the black smoke emission level, the present invention effectively combines computer vision technology with machine learning technology and proposes a method for intelligently determining the black smoke level of diesel vehicles based on monitoring images of a ring inspection line.
[0006] In order to achieve the purpose of the present invention, the present invention provides a method for intelligently determining the black smoke level of a diesel vehicle using a ring inspection line monitoring image, comprising the following steps:
[0007] The image data is processed using a preset background difference algorithm to obtain a background model without moving objects, and a foreground image containing moving objects is obtained by difference;
[0008] The image data is processed using a preset light and color analysis algorithm to obtain a foreground image containing an approximate area of black smoke, wherein the light and color analysis algorithm captures areas with dim brightness, gray, and black color by comprehensively using adaptive Gaussian threshold processing and color difference segmentation;
[0009] Taking a union of the foreground image containing the moving object and the foreground image containing the black smoke approximate area, and performing opening and closing operations and connected domain analysis to obtain a black smoke suspicious area;
[0010] After preprocessing the suspected black smoke area, the pre-trained Gradient Boosting classifier is input to eliminate the false detection area and retain the real black smoke area;
[0011] The black smoke is interpolated into a pure white background and the Ringelmann blackness level is calculated by using a preset black smoke interpolation algorithm and a Ringelmann blackness level determination algorithm. The black smoke interpolation algorithm is used to extract the black smoke from the real background into the pure white background.
[0012] Furthermore, the steps of the background difference algorithm include:
[0013] Based on the previous t frames of the image, an adaptive mixed Gaussian background model is used to model the background;
[0014] Compare the difference between each frame image and the adaptive mixed Gaussian background model to determine the foreground and background;
[0015] The pixels of the subsequent frame images are updated with an adaptive mixed Gaussian background model.
[0016] Furthermore, the steps of the light color analysis algorithm include:
[0017] The frame image is first processed using an adaptive Gaussian threshold to capture areas with low brightness;
[0018] After edge detection and closing operation, color difference segmentation is performed to further capture gray and black areas.
[0019] Furthermore, the method of using adaptive Gaussian threshold processing to capture areas with low brightness includes:
[0020] A local neighborhood is defined with each pixel in the frame image as the center, and the Gaussian weighted mean and standard deviation of the pixel brightness in the neighborhood are calculated to determine the neighborhood threshold;
[0021] The pixels in the neighborhood are binarized based on the neighborhood threshold.
[0022] Furthermore, when performing the color segmentation, when the difference between R, G, and B is less than a specified threshold, the color is close to black smoke, and the mathematical expression is as follows:
[0023]
[0024] Where, X i,j is the gray value of pixel (i, j); R r is the red component of the pixel; G g is the green component of the pixel; B b is the blue component of the pixel; T RGB is the component difference threshold; ∨ is the logical “OR” operator; ∧ is the logical “AND” operator.
[0025] Furthermore, the training steps of the Gradient Boosting classifier include:
[0026] Calculate the category distribution of black smoke suspicious areas on the training data and generate a simple initial classifier to initialize the model;
[0027] A black smoke strong classifier is formed by iteratively training multiple weak classifiers.
[0028] Furthermore, the mathematical expression of the Gradient Boosting classifier is as follows:
[0029]
[0030] In the formula, f N (x) is the final strong classifier; x is the input feature; f0(x) is the initial weak classifier; h n (x) is the nth weak classifier; α is the learning rate; N is the number of iterations.
[0031] Further, train the nth weak classifier h n The loss function of (x) is
[0032]
[0033] In the formula, h n (x) is the weak classifier of the nth iteration; M is the sample size; y m The actual label of the mth sample; f n-1 (x m ) is the predicted value of the classifier when combined with the n-1th weak classifier; x m is the input feature of the mth sample; h(x m ) is the solution term; L is the logarithmic loss function for training weak classifiers, and its mathematical expression is as follows:
[0034]
[0035] In the formula, y is the actual label; is the model's predicted value.
[0036] Furthermore, the Gradient Boosting classifier is replaced by any machine learning algorithm of logistic regression, support vector machine, decision tree, random forest, K nearest neighbor, naive Bayes, or replaced by a deep learning model.
[0037] Furthermore, the black smoke interpolation algorithm is as follows:
[0038]
[0039] In the formula, X w is the gray value of the black smoke pixel on a pure white background; X r is the gray value of the black smoke pixel under the real background; Xbg is the adaptive mixed Gaussian background model corresponding to the current frame.
[0040] Furthermore, the steps of using the Ringelmann blackness level determination algorithm to determine the Ringelmann blackness level include:
[0041] Extracting a frame image whose number of black smoke pixels is within a preset range of a set of black smoke pixel numbers of image black smoke frames;
[0042] Counting the number of black smoke pixels in each frame of the extracted image whose grayscale values are between each blackness level, wherein the blackness level includes multiple levels, each level corresponds to a corresponding grayscale value interval, and the grayscale value interval is obtained by mapping the level of the Ringelmann smoke blackness map;
[0043] Determine the black level of each frame of the extracted image, when the ratio of the number of pixels of a higher black level to the total number of black smoke pixels of the current frame exceeds a specified threshold, the black smoke level of the current frame is the higher black level;
[0044] The final Ringelmann blackness level is determined, and the blackness level of each extracted frame is counted. When the ratio of the number of frames with a higher blackness level to the number of extracted frames exceeds a specified threshold, the final Ringelmann blackness level is the higher blackness level.
[0045] Compared with the prior art, the present invention can at least achieve the following beneficial effects:
[0046] (1) The present invention fully considers the interference of the background and adopts computer vision technology (background difference algorithm and light color analysis algorithm) to comprehensively capture the black smoke suspicious area and effectively avoid missed detection; then, machine learning technology (Gradient Boosting classifier) is used to eliminate the misdetected area; finally, black smoke interpolation extraction and level judgment are performed, which can be applied to environmental inspection scenes with complex backgrounds.
[0047] (2) The present invention uses a background difference algorithm to preliminarily identify black smoke, which can effectively cope with the dynamic changes of the scene in time; it uses light color analysis to prevent missed detection, which can effectively cope with the complexity of the scene in space. Coupling background difference and light color analysis can effectively solve the problem of missed black smoke detection from a temporal and spatial perspective, and further by connecting a GradientBoosting classifier in series downstream, it can effectively solve the problem of false black smoke detection, which can effectively improve the accuracy of black smoke detection.
[0048] (3) Based on the recognition of background difference and light color analysis, the Gradient Boosting classifier of the present invention only needs to learn the foreground features, that is, the training data is only the black smoke suspicious area rather than the entire frame image of the image, which can significantly reduce the amount of training samples; in addition, the use of a pre-trained classifier can still retain the real-time advantage of upstream computer vision.
[0049] (4) Before making a black smoke level judgment, the interference of the background on the final Ringelmann blackness level judgment can be eliminated by interpolating the black smoke from the real background to the pure white background. At the same time, using the pure white background as the reference background can standardize the Ringelmann blackness level judgment, and further, consistent black smoke level judgment can be made in different scenes and conditions without being affected by the actual background. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 The present invention provides a flowchart of the steps of a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line.
[0051] Figure 2 It is a detailed flow chart provided by an embodiment of the present invention.
[0052] Figure 3 1 is a schematic diagram of the background difference process in an embodiment of the present invention.
[0053] Figure 4 It is a schematic diagram of the process of light color analysis in an embodiment of the present invention.
[0054] Figure 5 Some of the embodiments of the present invention provide the following effects: Figure 1 .
[0055] Figure 6 Some of the embodiments of the present invention provide the following effects: Figure 2 .
[0056] Figure 7 Some of the embodiments of the present invention provide the following effects: Figure 3 . DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0058] See also Figure 1 and Figure 2 The present invention provides a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line, which specifically includes the following steps:
[0059] Step S1: Access the online monitoring image data of the ring inspection line.
[0060] Step S2: Process the image data using a preset background difference algorithm to obtain a background model without moving objects, and obtain a foreground image containing moving objects by difference.
[0061] Background difference process Figure 3 As shown in the figure, it includes three parts: background modeling, foreground extraction, and background update. The foreground and background in the surveillance image can be preliminarily identified through background difference. First, since the image usually does not contain the black smoke moving foreground in the early stage, a mixed Gaussian background model is established based on the first t frames of the image; then, the difference between the pixels of each subsequent frame and the background model is compared. When the difference is greater than the specified threshold, it is considered to be a foreground pixel, otherwise it is considered to be a background pixel; each frame of pixels is also used to update the background model. Since it includes the model update process, it can better adapt to the dynamic changes of the scene. Please refer to Figure 3 , specifically including the following sub-steps:
[0062] Step 2.1: Based on the first t frames of the image, an adaptive mixed Gaussian background model is used to model the background.
[0063] In this step, the background pixel values are first classified, and a Gaussian distribution is established for each type of pixel value, called a "sub-Gaussian" (for example, a Gaussian distribution can be established for the pixel values when there is human motion, and another Gaussian distribution can be established for the pixel values when there is no human motion). Then, the weighted sum of multiple sub-Gaussians can be obtained to obtain an adaptive mixed Gaussian background model, which can better adapt to the dynamic changes of the background than the single Gaussian background model.
[0064] The mathematical expression of the adaptive mixed Gaussian background model is:
[0065]
[0066] In the formula, B t,i,j is the adaptive mixed Gaussian background model of pixel (i, j); K is the number of components of the adaptive mixed Gaussian background model, which is dynamically determined by the MOG2 algorithm; w k,t is the weight of sub-Gaussian k; is the sub-Gaussian k of pixel (i, j); μ k,t,i,j is the mean vector of sub-Gaussian k of pixel (i, j); σ k,t,i,j is the standard deviation of the sub-Gaussian k of pixel (i, j). In some embodiments of the present invention, t is 1000.
[0067] In practical applications, there may be other objects moving in the image (such as human activities, lighting changes). From a temporal perspective, the use of an adaptive mixed Gaussian background model can accurately model the dynamic background of the scene and avoid missed detection.
[0068] Step 2.2: Compare the difference between each frame image pixel and the adaptive mixed Gaussian background model to determine the foreground and background. The mathematical expression is as follows:
[0069] In this step, assume that the current frame is t and the pixel value of pixel (i, j) is X t,i,j , and the difference with the adaptive mixed Gaussian background model is calculated as follows
[0070] ΔX t,i,j =|X t,i,j -μt -1,i,j |
[0071] Where t is the current frame; X t,i,j is the pixel value of the current frame pixel (i, j); μ t-1,i,j is the mean of the adaptive mixed Gaussian background model of the previous frame pixel (i, j); ΔX t,i,j is the absolute difference between the current frame pixel (i, j) and the background model.
[0072] When the difference is greater than the preset threshold, the frame pixel (i, j) is considered to be a foreground pixel; otherwise, it is a background pixel. This process is called the differential image ΔX t The binarization process can obtain the mask P t , the mathematical expression is
[0073]
[0074] Where P t,i,j is the gray value of the pixel at the position (i, j) of the mask image; T is an adjustable multiple, and in some embodiments of the present invention, it is 3; σ t-1,i,j is the standard deviation of the Gaussian background model of pixel (i, j) in frame t-1.
[0075] Step 2.3: Update the pixel value to the adaptive mixed Gaussian background model. Background update, that is, update the weight, mean and standard deviation of the model. The mathematical expression is:
[0076] w k,t =(1-l r )·w k,t-1 +l r γ k,t-1
[0077] μ k,t,i,j =(1-l r )·μ k,t-1,i,j +l r ·X t,i,j
[0078]
[0079] In the formula, X t,i,jis the pixel value of pixel (i, j) in the current frame; w k,t and w k,t-1 are the weights of the k-th Gaussian distribution before and after updating; μ k,t,i,j and μ k,t-1,i,j are the means of the k-th Gaussian distribution before and after the update; σ k,t,i,j and σ k,t-1,i,j are the standard deviations of the k-th Gaussian distribution before and after the update; l r is the learning rate, which is used to control the updating speed of the model. In some embodiments of the present invention, the value is 0.005; γ k,t-1 is the kth Gaussian distribution for pixel value X t,i,j The response is calculated using the following formula:
[0080]
[0081] In the formula, Represents X t,i,j In Gaussian distribution The probability density in .
[0082] Step S3: Process the image data using a light and color analysis algorithm to obtain a foreground image containing a black smoke approximate area.
[0083] See also Figure 4 , the light and color analysis process mainly includes adaptive Gaussian threshold processing and color difference segmentation. The frame image is first processed by adaptive Gaussian threshold processing to capture the low brightness (i.e. dark) area; the processing result is subjected to edge detection and closing operation to achieve the purpose of connecting the broken areas in the image and filling the small holes in the image, and then color difference segmentation is performed to further capture the gray and black areas. Light and color analysis can more comprehensively capture the dark, gray, and black black smoke approximate areas in the frame image. From a spatial perspective, it can effectively cope with the complexity of the background of the environmental inspection scene and avoid missed detection. It specifically includes the following sub-steps:
[0084] Step S3.1: Perform adaptive Gaussian threshold processing on the image data to capture the darker brightness areas in the frame image;
[0085] Adaptive Gaussian threshold processing dynamically adjusts the threshold according to the local pixel brightness around each pixel. In this step, a local neighborhood is defined with each pixel in the frame image as the center, and the Gaussian weighted mean and standard deviation of the pixel brightness in the neighborhood are calculated to determine the neighborhood threshold; based on the neighborhood threshold, the pixels in the neighborhood are binarized, that is, when the brightness is greater than the threshold, the grayscale value of the pixel is set to 255, otherwise it is set to 0.
[0086] The mathematical expression of the binarization process is as follows:
[0087] Z o_x,p_y=exp(-(p_x 2 +p_y 2 ) / (2×(s / 2) 2 ))
[0088] E=∑(Z p_x,p_y ×L p_x,p_y ) / N s
[0089]
[0090]
[0091] Where s is the neighborhood size, which is 13×13 in some embodiments of the present invention; p_x, p_y are the offsets of the pixels in the neighborhood; Z p_x,p_y is the Gaussian weight of the pixel, ∑Z p_x,p_y =1;X p_x,p_y is the pixel gray value; L p_x,p_y is the pixel brightness value; N s is the number of pixels in the neighborhood, and in some embodiments of the present invention, the value is 169; E is the mean brightness of the pixels in the neighborhood; δ is the standard deviation of the brightness of the pixels in the neighborhood; C is the threshold adjustment factor, and in some embodiments of the present invention, the value is 2.
[0092] Step S3.2: Perform edge detection and closing operations on the adaptive Gaussian threshold processed image and then perform color segmentation to obtain a foreground image containing an approximate area of black smoke.
[0093] The image processed by adaptive Gaussian threshold is subjected to Canny edge detection and closing operation, and then color difference segmentation is performed to further capture gray and black areas. Color difference segmentation can significantly eliminate the misdetected areas of adaptive Gaussian threshold processing, that is, areas that do not match the color of black smoke, thereby effectively reducing the computational pressure of the downstream Gradient Boosting classifier.
[0094] Color difference segmentation, that is, when the difference between R, G, and B is less than the specified threshold, the color is close to black smoke. Its mathematical expression is as follows:
[0095]
[0096] In the formula, X i,j is the gray value of pixel (i, j); R r is the red component of the pixel; G g is the green component of the pixel; B b is the blue component of the pixel; T RGB is a component difference threshold, and in some embodiments of the present invention, takes a value of 8; ∨ is a logical “or” operator; ∧ is a logical “and” operator.
[0097] Step S4: taking a union of the foreground image containing the moving object and the foreground image containing the black smoke approximate area, and performing opening and closing operations and connected domain analysis to obtain a black smoke suspicious area.
[0098] Step S5: After preprocessing the suspected black smoke area, input the pre-trained Gradient Boosting classifier to eliminate the false detection area and retain the real black smoke area.
[0099] In some embodiments of the present invention, the preprocessing includes color space change and histogram equalization, which can enhance image contrast and highlight image features, thereby improving the classifier's perception of features.
[0100] Gradient Boosting classifier is a classifier based on gradient boosting decision tree. It classifies the black smoke suspicious area by iteratively combining multiple weak classifiers (1: true black smoke; 0: misidentification). Suppose the training data set is D = {(x1, y1), ..., (x M ,y M )}, M is the sample size, x m is the input feature of the mth sample, y m The actual label of the mth sample, the mathematical expression of the Gradient Boosting classifier is as follows:
[0101]
[0102] In the formula, f N (x) is the final classifier; x is the input feature; f0(x) is the initial weak classifier; h n (x) is the nth weak classifier; α is the learning rate; N is the number of weak classifiers. In some embodiments of the present invention, N is 200.
[0103] During initial training, the present invention uses DummyEstimator to calculate the category distribution on the training data to generate a simple classifier to initialize the model's predicted value f0(x). Then, a weak classifier is added for each iteration. The goal of each weak classifier is to fit the residual between the current predicted value and the actual label. The residual at the nth iteration is:
[0104]
[0105] In the formula, r m,n is the residual error of the classifier for the mth sample in the nth iteration; L is the logarithmic loss function; y m is the actual label of the mth sample; f n-1 (x m) is the predicted value of the classifier when combined with the n-1th weak classifier.
[0106] Fit the nth weak classifier h n The mathematical expression of (x) is as follows:
[0107]
[0108] Where M is the sample size; y m is the actual label of the mth sample; f n-1 (x m ) is the predicted value of the classifier when combined with the n-1th weak classifier; α is the learning rate; h(x m ) is the solution term; L is the logarithmic loss function, and its mathematical expression is as follows:
[0109]
[0110] In the formula, y is the true label; is the probability value predicted by the model, indicating the probability value of the positive class, Represents the probability value of the negative class. If y = 1, the expected probability value predicted as the positive class is as large as possible, that is, minimized If y=0, the expected probability value of the negative class is as large as possible, and it is also minimized. After each round of iterative fitting, the weak classifier can be added to the model:
[0111] f n (x) = f n-1 (x)+αh n (x)
[0112] In the formula, f n (x) is the classifier when combined with the nth weak classifier; f n-1 *x) is the classifier when combined to the n-1th weak classifier; α is the learning rate; h n (x) is the nth weak classifier fitted.
[0113] In some embodiments of the present invention, the training data is 1375 black smoke suspicious areas.
[0114] In some embodiments of the present invention, the Gradient Boosting classifier can be replaced by other machine learning algorithms, such as logistic regression, support vector machine, decision tree, random forest, K nearest neighbor, naive Bayes, or replaced by a deep learning model. In the case of limited computing resources and training samples, the Gradient Boosting classifier is used as a black smoke classification model, which can show higher robustness and generalization ability.
[0115] Background difference and light color analysis can be used to preliminarily identify suspicious areas of black smoke, but both may have false detection phenomena, especially the latter has more serious false detection (for example, brake lights at the end of detection, shadows caused by stacked items, etc.). The present invention further identifies the suspicious areas of black smoke captured by upstream computer vision technology by connecting machine learning technology in series downstream, specifically using a pre-trained Gradient Boosting classifier. The combination of background difference algorithm and light color analysis algorithm (computer vision part) with Gradient Boosting classifier (machine learning part) has the following advantages: 1) The coupling of background difference and light color analysis can effectively solve the problem of missed detection of black smoke from a temporal and spatial perspective; 2) The machine learning module can effectively eliminate the false detection areas introduced by the upstream computer vision module and improve the accuracy; 3) Based on computer vision recognition, the machine learning module only needs to learn the foreground features, that is, the training data is only the suspicious area of black smoke instead of all frame images of the image, and the training sample size can be significantly reduced; 4) The use of a pre-trained classifier still retains the real-time advantage of computer vision.
[0116] Step S6: using a black smoke interpolation algorithm and a Ringelmann blackness determination algorithm, interpolating the black smoke into a pure white background and calculating the Ringelmann blackness level.
[0117] This step includes the following sub-steps:
[0118] Step S6.1: Based on the adaptive mixed Gaussian background model, the black smoke is extracted from the real background to the pure white background by using the black smoke linear interpolation method. The mathematical expression of the black smoke linear interpolation extraction is as follows:
[0119]
[0120] In the formula, X w is the gray value of the black smoke pixel on a pure white background; X r is the gray value of the black smoke pixel under the real background; X bg is the adaptive mixed Gaussian background model corresponding to the current frame.
[0121] Step S6.2: Use the Ringelmann blackness level determination algorithm to perform Ringelmann blackness level determination.
[0122] This step includes the following steps:
[0123] Step S6.2.1: during the determination process, the frame images are all frame images with pure white backgrounds, and frame images whose number of black smoke pixels is within a preset range of the number of black smoke pixels in the image black smoke frame set are extracted;
[0124] In some embodiments of the present invention, frame images with a black smoke pixel count between the upper quartile and the lower quartile of the black smoke pixel count set of the image black smoke frame are extracted, and black smoke emission in the frame images within this range is more stable. In other embodiments, frame images within other ranges may also be selected depending on the situation.
[0125] Step S6.2.2: Counting the number of black smoke pixels in each frame of the extracted image whose grayscale values are between various blackscale levels;
[0126] Step S6.2.3: Determine the black level of each frame of the extracted image. When the ratio of the number of pixels with a higher black level to the total number of black smoke pixels in the current frame exceeds a preset threshold (set to 10% in some embodiments of the present invention), the black smoke level of the current frame is the higher black level.
[0127] Step S6.2.4: Determine the final Ringelmann black level, count the black levels of each frame, and when the ratio of the number of frames with a higher black level to the number of extracted frames exceeds a preset threshold (set to 7% in some embodiments of the present invention), the final Ringelmann black level is the higher black level.
[0128] In some embodiments of the present invention, the grayscale value interval of the blackness level is mapped based on the Ringelmann smoke blackness diagram level described in GB3847-2018 "Emission Limits and Measurement Methods of Pollutants from Diesel Vehicles (Free Acceleration Method and Loaded Deceleration)". In this embodiment, the grayscale value of Ringelmann blackness level 0 is between [230, 255], the grayscale value of level 1 is between [179, 229], the grayscale value of level 2 is between [128, 178], the grayscale value of level 3 is between [77, 127], the grayscale value of level 4 is between [26, 76], and the grayscale value of level 5 is between [0, 25].
[0129] Before making a black level determination, the black smoke is interpolated and extracted from the real background to the pure white background to ensure an accurate estimation of the black smoke concentration. On the one hand, the interference of the background on the final black level determination can be eliminated, because the grayscale value of the black smoke pixel under the real background includes the grayscale value of the background, while the grayscale value of the black smoke pixel after separation and extraction is only the grayscale value of the black smoke; on the other hand, using the pure white background as the reference background can make the determination of the Ringelmann black level more standardized, and further, consistent black smoke level determination can be made in different scenes and conditions without being affected by the actual background.
[0130] In some embodiments of the present invention, the method of the present invention and the Ringelmann smoke method described in GB 3847-2018 "Emission Limits and Measurement Methods of Pollutants from Diesel Vehicles (Free Acceleration Method and Loaded Deceleration Method)" are applied to 100 diesel vehicle detection monitoring images that do not participate in classifier training to determine the black smoke level. The levels determined by the two methods are basically the same, and the accuracy of the method of the present invention is 99%. See Table 1 below for details.
[0131] Table 1 Black smoke grade based on Ringelmann smoke method and black smoke grade based on the method of the present invention
[0132]
[0133]
[0134]
[0135]
[0136] In some of the embodiments of the present invention, please refer to Figure 5-Figure 7 Through the above steps, the black smoke can be effectively interpolated to the pure white background, and the Ringelmann blackness level determination algorithm is used to determine: Figure 5 The black smoke level of the vehicle is level 1. Figure 6 The black smoke level of the vehicle is level 3. Figure 7 The black smoke level of vehicles in the test is level 0, which means there is actually no black smoke emission.
[0137] The method provided in the aforementioned embodiment of the present invention firstly adopts computer vision technology (background difference algorithm and light color analysis algorithm) to comprehensively capture the black smoke suspicious area, then adopts machine learning technology (Gradient Boosting classifier) to eliminate the misdetected area, and finally determines the black smoke level.
[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line, characterized in that: The following steps are involved: The image data is processed using a preset background difference algorithm to obtain a background model without moving objects, and a foreground image containing moving objects is obtained by difference; The image data is processed using a preset light and color analysis algorithm to obtain a foreground image containing an approximate area of black smoke, wherein the light and color analysis algorithm captures areas with dim brightness, gray, and black color by comprehensively using adaptive Gaussian threshold processing and color difference segmentation; Taking a union of the foreground image containing the moving object and the foreground image containing the black smoke approximate area, and performing opening and closing operations and connected domain analysis to obtain a black smoke suspicious area; After preprocessing the suspected black smoke area, the pre-trained Gradient Boosting classifier is input to eliminate the false detection area and retain the real black smoke area; Using a preset black smoke interpolation algorithm and a Ringelmann blackness level determination algorithm, the black smoke is interpolated into a pure white background and the Ringelmann blackness level is calculated. The black smoke interpolation algorithm is used to extract the black smoke from the real background into a pure white background; The steps of the light color analysis algorithm include: The frame image is first processed using an adaptive Gaussian threshold to capture areas with low brightness; After edge detection and closing operation, color difference segmentation is performed to further capture gray and black areas; The adaptive Gaussian threshold processing is used to capture the area with low brightness, including: A local neighborhood is defined with each pixel in the frame image as the center, and the Gaussian weighted mean and standard deviation of the pixel brightness in the neighborhood are calculated to determine the neighborhood threshold; Binarizing pixels in the neighborhood based on the neighborhood threshold; When performing the color segmentation, when the difference between R, G, and B is less than the specified threshold, the color is close to black smoke. The mathematical expression is as follows: In the formula, X i,j is the gray value of pixel (i, j); R r is the red component of the pixel; G g is the green component of the pixel; B b is the blue component of the pixel; T RGB is the component difference threshold; ∨ is the logical "OR" operator; ∧ is the logical "AND" operator; The training steps of the Gradient Boosting classifier include: Calculate the category distribution of black smoke suspicious areas on the training data and generate a simple initial classifier to initialize the model; A black smoke strong classifier is formed by iteratively training multiple weak classifiers; The mathematical expression of the Gradient Boosting classifier is as follows: In the formula, f N (x) is the final strong classifier; x is the input feature; f0(x) is the initial weak classifier; h n (x) is the nth weak classifier; α is the learning rate; N is the number of iterations; Train the nth weak classifier h n The loss function of (x) is In the formula, h n (x) is the weak classifier of the nth iteration; M is the sample size; y m The actual label of the mth sample; f n-1 (x m ) is the predicted value of the classifier when combined with the n-1th weak classifier; x m is the input feature of the mth sample; h(x m ) is the solution term; L is the logarithmic loss function for training weak classifiers, and its mathematical expression is as follows: In the formula, y is the actual label; is the model's predicted value.
2. According to claim 1, a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line, characterized in that: The steps of the background difference algorithm include: Based on the previous t frames of the image, an adaptive mixed Gaussian background model is used to model the background; Compare the difference between each frame image and the adaptive mixed Gaussian background model to determine the foreground and background; The pixels of the subsequent frame images are updated with an adaptive mixed Gaussian background model.
3. According to claim 1, a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line is characterized in that: The Gradient Boosting classifier is replaced with any machine learning algorithm of logistic regression, support vector machine, decision tree, random forest, K nearest neighbor, naive Bayes, or a deep learning model.
4. According to claim 1, a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line is characterized in that: The black smoke interpolation algorithm is as follows: Where, X w is the gray value of the black smoke pixel on a pure white background; X r is the gray value of the black smoke pixel under the real background; X bg is the adaptive mixed Gaussian background model corresponding to the current frame.
5. According to claim 1, a method for intelligently determining the black smoke level of a diesel vehicle using monitoring images of a ring inspection line, characterized in that: The steps of using the Ringelmann blackness level determination algorithm to determine the Ringelmann blackness level include: Extracting a frame image whose number of black smoke pixels is within a preset range of a set of black smoke pixel numbers of image black smoke frames; Counting the number of black smoke pixels in each frame of the extracted image whose grayscale values are between each blackness level, wherein the blackness level includes multiple levels, each level corresponds to a corresponding grayscale value interval, and the grayscale value interval is obtained by mapping the level of the Ringelmann smoke blackness map; Determine the black level of each frame of the extracted image, when the ratio of the number of pixels of a higher black level to the total number of black smoke pixels of the current frame exceeds a specified threshold, the black smoke level of the current frame is the higher black level; The final Ringelmann blackness level is determined, and the blackness level of each extracted frame is counted. When the ratio of the number of frames with a higher blackness level to the number of extracted frames exceeds a specified threshold, the final Ringelmann blackness level is the higher blackness level.
