Truck segmentation method in surveillance video based on dual self-attention mechanism

By using dual self-attention network and expectation maximization algorithm in truck segmentation, the problem of information loss in deep learning methods is solved by integrating spatial and channel information, and achieving higher segmentation accuracy and precision.

CN112418227BInactive Publication Date: 2024-09-20BEIJING UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011169502.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-28
Publication Date
2024-09-20
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In semantic segmentation, as the depth of the network deepens, the resolution of the deep learning method decreases, the spatial information is lost, and the contextual information is missing. The existing algorithms are not effective in truck target recognition and segmentation.

Method used

A surveillance video truck segmentation method based on dual self-attention network and expectation maximization algorithm is adopted. Global context information is integrated through spatial and channel self-attention modules to reduce information loss, and the self-attention map is iteratively updated through the EM algorithm to improve segmentation accuracy. .

Benefits of technology

The pixel-level segmentation accuracy of truck segmentation is significantly improved, and the average segmentation accuracy is increased by 2.07%. It performs superiorly on the heavy truck data set and the Pascal VOC 2012 data set, reducing information loss and improving segmentation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112418227B
    Figure CN112418227B
Patent Text Reader

Abstract

The present invention discloses a surveillance video truck segmentation method based on a dual self-attention mechanism. The method makes full use of the spatial information and channel information of the feature map, adopts the EM algorithm to reduce the amount of calculation, and improves the performance in the segmentation effect to achieve pixel-level segmentation of the target. The method is applied to the heavy truck dataset, and compared with other methods, the average segmentation accuracy is improved by 2.07%; the method is applied to the public dataset Pascal VOC 2012, and the average segmentation accuracy is also higher than other methods, which reflects the superiority of the method. The spatial attention module proposed in the method integrates global context information and reduces the information loss of the spatial dimension; the channel attention module reconstructs the feature map by low-rank reconstruction to reduce the interference of repeated useless feature maps. Experiments have shown that the dual self-attention mechanism has a certain improvement in the accuracy of truck segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a monitoring video truck segmentation method based on a dual self-attention mechanism, belongs to the field of monitoring videos, and specifically relates to a truck target recognition and segmentation method. Background Art

[0002] The rapid development of intelligent monitoring related technologies and the widespread application of intelligent video surveillance systems have catalyzed the development of image semantic segmentation, making it a research hotspot in the field of computer vision. Semantic segmentation can achieve pixel-level annotation of traffic scenes.

[0003] Early traditional machine learning algorithms such as random decision forests. Shotton et al. used a random decision forest algorithm based on texture features. Another method for solving the semantic segmentation problem is to use a probabilistic graph model. This method first uses parametric statistical methods to over-segment the image based on a few simple features, and then uses the Markov random field (MRF) method to extract complex manual features to classify these superpixels into different geometric classes. Gonfaus et al. used a conditional random field based on a probabilistic graph model to build a system.

[0004] With the development of computer technology, GPU computing power has been significantly improved. Deep learning methods have significantly improved the effect of image processing compared with traditional methods, and more and more convolutional neural network frameworks have emerged. Methods based on fully convolutional networks (FCNs) take advantage of the powerful anti-capacity characteristics of classification networks pre-trained on large-scale data. Several model variants have been proposed to enhance multi-scale context expansion. For example, DeeplabV2 uses atrous spatial pyramid pooling (ASPP) to embed context information, which consists of parallel extended convolutions with different expansion rates. DeeplabV3 extends ASPP with image-level features to further capture global context. Pspnet proposes a pyramid pooling model to collect context information at different scales. GCN uses a large kernel convolution decoupling method to obtain a large feature map receptive field and capture long-range information. Another type is based on U-Net improved by FCN, combining the advantages of high-level features and mid-level features. RefineNet uses the Laplacian image pyramid to explicitly capture the information available during downsampling and output predictions from coarse to fine. DeeplabV3+ adds a decoder to DeeplabV3 to refine the segmentation results, especially along object boundaries.

[0005] Attention mechanisms are widely used in various tasks such as machine translation, visual question answering, and video classification. Non-local first adopted the self-attention mechanism as a template for computer vision tasks such as video classification, object detection, and instance segmentation. PSANet aggregates contextual information for each position through a predicted attention map. A2net proposed a dual attention block to distribute and collect information global features from the entire spatiotemporal space of the image. DANet applies both spatial and channel methods to collect surrounding information of feature maps, which costs more computation and memory than non-local methods.

[0006] Although deep learning methods have greatly improved the semantic segmentation effect, as the network depth increases, the resolution decreases, spatial information is lost, and context information is missing. The spatial attention module proposed in this invention integrates global context information to reduce the information loss in the spatial dimension; the channel attention module reconstructs the feature map using low-rank reconstruction to reduce the interference of repeated and useless feature maps. Experiments have shown that the dual self-attention mechanism has a certain improvement in the accuracy of truck segmentation. Summary of the invention

[0007] The present invention aims to solve the above problems and proposes a surveillance video truck segmentation method based on a dual self-attention network and an expectation-maximization algorithm (EM algorithm). The present invention can make full use of spatial and channel information to improve the performance in classification effect.

[0008] In order to achieve the above object, the present invention implements the steps as follows:

[0009] A surveillance video truck segmentation method based on dual self-attention network and EM algorithm. This method makes full use of the spatial information and channel information of the feature map, uses the EM algorithm to reduce the amount of calculation, and improves the performance in segmentation effect to achieve pixel-level segmentation of the target. The specific implementation steps are as follows:

[0010] (1) Image data acquisition and annotation processing;

[0011] (1a) Using the surveillance camera SDK, obtain the collected original road scene image to be segmented;

[0012] (1b) Obtain the original road scene graph from the surveillance video and mark the location of the truck manually.

[0013] (1c) Obtain a corresponding predicted semantic segmentation image based on the original road scene image to be segmented and a preset scene semantic segmentation model.

[0014] (2) Model construction and training

[0015] The training model consists of three parts. The first part uses Resnet101 as the backbone network to realize feature extraction. The second part is the channel self-attention module, which reshapes the feature map obtained in the first part into N×C (where N=65×65), multiplies it with the preset channel basis, and then obtains the channel self-attention map Z1 through the softmax layer, and multiplies Z1 with the channel basis to update the feature map. The third part is the spatial self-attention module, which is divided into two branches. The upper branch is used to calculate the global context information, and the lower branch is used to calculate the spatial attention information. The feature map obtained in the first part is input into the two branches. The upper branch will obtain the global context information of the feature map through the adaptive global average pooling layer. The lower branch reshapes the feature map into N×C (where N=65×65), multiplies it with the preset spatial basis, and then obtains the spatial self-attention map Z2 through the softmax layer. The feature map is updated by multiplying Z2, the channel basis and the global context information. In the process of updating the channel self-attention map and the channel basis, and the spatial self-attention map and the spatial basis, the idea of ​​EM algorithm is borrowed to accelerate the convergence of the self-attention network. Finally, the feature maps of the first, second and third parts are fused and input into the fully connected network to obtain the final segmentation result.

[0016] During the training process, the original image and semantic segmentation image obtained in step (1) are input into the network training.

[0017] (3) Image segmentation result display and segmented image display

[0018] The predicted value is compared with the true value to obtain the segmentation result, calculate the segmentation accuracy, and display the segmented image in real time.

[0019] Experiments show that when this method is applied to the heavy truck dataset, the average segmentation accuracy is improved by 2.07% compared with other methods; when this method is applied to the public dataset Pascal VOC 2012, the average segmentation accuracy is also higher than other methods, which shows the superiority of this method.

[0020] Compared with existing algorithms, this method has the following significant advantages:

[0021] 1. Use bilinear interpolation method to process the image, avoid excessive use of pooling operations to reduce image dimensions, and reduce image information loss;

[0022] 2. Use the EM algorithm to iteratively update the self-attention map and solution set, and convert the pixel-by-pixel full-image calculation of the attention map into a mapping operation between the attention map and the solution set. The low dimension of the solution set will greatly reduce the amount of calculation;

[0023] 3. Adopting dual self-attention mechanism, it effectively solves the information loss of single attention mechanism (EMAnet) in spatial or channel dimension and improves the segmentation accuracy;

[0024] 4. In the spatial attention module, the global context information is fused with the spatial self-attention information to ensure that more spatial information is extracted and the segmentation accuracy is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a flow chart of the present invention;

[0026] Figure 2 is the overall training model structure of the present invention;

[0027] Figure 3 It is the channel self-attention model structure;

[0028] Figure 4 It is the spatial self-attention model structure;

[0029] Figure 5a is the original road scene image;

[0030] Figure 5b It is the original road scene image that is predicted and the predicted semantic segmentation image is obtained.

[0031] Figure 6a It is the PASCAL VOC 2012 dataset image;

[0032] Figure 6b The predicted semantic segmentation image is obtained by predicting the PASCAL VOC 2012 dataset image; DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solutions and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention.

[0034] The present invention will be further described below in conjunction with the accompanying drawings. Figure 1 , the implementation steps of the present invention are as follows:

[0035] Step 1: Data collection and processing

[0036] 1a) The original video is collected by the JDK of the surveillance camera

[0037] There are two uses for monitoring data. One is to filter, label and process the data to create a data set. The other is to input the collected data into a neural network to obtain a semantically segmented image.

[0038] 1b) Data processing

[0039] The data in the two datasets are first standardized.

[0040]

[0041] Secondly, random size scaling, the scaling ratio is randomly selected from 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, and the scaling method is bilinear interpolation;

[0042] Again, fill the data to a size of 513×513, fill the original image with 0, and fill the label with 255;

[0043] Finally, we crop the data to a size of 513×513.

[0044] Step 2: Model building and training

[0045] 2a) If Figure 2 As shown, the original data (Data) and label (Label) of the dataset are input into the Resnet101 backbone network for feature extraction, and the pre-trained model (Resnet101) is used to extract image information.

[0046] 2b) The feature map is input into the channel attention module (EM-Channel-Attention) and the spatial attention module (EM-Space-Attention) to obtain the channel and spatial attention maps.

[0047] Channel attention module, such as Figure 3 As shown. The feature map extracted by the Resnet101 backbone network has a size of 2048×65×65, and there are a large number of repeated feature maps in the 2048 channels. Therefore, the feature map image is first input into the convolution layer, with a convolution kernel of 1, a step size of 1, and an output channel number of 512. After the convolution layer, the image size is 512×65×65. Secondly, the image feature map is reshaped into N×C (where N=65×65), the channel basis mup size is preset to (1, 512, 64), and the mup initialization method is random assignment. Z is obtained by multiplying the matrix mup by the image. Z passes through a Softmax layer to obtain the probability values ​​of each layer.

[0048] Z = softmax(μX(α t-1 ) T ),

[0049] Where μ is a hyperparameter of the neural network, which is used to control the contribution of the network to Z. mup and attention map Z ~The EM algorithm is introduced in the iterative update process. The E step in the EM algorithm is to use the existing estimated values ​​of the hidden variables to calculate their maximum likelihood estimates; the M step is to maximize the maximum likelihood value obtained in the E step to calculate the value of the parameter. The E step updates the attention map, that is, Update the channel basis in M ​​steps, that is, mup = image × Z ~ , the number of iterations is 3. Finally, the feature map image is updated,

[0050] image=mup×Z ~ ,

[0051] The image size is restored to 512×65×65, and the image is input into the convolution regularization layer with a convolution kernel of 1, a step size of 1, and an output channel number of 512, and then input into the Relu activation layer.

[0052] The spatial attention module is divided into two branches, such as Figure 4 As shown in the figure, the upper branch is used to calculate the global context information, and the right branch is used to calculate the spatial attention information. In the upper branch, the image is input into the convolution layer, whose convolution kernel is 1, the step size is 1, and the number of output channels is 512. It is input into the adaptive global average pooling layer, and the pooling size is 1×1 to obtain the global context information image ~ , update image global =image+image~,image global Input convolution layer, its convolution kernel is 1, stride is 1, number of channels is 21×21 (i.e. s×s). In the right branch, the image inputs the adaptive global average pooling layer, the pooling size is 21×21, then the image feature map is reshaped into N×C (where N=21×21), the preset channel basis mus size is (1, 21×21, 21), and the mus initialization method is random assignment. F is the matrix mus multiplied by the image, and F passes through a Softmax layer to obtain the probability value of each layer.

[0053]

[0054] Where β is a hyperparameter of the neural network, which is used to control the contribution of the network to F. The EM algorithm is introduced into the iterative update process of mus and the attention map F~. The attention map is updated in the E step, that is, Update the channel basis in M ​​steps, that is, mus = image × F~, and the number of iterations is 3. Finally, the feature map image is updated.

[0055] image=mus×F ~ ×image global ,

[0056] The image size is restored to 512×65×65, and the image is input into the convolution regularization layer with a convolution kernel of 1, a step size of 1, and an output channel number of 512, and then input into the Relu activation layer.

[0057] Finally, the feature map is concatenated with the output of the spatial attention module and the channel attention module according to the channel dimension to form a new image. 合 , image 合 Input 3 convolutional layers, the first convolution kernel is 1, the stride is 1, and the number of output channels is 512; the second convolution kernel is 3, the stride is 1, the number of output channels is 256, and the Dropout is 0.1; the third convolution kernel is 1, the stride is 1, and the number of output channels is Nclass (Nclass is the number of segmentation categories, Nclass is 21 in the Pascal VOC 2012 dataset, and Nclass is 2 in the manually labeled truck dataset).

[0058] Train the network. Use a batch size of 16, stochastic gradient descent optimization algorithm (SGD), and 30,000 iterations. Set momentum to 0.9, weight decay delay to 0.0001, and initially set a base learning rate L of 0.001, which will be continuously reduced. is the updated learning rate, and I is the number of current iterators. The standard deviation is All convolutional layers are initialized with zero-mean Gaussian random variables of in Input unit number, fan out is the number of output units in the weight tensor. The biases of all convolutional layers are initialized to zero.

[0059] The update formulas for the spatial basis mus and channel basis mup are as follows

[0060]

[0061]

[0062] Among them, size1 and size2 represent the number of spatial basis and channel basis. mus and mup do not perform reverse gradient propagation.

[0063] The loss function of the channel attention module is Loss 1 , the loss of the spatial attention module is Loss 2 , Loss 1 With Loss 2 They are all defined by the SoftMax CrossEntropy loss function, and the formula is as follows:

[0064]

[0065] Among them, i∈{1,2,3…,21}, is the probability value of the label image belonging to the i-th category, that is, the true distribution value, y i The semantic segmentation model outputs the predicted probability value belonging to the i-th class, that is, the predicted distribution value, y is defined by the SoftMax function, as shown in the following figure

[0066]

[0067] Among them, j∈{1,2,3…,21}. The final loss function of the training network is Loss 合 , as follows

[0068]

[0069] Step 3, image segmentation results

[0070] The predicted value is compared with the true value to obtain the segmentation result and calculate the accuracy.

[0071] Step 4: Output semantic segmentation image

[0072] Display the image results predicted by the network in full screen.

[0073] Experiment and analysis

[0074] 1. Experimental conditions

[0075] The hardware test platform of the present invention is: processor Intel (R) Xeon (R) Gold i7-8700k CPU, main frequency is 3.70GHz, memory is 16GB, graphics card is GeForce RTX 2070; software platform is Windows 10 operating system and PyCharm 2018. The programming language is python, and the pytorch deep learning framework is used to implement the network structure.

[0076] 2. Experimental Data

[0077] The performance evaluation of the present invention mainly uses two datasets: one is the Pascal VOC 2012 dataset, and the other is manually annotated truck monitoring video photos.

[0078] The manually labeled dataset contains pixel annotations of two types of objects: heavy trucks and road background. The entire dataset is divided into two subsets: a training set of 500 items and a validation set of 100 items.

[0079] The Pascal VOC dataset contains pixel annotations of 21 categories of objects, including cars, buildings, animals, airplanes, trains, etc. The background is also annotated in the dataset, but it does not belong to the 21 categories mentioned above. The entire dataset is divided into two subsets: a training set of 1,464 items and a validation set of 1,449 items.

[0080] 3. Performance comparison

[0081] The present invention uses three prior art comparison methods:

[0082] PSPNet comes from the literature Zhao H, Shi J, Qi X, et al. Pyramid Scene Parsing Network[J]. 2016.

[0083] FCN comes from the literature Evan Shelhamer, Jonathan Long, Trevor Darrell.FullyConvolutional Networks for Semantic Segmentation[M].IEEE Computer Society, 2017.

[0084] EMAnet comes from the literature Li X, Zhong Z, Wu J, et al. Expectation-MaximizationAttention Networks for Semantic Segmentation[J]. 2019.

[0085] Table 1

[0086]

[0087]

[0088] As can be seen from Table 1, on the manually annotated heavy truck dataset, the method proposed in this invention performs better than other methods. Compared with EMAnet using only channel attention, the average segmentation accuracy is improved by 2.07%. Figure 5b Segmentation results for the manually labeled truck dataset.

[0089] Table 2

[0090]

[0091] In order to verify the scalability of the model, the model is retrained on the Pascal VOC 2012 dataset. As can be seen from Table 2, the method proposed in this invention is better than other methods. Figure 6bThis is the segmentation effect diagram of the Pascal VOC 2012 dataset.

[0092] In summary, the truck detection and segmentation method based on the dual self-attention mechanism proposed in the present invention improves the single fully connected layer by introducing channel attention information, spatial self-attention information and global context information, and effectively handles the problem of unclear segmentation boundaries. The dual attention mechanism is introduced to reduce data loss in the feature map reconstruction process. Experimental results show that the technology of the present invention has high segmentation accuracy.

Claims

1. A surveillance video truck segmentation method based on a dual self-attention mechanism, characterized by: This method makes full use of the spatial information and channel information of the feature map, uses the EM algorithm to reduce the amount of calculation, and improves the performance in the segmentation effect to achieve pixel-level segmentation of the target; the specific implementation steps are as follows: (1) Image data acquisition and annotation processing; (1a) Using the surveillance camera SDK, obtain the collected original road scene image to be segmented; (1b) Obtain the original road scene image from the surveillance video and manually mark the location of the truck; (1c) obtaining a corresponding predicted semantic segmentation image according to the original road scene image to be segmented and a preset scene semantic segmentation model; (2) Model construction and training The training model consists of three parts. The first part uses Resnet101 as the backbone network to realize feature extraction. The second part is the channel self-attention module, which reshapes the feature map obtained in the first part into N×C, multiplies it with the preset channel basis, and then obtains the channel self-attention map Z1 through the softmax layer, and multiplies Z1 with the channel basis to update the feature map. The third part is the spatial self-attention module, which is divided into two branches, the upper branch is used to calculate the global context information, and the lower branch is used to calculate the spatial attention information. The feature map obtained in the first part is input into the two branches. The upper branch obtains the global context information of the feature map through the adaptive global average pooling layer. The lower branch reshapes the feature map into N×C, multiplies it with the preset spatial basis, and then obtains the spatial self-attention map Z2 through the softmax layer. Z2, the channel basis and the global context information are multiplied to update the feature map. The idea of ​​EM algorithm is used to refer to the update process of the channel self-attention map and the channel basis, and the spatial self-attention map and the spatial basis to accelerate the convergence of the self-attention network. Finally, the feature maps of the first, second and third parts are fused and input into the fully connected network to obtain the final segmentation result. During the training process, the original image and semantic segmentation image obtained in step (1) are input into the network training; (3) Display of image segmentation results and segmented images; Compare the predicted value with the true value to obtain the segmentation result, calculate the segmentation accuracy, and display the segmented image in real time; The loss function of the channel attention module is Loss1, and the loss function of the spatial attention module is Loss2. Both Loss1 and Loss2 are defined by the SoftMax CrossEntropy loss function. The formula is as follows: Among them, i∈{1, 2, 3…, 21}, is the probability value of the label image belonging to the i-th category, that is, the true distribution value, y i The semantic segmentation model outputs the predicted probability value belonging to the i-th category, that is, the predicted distribution value, y i It is defined by the SoftMax function as follows Among them, j∈{1, 2, 3…, 21}; the final loss function of the training network is Loss 合 , as follows 2. The surveillance video truck segmentation method based on dual self-attention mechanism according to claim 1 is characterized in that: The original video is collected through the JDK of the surveillance camera. The surveillance data has two uses. One is to filter and annotate the data to create a data set; the other is to input the collected data into the neural network to obtain a semantic segmentation image.

3. The surveillance video truck segmentation method based on dual self-attention mechanism according to claim 1 is characterized in that: In data processing, the data in the two data sets are first standardized. Secondly, random size scaling, the scaling ratio is randomly selected from 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, and the scaling method is bilinear interpolation; Again, fill the data to a size of 513×513, fill the original image with 0, and fill the label with 255; Finally, we crop the data to a size of 513×513.

4. The surveillance video truck segmentation method based on dual self-attention mechanism according to claim 1 is characterized in that: The original data and labels of the dataset are input into the Resnet101 backbone network for feature extraction, and the image information is extracted using the pre-trained model; the feature map is input into the channel attention module and the spatial attention module to obtain the channel and spatial attention maps.

Citation Information

Patent Citations

  • Video target segmentation method based on dual modulation

    CN110148138A

  • Semantic image segmentation method and system based on edge enhancement

    CN111462126A

  • Semantic segmentation method based on spatial information fusion

    CN111563508A

  • Semantic segmentation with soft cross-entropy loss

    US20200151497A1