A lightweight vehicle black smoke detection method based on 3D convolutional network
By using a three-dimensional convolutional network and a non-local attention mechanism in vehicle black smoke detection, the spatial and temporal features in the video are extracted, which solves the problem of the two-dimensional convolutional network being unable to capture the motion characteristics of black smoke, and achieves high accuracy and high performance. Real-time smoky vehicle detection.
Patent Information
- Application Number
- CN202210268313.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-03-18
AI Technical Summary
The two-dimensional convolutional network can only extract the spatial features of static black smoke and loses the motion characteristics of black smoke, resulting in low detection accuracy and poor real-time performance.
A lightweight three-dimensional convolution network combined with a non-local attention mechanism is used to extract candidate black smoke areas through the vehicle detector, and the three-dimensional convolution and non-local attention modules are used to extract spatial and temporal features in the video to detect black smoke vehicles. Two classifications with non-smoky cars.
It effectively utilizes the motion characteristics of black smoke, improves detection accuracy and real-time performance, distinguishes black smoke from interference factors, and achieves real-time black smoke vehicle detection with high accuracy and low false alarm rate.
Smart Images

Figure CN114743131B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional convolutional network image processing, and more specifically, to a lightweight vehicle black smoke detection method based on a three-dimensional convolutional network. Background Art
[0002] Based on vehicle videos captured by surveillance cameras on urban roads, the vehicle black smoke detection method supported by image processing technology has the advantages of high detection accuracy, high efficiency, and all-weather detection. Nowadays, the detection accuracy required by vehicle black smoke detection methods is getting higher and higher, and the cost is getting lower and lower. Researchers have tried to use a variety of deep learning methods to achieve vehicle black smoke detection. Related work, such as "Wang Xiaodong, Kang Yu, and Cao Yang, SDV-Net: A two-stage convolutional neural network for smoky diesel vehicle detection [C] / / Proc of the 38th Chinese Control Conference. Guangzhou: IEEE Press 2019: 8611-8616." Considering that it is difficult to simultaneously learn candidate regions and classify targets, the target detection network is used to extract multiple regions containing diesel vehicles, and then the classification network is used to perform fine-grained classification of the cropped regions to achieve diesel vehicle detection; "Zhou Jiannan, Qian Shaowei, and Yan Zhongzong,, ESA-Net: A network with efficient spatial attention for smoky vehicle detection [C] / / Proc of 2021 IEEE IMTC, 2021: 1-6." In order to focus on the region of interest and ignore invalid and redundant information, an efficient spatial attention model ESA-Net is proposed to achieve smoky vehicle detection; "Tao H and Lu X, Smoke vehicle detection based on spatiotemporal bag-of-features and professional convolutional neural network[J].IEEE Transactions on Circuits and Systems for Video Technology, 2020, 30(10):3301-3316." This paper proposes a method based on the extraction of multiple spatiotemporal features such as color, texture features and gradient histograms on three sets of orthogonal planes from suspected black smoke areas, and then feeds them into a support vector machine to achieve black smoke vehicle detection. The above work explored vehicle black smoke detection using different two-dimensional convolutional networks. However, when using a two-dimensional convolutional network to extract the spatial features of static black smoke, a single spatial information is difficult to fully express the characteristics of black smoke, which not only makes the black smoke detection accuracy of this type of algorithm low, but also makes it impossible to achieve real-time detection of black smoke vehicles.
[0003] Invention Technology
[0004] The present invention proposes a lightweight vehicle black smoke detection method based on three-dimensional convolution, aiming to solve the problems of low detection accuracy and poor real-time performance caused by the two-dimensional convolutional network that can only extract the spatial features of static black smoke, loses the motion characteristics of black smoke, and cannot utilize the motion characteristics of black smoke between consecutive frames.
[0005] A lightweight vehicle black smoke detection method based on three-dimensional convolution, the specific steps are as follows:
[0006] Step (1) Vehicle detector is used as a preprocessing method to extract candidate black smoke areas
[0007] The vehicle detector is composed of a YOLOv4 detection model using the existing MobilenetV2 network as a feature extraction network, with a vehicle video stream as input, and multiple consecutive frames of candidate black smoke areas are extracted and sent to a black smoke classifier.
[0008] Step (2) applies the three-dimensional convolution and non-local attention mechanism to the black smoke classifier to perform binary classification of black smoke vehicles and non-black smoke vehicles.
[0009] The black smoke classifier is composed of three modules, block1, block2 and FC3. The block1 module is composed of a three-dimensional convolution layer conv1, a ReLU layer and a maximum pooling layer pool1; the block2 module is composed of an InceptionBlock, a ReLU layer, a non-local attention module Non-Local and a maximum pooling layer pool2. Block1 and block2 constitute a feature extraction module, which is used to extract the spatial and temporal features of the vehicle black smoke in the video. The size of the three-dimensional convolution kernel in the convolution layer is 3×3×3, the feature extraction convolution kernel in the spatial dimension is the same as that of the two-dimensional convolution network, and the feature extraction convolution kernel in the temporal dimension is also 3×3. Since the input image of the present invention is a vehicle black smoke video stream, channel attention and spatial attention are more applied to static images, while the Non-Local module is more suitable for processing video data to achieve black smoke feature enhancement to improve the feature expression ability of the black smoke classifier network. FC3 is a linear mapping module and a fully connected layer. Its function is to convert the B×C×1×H×W feature vector of the input vehicle black smoke video into a B×2-dimensional feature vector after being processed by the block1 and block2 modules, so as to realize the binary classification of vehicles with smoke and without smoke. Among them, B is the batch size, C is the number of channels, H is the height of the feature map, and W is the width of the feature map.
[0010] The Non-Local module captures the long-range dependency of the video sequence by calculating the relationship between different pixels. The calculation formula is as follows:
[0011]
[0012] In formula (1), x is the input black smoke image, y is the correlation degree between the pixels of the black smoke image, and i represents the index of the time, space and spatiotemporal position of y to be calculated. Represents all elements, j is the index of all possible positions enumerated. The two-point similarity function f is used to calculate the feature x corresponding to position i i The features x corresponding to all possible positions j j The feature mapping function g is to calculate the input signal x at position j j To ensure that the overall information remains unchanged before and after the transformation, y is normalized using C(x). The calculation formula is as follows:
[0013] g(x j )=W g x j (2)
[0014]
[0015] θ(x i )=W θ x i (4)
[0016] φ(x j )=W φ x j (5)
[0017]
[0018] z i =W z y i +x i (7)
[0019] Among them, W in formula (2) g is the weight to be learned, formulas (4) and (5) are embedding functions, W θ and W φ represents the weight, and x in formula (7) i is the input signal of formula (1), y i is the output response of formula (1), W z is the weight matrix used for feature fusion.
[0020] Step (3) Evaluation of black smoke classifier
[0021] Since vehicle black smoke detection is a binary classification problem, the accuracy, precision, recall and false positive rate (FPR) are calculated using the confusion matrix to evaluate the performance of the black smoke classifier and output the evaluation results simultaneously. P represents positive samples, N represents negative samples, T represents the predicted value is the same as the true value, F represents the predicted value is opposite to the true value, TP represents the number of samples where both the predicted value and the true value are positive, TN represents the number of samples where both the predicted value and the true value are negative, FP represents the number of negative samples predicted as positive samples, and FN represents the number of samples where the true value is positive samples predicted as negative samples.
[0022] The calculation of accuracy, precision, recall and false alarm rate is shown as follows:
[0023]
[0024]
[0025]
[0026]
[0027]
[0028] Precision and recall are two mutually constrained indicators. In order to better describe the performance of the model, F1_score is usually used for evaluation. F1_score is the harmonic mean of precision and recall.
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] The present invention effectively utilizes the motion characteristics of vehicle black smoke, regards black smoke as a moving target, distinguishes it from interference factors such as vehicle shadows and road stains, and effectively utilizes the timing information of the video to achieve real-time detection of black smoke vehicles. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flow chart of the method of the present invention;
[0032] Figure 2 It is the network structure of the black smoke classifier in the present invention;
[0033] Figure 3 This is a structural diagram of the non-local attention module used in the present invention. DETAILED DESCRIPTION
[0034] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and technical solutions.
[0035] The specific experimental data set of this embodiment is 21 vehicle videos collected by cameras fixed on poles on multiple roads in a certain city. 14 vehicle videos are selected from them and pre-processed using a vehicle detector. The training set produced has 61 videos, including 26 black smoke vehicle videos and 35 non-black smoke vehicle videos. The test set is the remaining 7 vehicle videos that have not been processed by the vehicle detector.
[0036] Figure 1 It is the overall flow chart of the present invention, Figure 2 This is a black smoke classifier model diagram of a lightweight vehicle black smoke detection method based on three-dimensional convolution of the present invention. The specific steps of this embodiment are as follows:
[0037] Step 1: Data preprocessing:
[0038] Based on the collected surveillance vehicle videos, we first use the vehicle detector to extract the specific position of each vehicle in the video, and then use the position coordinates of the vehicle numbered N in the tth frame to continue extracting in the t+1, t+2…t+M (M≤20) frames. In this way, we can capture the movement of black smoke and create a black smoke vehicle video dataset. The non-black smoke vehicle video dataset is created in the same way.
[0039] Step 2: Train the black smoke classification model:
[0040] The prepared black smoke video training set is sent to the designed black smoke classifier. Each frame of the training video set with different resolutions will be processed into a size of 112×112, and the size of the input black smoke image feature map is 8×3×4×112×112 (B×C×T×H×W, B: batch size, C: number of channels, T: number of frames, H: height of the black smoke image feature map, W: width of the black smoke image feature map). After the block1 module, the black smoke image feature size is 8×8×4×56×56, and after the block2 module, the black smoke image feature size is 8×64×1×4×4. It is then processed into a size of 8×1024 and sent to the FC3 fully connected layer to finally obtain an 8×2-dimensional output, which is then sent to the cross entropy loss function to calculate the network loss, and back propagation is performed to update the network parameters. The hyperparameter settings of the neural network are shown in Table 2.
[0041] Table 2 Neural network hyperparameters
[0042] Parameter name Setting situation Batch size 8 Number of training sessions 100 Learning Rate 1e-5 Optimizer Stochastic gradient descent algorithm, increase weight decay 5x10-4, increase momentum 0.9;
[0043] Step 3: Detect black smoke vehicles:
[0044] The vehicle detector is integrated with the trained black smoke classifier model, and the vehicle video to be detected is sent to the model for detection. For each vehicle in the video, the vehicle detector will accumulate and extract multiple frames of candidate black smoke areas and send them to the black smoke classifier. After passing through the fully connected layer, two probability values are obtained, which correspond to the probabilities that the candidate black smoke area belongs to the two categories. The class with the largest probability value is the category of the candidate black smoke area.
[0045] Step 4: Embedded platform test:
[0046] In order to verify the real-time performance of the model of the present invention, the trained model was tested on the NVIDIA embedded platform JetsonTX2. The model of the present invention is a lightweight black smoke classification model. The input video is preprocessed by a vehicle detector and is not limited by the resolution of the vehicle video. The real-time rate reaches 25FPS.
[0047] This embodiment tests the vehicle black smoke detection effect based on a self-made black smoke data set, and compares it with the existing open source two-dimensional convolutional network classification model. As shown in Table 3, the accuracy of the black smoke detection model of the present invention is improved by 35.14%, 34.19% and 32.46%, and the F1_score is improved by 38.78% and 22.17%, respectively. In the VGG16 network model, all black smoke in the test video is missed, so the F1_score average value cannot be calculated, and the false alarm rate FPR is reduced by 35.73%, 42.27% and 28.22%, respectively. In terms of real-time performance, it is compared with the existing C3D model. As shown in Table 4, compared with the existing C3D model, the black smoke detection model of the present invention reduces the parameter calculation amount by one order of magnitude, and the network inference time is increased by 8.7 times.
[0048] Table 3 Comparison with existing open source 2D convolutional network classification models
[0049]
[0050] Table 4 Real-time comparison with existing C3D models
[0051]
Claims
1. A lightweight vehicle black smoke detection method based on three-dimensional convolution, characterized in that: The specific steps are as follows: Step (1) Vehicle detector is used as a preprocessing method to extract candidate black smoke areas The vehicle detector is composed of a YOLOv4 detection model with a MobilenetV2 network as the feature extraction network. The input is a vehicle video stream, and multiple consecutive frames of candidate black smoke areas are extracted and sent to the black smoke classifier. Step (2) applies the three-dimensional convolution and non-local attention mechanism to the black smoke classifier to perform binary classification of black smoke vehicles and non-black smoke vehicles. The black smoke classifier consists of three modules: block1, block2, and FC3. The block1 module consists of a three-dimensional convolutional layer conv1, a ReLU layer, and a maximum pooling layer pool1; the block2 module consists of an Inception Block, a ReLU layer, a non-local attention module Non-Local, and a maximum pooling layer pool2. Block1 and block2 form a feature extraction module for extracting the spatial and temporal features of vehicle black smoke in the video. FC3 is a linear mapping module, a fully connected layer. Its function is to convert the B×C×1×H×W feature vector obtained after the input vehicle black smoke video is processed by the block1 and block2 modules into a B×2-dimensional feature vector, realizing the binary classification of vehicles with smoke or without smoke. Among them, B is the batch size, C is the number of channels, H is the height of the feature map, and W is the width of the feature map. The Non-Local module captures the long-range dependency of the video sequence by calculating the relationship between different pixels. The calculation formula is as follows: In formula (1), x is the input black smoke image, y is the correlation degree between the pixels of the black smoke image, and i represents the index of the time, space and spatiotemporal position of y to be calculated. Represents all elements, j is the index of all possible enumerated positions; the two-point similarity function f is used to calculate the feature x corresponding to position i i Features x corresponding to all possible positions j j The correlation between the feature mapping function g is to calculate the input signal x at position j j To ensure that the overall information remains unchanged before and after the transformation, y is normalized using C(x). The calculation formula is as follows: g(x j )=W g x j (2) θ(x i )=W θ x i (4) φ(x j )=W φ x j (5) z i =W z y i +x i (7) Among them, W in formula (2) g is the weight to be learned, formulas (4) and (5) are embedding functions, W θ and W φ represents the weight, x in formula (7) i is the input signal of formula (1), y i is the output response of formula (1), W z is the weight matrix used for feature fusion; Step (3) Black smoke classifier evaluation The accuracy, precision, recall, and false alarm rate (FPR) are calculated using the confusion matrix to evaluate the performance of the black smoke classifier, and the evaluation results are output simultaneously. P represents positive samples, N represents negative samples, T represents the predicted value is the same as the true value, F represents the predicted value is the opposite of the true value, TP represents the number of samples where both the predicted value and the true value are positive, TN represents the number of samples where both the predicted value and the true value are negative, FP represents the number of negative samples predicted as positive, and FN represents the number of samples where the true value is positive but predicted as negative. The calculation of accuracy, precision, recall and false alarm rate is as follows: F1_score is the harmonic mean of precision and recall.
2. A lightweight vehicle black smoke detection method based on three-dimensional convolution according to claim 1, characterized in that: In the feature extraction module composed of block 1 and block 2 in the black smoke classifier, the size of the three-dimensional convolution kernel in the convolution layer is 3×3×3. The feature extraction convolution kernel in the spatial dimension is the same as that of the two-dimensional convolution network, which is 3×3. The feature extraction convolution kernel in the time dimension is also 3×3.
