Video object segmentation method based on self-supervision
Through multi-pixel scale image reconstruction tasks and self-supervised edge fusion networks, the problems of low accuracy and occlusion drift in video target segmentation are solved, and higher segmentation accuracy and generalization are achieved.
Patent Information
- Application Number
- CN202210658263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-06-10
AI Technical Summary
The accuracy of video target segmentation in the existing technology is low, and target occlusion and tracking drift have a large impact, making it difficult to effectively handle feature extraction and segmentation of large and small targets.
A self-supervised learning method for multi-pixel scale image reconstruction tasks is used to extract target features, and the target segmentation mask is corrected through image semantic edges. An edge fusion network based on self-supervision is designed to improve segmentation accuracy and generalization.
It significantly improves the generalization and accuracy of video target segmentation, can better handle feature extraction and segmentation of targets of different scales, and reduces the impact of target occlusion and tracking drift.
Smart Images

Figure CN114863348B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision technology, and further relates to a video target segmentation technology, specifically a video target segmentation method based on self-supervision, which can be used in the fields of autonomous driving, intelligent monitoring, and intelligent tracking of unmanned aerial vehicles. Background Art
[0002] Computer vision aims to imitate the process of human visual perception and is a key link in the development of artificial intelligence technology. Computer vision algorithms seek to simulate human visual behavior to the greatest extent possible with higher accuracy and provide perceptual information for downstream tasks. In the human perception system, image transformation is a continuous process. Under the current background of visual technology, the image storage method that is closest to human perception is video. Therefore, computer vision algorithms that process video tasks are more capable of simulating human visual behavior.
[0003] Video target segmentation is an important topic in video processing tasks, and its purpose is to segment the target of interest from the background in a series of video sequences. In recent years, due to the excellent performance of deep learning technology in computer vision tasks (such as image recognition, target tracking, action recognition, etc.), the video target segmentation algorithm based on deep learning has become the mainstream method for solving video target segmentation tasks. The performance of the video target segmentation algorithm based on deep learning depends on the scale of the neural network it uses. The performance of the neural network depends on a large amount of training data. The larger the scale of the training data set, the better the generalization and robustness of the trained neural network. Under the paradigm of supervised learning, the production process of the video target segmentation training data set is costly and time-consuming. It is necessary not only to label every pixel in the image in space, but also to label every frame in the video sequence in time. The performance of the video target segmentation model is also closely related to the structure. By optimizing the inference process of the video target segmentation model, the errors in the video target segmentation process can be effectively reduced.
[0004] The research goal of self-supervised learning is to train deep learning models without any manual annotation, so that they can extract effective visual representation information from a large number of unlabeled pictures or video data sets, and the extracted information is fine-tuned for use in downstream tasks. Video object segmentation based on self-supervised learning is designed for the specific task of semi-supervised video object segmentation. The video object segmentation model is trained through self-supervised learning methods. The trained model can be directly used for video object segmentation tasks, and no manual annotation data set is required during the entire training process.
[0005] The research on self-supervised video target segmentation methods can be basically divided into two lines. One is to design a better pre-task training model to enable the model to have better representation extraction capabilities; the other is to introduce more mechanisms to reduce the impact of target occlusion and tracking drift for the problem of semi-supervised video target segmentation. Colorizer et al. published an article entitled "Tracking emerges by colorizing videos" in the European Conference on Computer Vision in 2018, proposing a self-supervised video tracking colorization model. The model uses the natural temporal coherence of color to learn to color grayscale videos, further improving the effect of self-supervised video tracking technology. However, since it is based on the propagation of the previous frame, it is less robust to target occlusion and tracking drift. Corrflow et al. published an article entitled "Self supervised video representation learning for correspondence flow" at the British Machine Vision Conference in 2019. By introducing a restricted attention mechanism, the resolution of the model input is improved without increasing the burden on the computing device, and the accuracy of segmentation is improved. However, this method does not consider the generalization of feature extraction of targets of different scales, and performs poorly when the target scales differ too much. Summary of the invention
[0006] The purpose of the present invention is to propose a video target segmentation method based on self-supervision in view of the above-mentioned deficiencies in the prior art, so as to solve the technical problems existing in the prior art such as low segmentation accuracy, large influence of target occlusion and tracking drift.
[0007] The idea of implementing the present invention is: first, a self-supervised learning method based on a multi-pixel scale image reconstruction task is used to extract target features, so that the video target segmentation model can take into account the features of both large targets and small targets to obtain better generalization performance. Then, in view of the error accumulation problem generated by the video target segmentation model when performing target segmentation, it is proposed to use image semantic edges to correct the target segmentation mask; finally, an edge fusion network based on self-supervision is designed to obtain a more accurate target segmentation mask. Compared with the traditional self-supervised video target segmentation method, the present invention effectively improves the generalization and accuracy of video target segmentation.
[0008] To achieve the above object, the technical solution adopted by the present invention includes the following steps:
[0009] (1) Obtain training sample set, verification sample set and test sample set:
[0010] Obtain video sequences from the video target segmentation dataset and perform preprocessing to obtain a frame sequence set V. The frame sequences in the set are divided to obtain a training sample set V. train , validation sample set V val And the test sample set V test ;
[0011] (2) Build and train the image reconstruction neural network model R:
[0012] (2a) constructing an image reconstruction neural network model R consisting of a feature extraction network, wherein the feature extraction network adopts a residual network including multiple convolutional layers, multiple pooling layers, multiple residual unit modules and a single fully connected layer connected in sequence;
[0013] (2b) Define the loss function of the image reconstruction neural network model R:
[0014] L mix =αL cls +(1-α)L reg
[0015] in, Represents the cross entropy loss function for the quantitative image reconstruction task, for the training sample set Select E cluster centroids {μ1,μ2,...,μ E}, and E≤50; according to the distance between the training sample and the cluster centroid, calculate the category to which the sample belongs, and set the number of target categories contained in the frame sequence set V as C; modify the position of the cluster centroid so that the labels of the same target in the frame are the same, and the labels of different targets are different, where, Represents a given frame image I t The i-th pixel belongs to the category, Indicates the prediction result using the K-means algorithm, L reg represents the regression loss function for the RGB image reconstruction task, in, in is the real target frame pixel, To reconstruct the target frame pixels, α represents the weight coefficient, 0.1≤α≤0.9;
[0016] (2c) Set the feature extraction network parameters and the maximum number of iterations N, reconstruct the loss function of the neural network model R according to the image, and use the training sample set V train The target frame picture in is used to iteratively train the image reconstruction neural network model R to obtain the trained image reconstruction neural network model R;
[0017] (3) Build and train the side output edge detection network model Q:
[0018] (3a) constructing an edge detection network model Q including a side output edge detection layer SODL and a side output edge fusion layer SOFL connected in sequence, wherein the side output edge detection layer SODL includes a deconvolution layer and a convolution layer with a convolution kernel size of 1×1 and an output channel number of 1, and the side output edge fusion layer SOFL is a convolution layer with a convolution kernel size of 1×1 and a channel number of 1;
[0019] (3b) Define the loss function of the side output edge detection network model Q:
[0020] L edge =L side +L fuse
[0021] Among them, L side represents the side output edge detection loss function, Among them, β i represents the weight coefficient of the i-th side output edge detection network, The loss function of the prediction result of the i-th side output edge detection network is shown as:
[0022]
[0023] in, Where e represents the true value of the target edge of the input image, |e - | represents the number of pixels that are edges in the true value of the edge of the image target, |e + | represents the number of non-edge pixels in the true value of the edge of the image target, ω i represents the parameters of the convolutional layer, L fuse Represents the edge fusion loss function:
[0024]
[0025] (3c) setting a maximum number of iterations I, iteratively training the side output edge detection network model Q according to the loss function of the side output edge detection network model Q and using the feature map set output by each structural layer of the feature extraction network in the image reconstruction neural network model R to obtain a trained side output edge detection network model Q;
[0026] (4) Build and train the edge correction network model Z:
[0027] (4a) Sequentially connect the dilated spatial convolutional pooling pyramid model F γ And softmax activation function output layer, where the void space convolution pooling pyramid model F γ It is composed of multiple convolutional layers and pooling layers connected in sequence to obtain the edge correction network model Z;
[0028] (4b) Define the loss function of the edge correction network model Z:
[0029]
[0030] in, The rough segmentation result of the target frame output by the edge detection layer. F is the dilated spatial convolutional pooling pyramid model γ The prediction results, in, Represents the image edge obtained by the Canny algorithm, and M represents the mask The number of categories of pixels in , Indicates mask The total number of pixels in
[0031] (4c) setting a maximum number of iterations H, iteratively training the edge correction network model Z according to the loss function of the edge correction network model Z and using the output results of the image reconstruction network model R and the edge detection network model Q to obtain a trained edge correction network model Z;
[0032] (5) The trained image reconstruction neural network R, the side output edge detection network Q and the edge correction network model Z are combined to obtain a video target segmentation model based on the image target edge correction segmentation result;
[0033] (6) Obtain self-supervised video target segmentation results:
[0034] The test set The frame images in are used as the input of the video target segmentation model for forward propagation to obtain the predicted segmentation labels of all test frame images, and the final segmentation result image is obtained based on the predicted segmentation labels of the test frame images.
[0035] Compared with the prior art, the present invention has the following advantages:
[0036] First, since this paper uses the reconstruction task of multi-pixel scale images as the prerequisite task of self-supervised learning, the features extracted by the trained model have better generalization for large and small targets in the video segmentation task, thus having better performance in the overall video target segmentation task.
[0037] Second, the present invention uses edge restoration of targets in video images to repair target masks, integrates feature maps extracted from each layer of feature extraction networks in video target segmentation models through a side output edge detection network, predicts candidate target edges in target frames, and uses a self-supervised edge fusion model to fuse the segmentation results output by the video target segmentation model with the target edges output by the side output edge detection network, thereby correcting the segmentation mask according to the target edges to obtain more accurate segmentation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flow chart for implementing the present invention. DETAILED DESCRIPTION
[0039] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0040] Example 1: Reference Figure 1 The present invention proposes a video target segmentation method based on self-supervision, which specifically includes the following steps:
[0041] Step 1: Get the training sample set, validation sample set, and test sample set:
[0042] Obtain video sequences from the video target segmentation dataset and perform preprocessing to obtain a frame sequence set V. The frame sequences in the set are divided to obtain a training sample set V. train , validation sample set V val And the test sample set V test ; The implementation is as follows:
[0043] (1a) Obtain S multi-category video sequences from the video object segmentation dataset and obtain a frame sequence set after preprocessing S≥3000; represents the kth frame sequence consisting of preprocessed image frames, represents the nth image frame in the kth frame sequence, M ≥ 30;
[0044] (1b) Randomly select more than half of the frame sequences from the frame sequence set V to form a training sample set Where S / 2<N<S, for each frame sequence in the training sample set Each target frame image to be segmented Scale the image blocks to p×p×h size and convert the image format from RGB to Lab; extract half of the frame sequences from the remaining frame sequences to form a verification sample set Where J≤S / 4; the other half constitutes the test sample set T≤S / 4, and convert the image format from RGB to Lab.
[0045] Step 2: Build and train the image reconstruction neural network model R:
[0046] (2a) constructing an image reconstruction neural network model R consisting of a feature extraction network, wherein the feature extraction network adopts a residual network including multiple convolutional layers, multiple pooling layers, multiple residual unit modules and a single fully connected layer connected in sequence;
[0047] (2b) Define the loss function of the image reconstruction neural network model R:
[0048] L mix =αL cls +(1-α)L reg
[0049] in, Represents the cross entropy loss function for the quantitative image reconstruction task, for the training sample set Select E cluster centroids {μ1,μ2,...,μ E}, and E≤50; according to the distance between the training sample and the cluster centroid, calculate the category to which the sample belongs, and set the number of target categories contained in the frame sequence set V as C; modify the position of the cluster centroid so that the labels of the same target in the frame are the same, and the labels of different targets are different, where, Represents a given frame image I t The i-th pixel belongs to the category, Indicates the prediction result using the K-means algorithm, L reg represents the regression loss function for the RGB image reconstruction task, in, in is the real target frame pixel, To reconstruct the target frame pixels, α represents the weight coefficient, 0.1≤α≤0.9;
[0050] (2c) Set the feature extraction network parameters and the maximum number of iterations N, reconstruct the loss function of the neural network model R according to the image, and use the training sample set V train The target frame picture in is used to iteratively train the image reconstruction neural network model R to obtain the trained image reconstruction neural network model R; the implementation is as follows:
[0051] (2c1) Let the network hyperparameter of the feature extraction network be θ, the maximum number of iterations be N ≥ 150000, n represents the current number of iterations; let n = 1, the number of initial iterations;
[0052] (2c2) The training sample set V train The target frame image in is used as the input of the image reconstruction neural network model R for forward propagation:
[0053] For each target frame I to be segmented t , select the q frames before it as reference frames {I'0, I1', ..., I' q}, where 2≤q≤5, the target frame I t Its corresponding reference frame set is used as the input of the feature extraction network Φ(.;θ), which extracts I tAnd each reference frame image is subjected to feature extraction to obtain the target frame image feature f t =Φ(I t ; θ), reference frame image feature f′0=Φ(I′0;θ),...,f′ q =Φ(I′ q ; θ), the target frame in the training sample set {I t |0≤t≤N} is used as the input of the K-means algorithm to obtain the quantized image reconstruction loss value L cls , reconstruct the target frame I t Compared with the real target frame I t As the input of the RGB image reconstruction task, the RGB image reconstruction loss value L is obtained reg ;
[0054] (2c3) Using the loss function L mix , through the cross entropy loss L cls and regression loss L reg Calculate the loss value of the image reconstruction neural network Back propagation is used to calculate the network parameter gradient g(θ), and then the network parameter θ is updated by the gradient descent method;
[0055] (2c4) Determine whether n=N. If so, obtain the trained image reconstruction neural network R; otherwise, set n=n+1 and return to execute step (2c2).
[0056] Step 3: Build and train the side output edge detection network model Q:
[0057] (3a) constructing an edge detection network model Q including a side output edge detection layer SODL and a side output edge fusion layer SOFL connected in sequence, wherein the side output edge detection layer SODL includes a deconvolution layer and a convolution layer with a convolution kernel size of 1×1 and an output channel number of 1, and the side output edge fusion layer SOFL is a convolution layer with a convolution kernel size of 1×1 and a channel number of 1;
[0058] (3b) Define the loss function of the side output edge detection network model Q:
[0059] L edge =L side +L fuse
[0060] Among them, L side represents the side output edge detection loss function, Among them, β i represents the weight coefficient of the i-th side output edge detection network, Represents the loss function of the prediction result of the i-th side output edge detection network:
[0061]
[0062] in, Where e represents the true value of the target edge of the input image, |e - | represents the number of pixels that are edges in the true value of the edge of the image target, |e + | represents the number of non-edge pixels in the true value of the edge of the image target, ω i represents the parameters of the convolutional layer, L fuse Represents the edge fusion loss function:
[0063]
[0064] (3c) Set the maximum number of iterations I, and iteratively train the side output edge detection network model Q according to the loss function of the side output edge detection network model Q and the feature map set output by each structural layer of the feature extraction network in the image reconstruction neural network model R to obtain the trained side output edge detection network model Q, which is implemented as follows:
[0065] (3c1) Assume that the maximum number of iterations I≥150000, the current number of iterations is i; let i=1, and initialize the number of iterations;
[0066] (3c2) The feature map set output by each structural layer of the feature extraction network in the image reconstruction network model Perform forward propagation as input to the side output edge detection network:
[0067] (3c3) The output edge detection layer obtains the rough edge of the target from the feature map set, thereby obtaining the rough edge corresponding to each feature map
[0068] (3c4) The rough edge set output by the side output edge detection layer SODL is used as the input of the side output edge fusion layer SOFL, and the rough edges are weighted and fused to obtain the final predicted edge. in, represents the feature map formed by merging rough edges, ω fuse Represents the parameters of the side output edge fusion layer;
[0069] (3c5) Using the loss function L edge , through the side output edge detection loss L side and the side output edge fusion loss L fuse Calculate the loss value of the edge detection network Back propagation is used to calculate the network parameter gradient g(ω), and then the network parameter ω is updated by the gradient descent method;
[0070] (3c6) Determine whether i=I holds. If so, obtain the trained side output edge detection network model Q; otherwise, set i=i+1 and return to execute step (3c2).
[0071] Step 4: Build and train the edge correction network model Z:
[0072] (4a) Sequentially connect the dilated spatial convolutional pooling pyramid model F γ And softmax activation function output layer, where the void space convolution pooling pyramid model F γ It is composed of multiple convolutional layers and pooling layers connected in sequence to obtain the edge correction network model Z;
[0073] (4b) Define the loss function of the edge correction network model Z:
[0074]
[0075] in, The rough segmentation result of the target frame output by the edge detection layer. F is the dilated spatial convolutional pooling pyramid model γ The prediction results, in, Represents the image edge obtained by the Canny algorithm, and M represents the mask The number of categories of pixels in , Indicates mask The total number of pixels in
[0076] (4c) Set the maximum number of iterations H, and iteratively train the edge correction network model Z according to the loss function of the edge correction network model Z and the output results of the image reconstruction network model R and the edge detection network model Q to obtain the trained edge correction network model Z, which is implemented as follows:
[0077] (4c1) Let the maximum number of iterations be H ≥ 150000, and the current number of iterations be h; let h = 1, and initialize the number of iterations;
[0078] (4c2) The target frame rough segmentation result output by the image reconstruction network model R and the edge detection result output by the edge detection network model Q are used as the input of the edge correction network model Z for forward propagation:
[0079] (4c2.1) The edge correction network first roughly segments the target frame And edge detection results Merge in the channel dimension to obtain a feature map of size H×W×(K+1)
[0080] (4c2.2) The feature map As a dilated spatial convolutional pooling pyramid model F γ The input is used to obtain the prediction result of the expanded receptive field;
[0081] (4c2.3) The predicted result of the expanded receptive field is used as the input of the output layer of the softmax activation function. The segmentation label of the pixel is determined according to the probability that each pixel in the feature map belongs to each category, so as to obtain a more accurate target segmentation mask after edge fusion correction of the target frame target segmentation mask. Among them, t Indicates the target frame I t The predicted segmentation labels of
[0082] (4c3) Using the loss function L corr , calculate the loss value of the edge correction network Back propagation is used to calculate the network parameter gradient g(c), and then the network parameter c is updated by the gradient descent method;
[0083] (4c4) Determine whether h=H holds. If so, obtain the trained edge correction network model Z; otherwise, set h=h+1 and return to execute step (4c2).
[0084] Step 5: The trained image reconstruction neural network R, the side output edge detection network Q and the edge correction network model Z are combined to obtain a video target segmentation model based on the image target edge correction segmentation result. Specifically, the combination is performed in the following manner: the intermediate feature map extracted by the image reconstruction neural network R is input into the side output edge detection network Q to obtain a target edge prediction map. The target segmentation mask prediction map output by the image reconstruction neural network R and the target edge prediction map output by the side output edge detection network Q are used as inputs of the edge correction network model Z to obtain a trained video target segmentation model based on the image target edge correction segmentation result.
[0085] Step 6: Obtain self-supervised video object segmentation results:
[0086] The test set The frame images in are used as the input of the video target segmentation model for forward propagation to obtain the predicted segmentation labels of all test frame images, and the final segmentation result image is obtained based on the predicted segmentation labels of the test frame images.
[0087] Embodiment 2: The overall steps of this embodiment are the same as those of Embodiment 1, and specific values are given for the settings of some parameters to further describe the implementation process of the present invention:
[0088] Step 1) Obtain training sample set, validation sample set and test sample set:
[0089] Step 1a) Obtain S multi-category video sequences from a video object segmentation dataset, and obtain a frame sequence set V after preprocessing. In this embodiment, the multi-category video sequences are obtained from a YouTube VOS dataset, S=4453, M=50;
[0090] Step 1b) Assume that the number of target categories contained in the frame sequence V is C = 94, and the category set Class = {c num ,1≤num≤C}, multiple categories of targets may appear in each frame sequence, where c num Indicates the num-th type of target;
[0091] Step 1c) randomly select more than half of the frame sequences from the frame sequence set V to form a training sample set Among them, S / 2<N<S, for each frame sequence in the training set Each target frame image to be segmented Scale the image into a size of p×p×h, convert the RGB image into a Lab image, and extract half of the frame sequence from the remaining frame sequence to form a verification sample set Among them, J≤S / 4, and the other half constitutes the test sample set T≤S / 4. Similarly, convert the original image from RGB format to Lab format;
[0092] Set the crop box size to x×y for the frame sequence in the training set For each frame image with segmentation Crop to get the cropped frame image For the cropped frame image Normalization is performed, and the normalized frame images constitute the preprocessed training frame sequence in, is the mth frame sequence in the training sample set;
[0093] In this embodiment, x=256, y=256, p=256, h=3;
[0094] Step 2) Construct the image reconstruction neural network model R:
[0095] Step 2a) Construct the structure of the image reconstruction neural network model R:
[0096] Constructing an image reconstruction neural network model composed of a feature extraction network, wherein the feature extraction network adopts a residual network including a plurality of convolutional layers, a plurality of pooling layers, a plurality of residual unit modules and a single fully connected layer connected in sequence;
[0097] The feature extraction network contains 17 convolutional layers and 1 fully connected layer. The 18-layer structure is divided into 5 blocks, namely conv_1, conv_2, conv_3, conv_4, and conv_5. Conv_1 is a convolutional layer with a convolution kernel size of 7×7 and 64 channels. Conv_2 contains two convolutional layers with a convolution kernel size of 3×3 and 64 channels. The convolution kernel moving distance is 1. Conv_3 contains two convolutional layers with a convolution kernel size of 3×3 and 128 channels. The convolution kernel moving distance of the first convolution layer is set to 2, and the convolution kernel moving distance of the second convolution layer is 1. Conv_4 contains two convolutional layers with a convolution kernel size of 3×3 and 256 channels. The convolution kernel moving distance is 1. Conv_5 contains two convolutional layers with a convolution kernel size of 3×3 and 512 channels. The convolution kernel moving distance is 1.
[0098] Step 2b) Define the loss function of the image reconstruction neural network model:
[0099] L mix =αL cls +(1-α)L reg
[0100] Among them, L cls represents the cross entropy loss function for the quantized image reconstruction task, For the training sample set Select E cluster centroids {μ1,μ2,...,μ E}, where E≤50, calculate the category to which the sample belongs based on the distance between the training sample and the cluster centroid, and correct the location of the cluster centroid so that the labels of the same target in the same frame are the same, and the labels of different targets are different, where Represents a given frame image I t The i-th pixel belongs to the category, Indicates the prediction result using the K-means algorithm, L reg represents the regression loss function for the RGB image reconstruction task, in, in is the real target frame pixel, To reconstruct the target frame pixels, α represents the weight coefficient, 0.1≤α≤0.9;
[0101] In this embodiment, K=16, α=0.6;
[0102] Step 3) Iteratively train the image reconstruction neural network model:
[0103] Step 3a) The network hyperparameter of the feature extraction network is θ, the number of initialization iterations is n, the maximum number of iterations is N, N ≥ 150000, and n = 1;
[0104] In this embodiment, N=300000 is designed to make the model training more sufficient;
[0105] Step 3b) Set the training sample set V train The target frame image in is used as the input of the image reconstruction neural network model R for forward propagation:
[0106] Step 3b1) For each target frame I to be segmented t , select the q frames before it as reference frames {I'0, I1', ..., I q '}, where 2≤q≤5, the target frame I t Its corresponding reference frame set is used as the input of the feature extraction network Φ(.;θ), which extracts I t And each reference frame image is subjected to feature extraction to obtain the target frame image feature f t =Φ(I t ; θ), reference frame image feature f′0=Φ(I′0;θ),...,f′ q =Φ(I′ q ; θ), the target frame in the training sample set {I t |0≤t≤N} is used as the input of the K-means algorithm to obtain the quantized image reconstruction loss value L cls , reconstruct the target frame I t Compared with the real target frame I t As the input of the RGB image reconstruction task, the RGB image reconstruction loss value L is obtained reg ;
[0107] Step 3c) Use the loss function L mix , through the cross entropy loss L cls and regression loss L reg Calculate the loss value of the image reconstruction neural network Back propagation is used to calculate the network parameter gradient g(θ), and then the network parameter θ is updated by the gradient descent method. The update formula is:
[0108]
[0109] Where θ′ represents θ n After updating, γ represents the learning rate, 1e-6≤γ≤1e-3, represents the loss function value of the image reconstruction neural network after the nth iteration, Represents partial derivative calculation.
[0110] In this embodiment, the initial learning rate γ=0.001, when the iteration reaches the 150,000th time, the learning rate γ=0.0005, when the iteration reaches the 200,000th time, the learning rate γ=0.00025, when the iteration reaches the 250,000th time, the learning rate γ=0.000125, the optimizer function uses the Adam optimizer, and the learning rate is decayed when the network iterates to a certain number of times in order to prevent the loss function from falling into a local minimum;
[0111] Step 3d) Determine whether n=N holds true. If so, obtain the trained image reconstruction neural network R. Otherwise, set n=n+1 and execute step (3b);
[0112] Step 4) Build the side output edge detection network model Q:
[0113] Step 4a) Construct the structure of the side output edge detection network model Q:
[0114] Construct an edge detection network model Q including a side output edge detection layer SODL and a side output edge fusion layer SOFL connected in sequence, wherein the side output edge detection layer SODL includes a deconvolution layer and a convolution layer with a convolution kernel size of 1×1 and an output channel number of 1, and the side output edge fusion layer SOFL is a convolution layer with a convolution kernel size of 1×1 and a channel number of 1;
[0115] Step 4b) Define the loss function of the side output edge detection network model:
[0116] L edge =L side +L fuse
[0117] Among them, L side represents the side output edge detection loss function, Among them, β i represents the weight coefficient of the i-th side output edge detection network, Represents the loss function of the prediction result of the i-th side output edge detection network:
[0118]
[0119] in, Where e represents the true value of the target edge of the input image, |e - | represents the number of pixels that are edges in the true value of the edge of the image target, |e + | represents the number of non-edge pixels in the true value of the edge of the image target, ω i represents the parameters of the convolutional layer, L fuse Represents the edge fusion loss function:
[0120]
[0121] Step 5) Iteratively train the side output edge detection network model Q:
[0122] Step 5a) Initialize the number of iterations to i, the maximum number of iterations to I, I≥150000, let i=1;
[0123] In this embodiment, in order to make the model training more sufficient, I=300000;
[0124] Step 5b) The feature map set output by each structural layer of the feature extraction network in the image reconstruction network model Perform forward propagation as input to the side output edge detection network:
[0125] Step 5b1) The side output edge detection layer obtains the rough edge of the target from the feature map set, thereby obtaining the rough edge corresponding to each feature map
[0126] Step 5b2) The rough edge set output by the side output edge detection layer SODL is used as the input of the side output edge fusion layer SOFL, and the rough edges are weighted and fused to obtain the final predicted edge. in, represents the feature map formed by merging rough edges, ω fuse Represents the parameters of the side output edge fusion layer;
[0127] Step 5c) Use the loss function L edge , through the side output edge detection loss L side and the side output edge fusion loss L fuse Calculate the loss value of the edge detection network Back propagation is used to calculate the network parameter gradient g(ω), and then the network parameter ω is updated by the gradient descent method. The update formula is:
[0128]
[0129] Among them, ω′ represents ω i The updated result, β represents the learning rate, 1e-6≤β≤1e-3, represents the loss function value of the output edge detection neural network after the i-th iteration, Represents partial derivative calculation.
[0130] In this embodiment, the initial learning rate β=0.001, when the iteration reaches the 150,000th time, the learning rate β=0.0005, when the iteration reaches the 200,000th time, the learning rate β=0.00025, when the iteration reaches the 250,000th time, the learning rate β=0.000125, the optimizer function uses the Adam optimizer, and the learning rate is decayed when the network iterates to a certain number of times in order to prevent the loss function from falling into a local minimum;
[0131] Step 5d) Determine whether i=I is established. If so, obtain the trained side output edge detection network model Q. Otherwise, set i=i+1 and execute step (5b);
[0132] Step 6) Construct edge correction network model Z:
[0133] Step 6a) Construct the structure of the edge correction network model Z:
[0134] Construct a pyramid model F with sequentially connected dilated spatial convolutional pooling γ and the edge correction network model Z of the softmax activation function output layer, where the void space convolution pooling pyramid model F γ It consists of multiple convolutional layers and pooling layers connected in sequence;
[0135] Dilated Spatial Convolution Pooling Pyramid Model F γ It includes a convolution layer, a pooling pyramid and a pooling block, where the convolution kernel size of the convolution layer is 1×1, the pooling pyramid includes three parallel connected convolution layers, and the convolution kernel size is 3×3. The pooling block includes a 1×1 pooling layer, a convolution layer and an upsampling operation layer, and the convolution kernel size of the convolution layer is 1×1. The feature maps output by the convolution layer, the pooling pyramid and the pooling block modules are concat-operated and then passed through a 1×1 convolution layer to obtain the dilated spatial convolution pooling pyramid model F. γ Output:
[0136] Step 6b) Define the loss function of the edge correction network model Z:
[0137]
[0138] in, The rough segmentation result of the target frame output by the edge detection layer. F is the dilated spatial convolutional pooling pyramid model γ The prediction results, in, Represents the image edge obtained by the Canny algorithm, and M represents the mask The number of categories of pixels in , Indicates mask The total number of pixels in
[0139] Step 7) Iteratively train the edge correction network model Z:
[0140] Step 7a) Initialize the number of iterations to h, the maximum number of iterations to H, H ≥ 150000, and set h = 1;
[0141] In this embodiment, H=300000 is designed to make the model training more sufficient;
[0142] Step 7b) The target frame coarse segmentation result output by the image reconstruction network model and the edge detection result output by the edge detection network model are used as the input of the edge correction network model Z for forward propagation:
[0143] Step 7b1) The edge correction network first roughly segments the target frame And edge detection results Merge in the channel dimension to obtain a feature map of size H×W×(K+1)
[0144] Step 7b2) Feature Map As a dilated spatial convolutional pooling pyramid model F γ The input is used to obtain the prediction result of the expanded receptive field;
[0145] Step 7b3) The predicted result of the expanded receptive field is used as the input of the output layer of the softmax activation function. The segmentation label of the pixel is determined according to the probability of each category at each pixel position in the feature map, thereby obtaining a more accurate target segmentation mask of the target frame after edge fusion correction. Among them, O t Indicates the target frame I t The predicted segmentation labels of
[0146] Step 7c) Use the loss function L corr , calculate the loss value of the edge correction network Back propagation is used to calculate the network parameter gradient g(c), and then the network parameter c is updated by the gradient descent method. The update formula is:
[0147]
[0148] Where c′ represents c h The updated result, α represents the learning rate, 1e-6≤α≤1e-3, represents the loss function value of the edge-corrected neural network after the hth iteration, Represents partial derivative calculation.
[0149] In this embodiment, the initial learning rate α=0.001, when the iteration reaches the 150,000th time, the learning rate α=0.0005, when the iteration reaches the 200,000th time, the learning rate α=0.00025, when the iteration reaches the 250,000th time, the learning rate α=0.000125, the optimizer function uses the Adam optimizer, and the learning rate is decayed when the network iterates to a certain number of times in order to prevent the loss function from falling into a local minimum;
[0150] Step 7d) Determine whether h=H holds. If so, obtain the trained edge correction network model Z. Otherwise, set h=h+1 and execute step (7b);
[0151] Step 8) Obtain the self-supervised video target segmentation results:
[0152] The test set The frame images in are used as the input of the trained video target segmentation model based on the image target edge correction segmentation result for forward propagation. The video target segmentation model based on the image target edge correction segmentation result is composed of an image reconstruction neural network R, a side output edge detection network Q and an edge fusion network Z. The segmentation labels of all test frame images are obtained, and the segmentation result map is determined according to the test frame image segmentation labels.
[0153] The following simulation experiments are used to further illustrate the technical effects of the present invention:
[0154] 1. Simulation conditions and contents:
[0155] 4453 video sequences were obtained from the YouTube-VOS dataset for simulation experiments;
[0156] The simulation experiment was conducted on a server with an Intel(R) Core(TM) i77800x CPU@3.5GHz 64GB CPU and an NVIDIA GeForce RTX 2080ti GPU. The operating system was UBUNTU 16.04, the deep learning framework was PyTorch, and the programming language was Python 3.6.
[0157] The present invention and an existing video target segmentation method are compared and simulated. In order to quantitatively compare the video target segmentation results, the experiment uses two video target segmentation result evaluation indicators, namely, region similarity J and contour similarity F. The higher the two evaluation indicators, the better the change detection result. The simulation results are shown in Table 1.
[0158] Table 1
[0159]
[0160] 2. Analysis of simulation results:
[0161] It can be seen from Table 1 that compared with the existing video segmentation method, the J index and F index of the present invention are significantly improved, indicating that the self-supervised video target segmentation technology constructed by the present invention can effectively solve problems such as target occlusion and tracking drift, thereby improving the video target segmentation accuracy, and therefore has important practical significance and practical value.
[0162] The above simulation analysis proves the correctness and effectiveness of the method proposed in the present invention.
[0163] Parts of the present invention that are not described in detail belong to common knowledge among those skilled in the art.
[0164] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Obviously, for professionals in this field, after understanding the content and principles of the present invention, they may make various modifications and changes in form and details without departing from the principles and structures of the present invention. However, these modifications and changes based on the ideas of the present invention are still within the scope of protection of the claims of the present invention.
Claims
1. A video object segmentation method based on self-supervision, characterized in that: The steps include: (1) Obtain training sample set, verification sample set and test sample set: Obtain video sequences from the video target segmentation dataset and perform preprocessing to obtain a frame sequence set V. The frame sequences in the set are divided to obtain a training sample set V. train , validation sample set V val And the test sample set V test ; (2) Build and train the image reconstruction neural network model R: (2a) constructing an image reconstruction neural network model R consisting of a feature extraction network, wherein the feature extraction network adopts a residual network including multiple convolutional layers, multiple pooling layers, multiple residual unit modules and a single fully connected layer connected in sequence; (2b) Define the loss function of the image reconstruction neural network model R: L mix =αL cls +(1-α)L reg in, Represents the cross entropy loss function for the quantitative image reconstruction task, for the training sample set Select E cluster centroids {μ1,μ2,...,μ E }, and E≤50; according to the distance between the training sample and the cluster centroid, calculate the category to which the sample belongs, and set the number of target categories contained in the frame sequence set V as C; modify the position of the cluster centroid so that the labels of the same target in the frame are the same, and the labels of different targets are different, where, Represents a given frame image I t The i-th pixel belongs to the category, Indicates the prediction result using the K-means algorithm, L reg represents the regression loss function for the RGB image reconstruction task, in, in is the real target frame pixel, To reconstruct the target frame pixels, α represents the weight coefficient, 0.1≤α≤0.9; (2c) Set the feature extraction network parameters and the maximum number of iterations N, reconstruct the loss function of the neural network model R according to the image, and use the training sample set V train The target frame picture in is used to iteratively train the image reconstruction neural network model R to obtain the trained image reconstruction neural network model R; (3) Build and train the side output edge detection network model Q: (3a) constructing an edge detection network model Q including a side output edge detection layer SODL and a side output edge fusion layer SOFL connected in sequence, wherein the side output edge detection layer SODL includes a deconvolution layer and a convolution layer with a convolution kernel size of 1×1 and an output channel number of 1, and the side output edge fusion layer SOFL is a convolution layer with a convolution kernel size of 1×1 and a channel number of 1; (3b) Define the loss function of the side output edge detection network model Q: L edge =L side +L fuse Among them, L side represents the side output edge detection loss function, Among them, β i represents the weight coefficient of the i-th side output edge detection network, Represents the loss function of the prediction result of the i-th side output edge detection network: in, Where e represents the true value of the target edge of the input image, |e - | represents the number of pixels that are edges in the true value of the edge of the image target, |e + | represents the number of non-edge pixels in the true value of the edge of the image target, ω i represents the parameters of the convolutional layer, L fuse Represents the edge fusion loss function: (3c) setting a maximum number of iterations I, iteratively training the side output edge detection network model Q according to the loss function of the side output edge detection network model Q and using the feature map set output by each structural layer of the feature extraction network in the image reconstruction neural network model R to obtain a trained side output edge detection network model Q; (4) Build and train the edge correction network model Z: (4a) Sequentially connect the dilated spatial convolutional pooling pyramid model F γ And softmax activation function output layer, where the void space convolution pooling pyramid model F γ It is composed of multiple convolutional layers and pooling layers connected in sequence to obtain the edge correction network model Z; (4b) Define the loss function of the edge correction network model Z: in, The rough segmentation result of the target frame output by the edge detection layer. F is the dilated spatial convolutional pooling pyramid model γ The prediction results, in, Represents the image edge obtained by the Canny algorithm, and M represents the mask The number of categories of pixels in , Indicates mask The total number of pixels in (4c) setting a maximum number of iterations H, iteratively training the edge correction network model Z according to the loss function of the edge correction network model Z and using the output results of the image reconstruction network model R and the edge detection network model Q to obtain a trained edge correction network model Z; (5) The trained image reconstruction neural network R, the side output edge detection network Q and the edge correction network model Z are combined to obtain a video target segmentation model based on the image target edge correction segmentation result; (6) Obtain self-supervised video target segmentation results: The test set The frame images in are used as the input of the video target segmentation model for forward propagation to obtain the predicted segmentation labels of all test frame images, and the final segmentation result image is obtained based on the predicted segmentation labels of the test frame images.
2. The method according to claim 1, characterized in that: The training sample set V in step (1) train , validation sample set V val And the test sample set V test , follow the steps below to obtain: (1a) Obtain S multi-category video sequences from the video object segmentation dataset and obtain a frame sequence set after preprocessing S≥3000; represents the kth frame sequence consisting of preprocessed image frames, represents the nth image frame in the kth frame sequence, M ≥ 30; (1b) Randomly select more than half of the frame sequences from the frame sequence set V to form a training sample set Where S / 2<N<S, for each frame sequence in the training sample set Each target frame image to be segmented Scale the image blocks to p×p×h size and convert the image format from RGB to Lab; extract half of the frame sequences from the remaining frame sequences to form a verification sample set Where J≤S / 4; the other half constitutes the test sample set T≤S / 4, and convert the image format from RGB to Lab.
3. The method according to claim 1, characterized in that: In step (2c), the image reconstruction neural network model R is iteratively trained as follows: (2c1) Let the network hyperparameter of the feature extraction network be θ, the maximum number of iterations be N ≥ 150000, n represents the current number of iterations; let n = 1, the number of initial iterations; (2c2) The training sample set V train The target frame image in is used as the input of the image reconstruction neural network model R for forward propagation: For each target frame I to be segmented t , select the q frames before it as reference frames {I'0, I'1, ..., I' q }, where 2≤q≤5, the target frame I t Its corresponding reference frame set is used as the input of the feature extraction network Φ(.;θ), which extracts I t And each reference frame image is subjected to feature extraction to obtain the target frame image feature f t =Φ(I t ; θ), reference frame image feature f′0=Φ(I′0;θ),...,f′ q =Φ(I′ q ; θ), the target frame in the training sample set {I t |0≤t≤N} is used as the input of the K-means algorithm to obtain the quantized image reconstruction loss value L cls , reconstruct the target frame I t Compared with the real target frame I t As the input of the RGB image reconstruction task, the RGB image reconstruction loss value L is obtained reg ; (2c3) Using the loss function L mix , through the cross entropy loss L cls and regression loss L reg Calculate the loss value of the image reconstruction neural network Back propagation is used to calculate the network parameter gradient g(θ), and then the network parameter θ is updated by the gradient descent method; (2c4) Determine whether n=N. If so, obtain the trained image reconstruction neural network R; otherwise, set n=n+1 and return to execute step (2c2).
4. The method according to claim 1, characterized in that: In step (3c), the side output edge detection network model Q is iteratively trained as follows: (3c1) Assume that the maximum number of iterations I≥150000, the current number of iterations is i; let i=1, and initialize the number of iterations; (3c2) The feature map set output by each structural layer of the feature extraction network in the image reconstruction network model Perform forward propagation as input to the side output edge detection network: (3c3) The output edge detection layer obtains the rough edge of the target from the feature map set, thereby obtaining the rough edge corresponding to each feature map (3c4) The rough edge set output by the side output edge detection layer SODL is used as the input of the side output edge fusion layer SOFL, and the rough edges are weighted and fused to obtain the final predicted edge. in, represents the feature map formed by merging rough edges, ω fuse Represents the parameters of the side output edge fusion layer; (3c5) Using the loss function L edge , through the side output edge detection loss L side and the side output edge fusion loss L fuse Calculate the loss value of the edge detection network Back propagation is used to calculate the network parameter gradient g(ω), and then the network parameter ω is updated by the gradient descent method; (3c6) Determine whether i=I holds. If so, obtain the trained side output edge detection network model Q; otherwise, set i=i+1 and return to execute step (3c2).
5. The method according to claim 1, characterized in that: In step (4c), the edge correction network model Z is iteratively trained as follows: (4c1) Assume that the maximum number of iterations is H ≥ 150000, and the current number of iterations is h; let h = 1, and initialize the number of iterations; (4c2) The target frame rough segmentation result output by the image reconstruction network model R and the edge detection result output by the edge detection network model Q are used as the input of the edge correction network model Z for forward propagation: (4c2.1) The edge correction network first roughly segments the target frame And edge detection results Merge in the channel dimension to obtain a feature map of size H×W×(K+1) (4c2.2) The feature map As a dilated spatial convolutional pooling pyramid model F γ The input is used to obtain the prediction result of the expanded receptive field; (4c2.3) The predicted result of the expanded receptive field is used as the input of the output layer of the softmax activation function. The segmentation label of the pixel is determined according to the probability that each pixel in the feature map belongs to each category, so as to obtain a more accurate target segmentation mask after edge fusion correction of the target frame target segmentation mask. Among them, t Indicates the target frame I t The predicted segmentation labels of (4c3) Using the loss function L corr , calculate the loss value of the edge correction network Back propagation is used to calculate the network parameter gradient g(c), and then the network parameter c is updated by the gradient descent method; (4c4) Determine whether h=H holds. If so, obtain the trained edge correction network model Z; otherwise, set h=h+1 and return to step (4c2).
6. The method according to claim 1, characterized in that: The video target segmentation model in step (5) specifically inputs the intermediate feature map extracted by the image reconstruction neural network R into the side output edge detection network Q to obtain the target edge prediction map, and uses the target segmentation mask prediction map output by the image reconstruction neural network R and the target edge prediction map output by the side output edge detection network Q as the input of the edge correction network model Z to obtain a trained video target segmentation model based on the image target edge correction segmentation result.
