Unsupervised video object segmentation method and system based on long-term and short-term temporal features
By using the method of long and short-term temporal features in unsupervised video target segmentation, combined with non-local attention calculations of spatial guidance and Gaussian correction, the problem of poor segmentation accuracy caused by similar background interference is solved, and stability in complex scenes is achieved. and high-precision target segmentation.
Patent Information
- Application Number
- CN202210513388.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-11
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-05-11
AI Technical Summary
Existing unsupervised video target segmentation methods are difficult to achieve stable segmentation in complex scenes, especially under similar background interference. In particular, methods based on non-local attention ignore the spatial continuity between video frames, resulting in poor segmentation accuracy.
Using a method based on long-term and short-term temporal features, the current frame and the reference frame are mapped to the same deep semantic space through the spatial guidance module to form short-term temporal constraint features, and the long-term temporal sequence between frames is calculated through the Gaussian-modified non-local attention calculation module Features, fuse short-term and long-term features to achieve stable segmentation of video objects.
It significantly improves the anti-interference ability and robustness of similar objects, achieves continuous and stable segmentation of targets in complex video scenes, and enhances segmentation accuracy.
Smart Images

Figure CN114973071B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision, in particular to the field of unsupervised video target segmentation, and specifically relates to an unsupervised video target segmentation method and system based on long-term and short-term temporal feature guidance. Background Art
[0002] Video target segmentation is divided into semi-supervised segmentation and unsupervised segmentation according to whether the initial frame annotation is used as prior information in the test phase. Unsupervised segmentation has a wider application value because it requires the least manual intervention. In recent years, with the rapid development of deep learning, models based on convolutional neural networks have shown good performance in unsupervised video target segmentation tasks. The current unsupervised video target segmentation algorithms based on deep learning can be divided into three categories according to the temporal features used: optical flow-based, recurrent neural network-based, and non-local attention-based.
[0003] The optical flow-based method mainly consists of three main modules: optical flow calculation, feature extraction, and feature fusion. First, the optical flow map between adjacent frames is calculated, and then the convolutional neural network is used to extract the motion features of the optical flow map and the appearance features of the current frame respectively. Finally, the two features are fused to achieve fully automatic video segmentation.
[0004] The recurrent neural network-based method combines the convolutional neural network with the recurrent neural network. The input is images of continuous frames. The recurrent neural network establishes features with historical memory to obtain the video context timing information. Combined with the appearance features of each frame, the segmentation results are decoded frame by frame.
[0005] The method based on non-local attention mainly consists of feature matching and feature fusion. First, non-local calculation is used to achieve dense matching between feature maps to obtain long-term temporal features between frames. Then, the appearance features of the current frame are fused with the long-term temporal features between frames to achieve global semantic consistency segmentation of the video. Compared with methods based on optical flow and recurrent neural networks, methods based on non-local attention can establish longer-range temporal dependencies and still perform well in some complex scenes such as occlusion and rapid target movement. However, there are still the following problems: methods based on non-local attention ignore the spatial continuity between video frames, that is, short-range temporal associations. The non-local attention mechanism only cares about whether the same target appears between frames, and lacks sensitivity to the target position. Therefore, it is very easy to fail in segmentation when semantically similar background objects appear between frames.
[0006] In summary, existing methods still have the problem of unstable segmentation due to similar background interference in unsupervised video target segmentation scenarios. Summary of the invention
[0007] The purpose of the present invention is to provide an unsupervised video target segmentation method and system based on long-term and short-term temporal feature guidance, which can achieve stable target segmentation in complex video scenes, especially in scenes with interference from similar objects.
[0008] To achieve the above object, the technical solution adopted by the present invention is:
[0009] An unsupervised video object segmentation method based on long-term and short-term temporal features comprises the following steps:
[0010] Input the current frame image, the reference frame image and the previous frame segmentation mask, map the current frame image and the reference frame image to the same deep semantic space, and obtain the current frame spatial appearance features and the reference frame spatial appearance features;
[0011] The spatial prior of the target in the current frame is formed by using the segmentation mask of the previous frame as a guide, and the spatial appearance features of the current frame are re-encoded to obtain features based on short-term temporal constraints;
[0012] The feature similarity matrix is calculated by using the features based on the short-term temporal constraints and the reference frame spatial appearance features;
[0013] Find the position with the greatest similarity to each feature vector of the reference frame spatial appearance feature in the features based on the short-term temporal constraints, generate a two-dimensional Gaussian distribution centered on the position, assign Gaussian weights to all feature vectors in the features based on the short-term temporal constraints according to the two-dimensional Gaussian distribution, and obtain a Gaussian distribution matrix;
[0014] The weighted similarity matrix is obtained by multiplying the Gaussian distribution matrix and the feature similarity matrix element by element and performing a softmax operation.
[0015] Dimension conversion is performed based on the weighted similarity matrix to obtain long-term time series features;
[0016] The long-term temporal features are integrated with the features based on short-term temporal constraints to obtain discriminative features, and the video targets are segmented based on the discriminative features.
[0017] Furthermore, the method for re-encoding the spatial appearance features of the current frame is:
[0018] Map the current frame image, the reference frame image, and the segmentation mask of the previous frame to feature maps with the same height, width, and number of channels, and concatenate the current frame image and the reference frame image with the segmentation mask of the previous frame along the channel dimension to obtain the appearance features that fuse the prior information of the target position;
[0019] Perform a convolution operation on the appearance feature, aggregate all channel information, and generate a spatial feature descriptor that integrates short-term temporal information;
[0020] The sigmoid function is used to calculate the weight of each pixel position according to the spatial feature descriptor to form a spatial constraint heat map;
[0021] The spatial constraint heat map is multiplied with the current frame spatial appearance features channel by channel to obtain features based on short-term temporal constraints.
[0022] Furthermore, the sigmoid function is
[0023] Furthermore, the method for calculating the feature similarity matrix is: performing matrix multiplication on the feature matrix based on the short-term temporal constraint and the reference frame spatial appearance feature matrix to obtain the feature similarity matrix.
[0024] Furthermore, a method for performing dimensionality conversion based on a weighted similarity matrix is: performing a matrix multiplication operation on the weighted similarity matrix and the current frame feature (ie, the feature based on the short-term timing constraint), and then performing a dimensionality conversion operation.
[0025] An unsupervised video object segmentation system based on long-term and short-term temporal features, comprising:
[0026] The spatial guidance module is used to map the current frame image and the reference frame image to the same deep semantic space to obtain the spatial appearance features of the current frame and the spatial appearance features of the reference frame; the spatial prior of the target in the current frame is formed by using the segmentation mask of the previous frame as a guide, and the spatial appearance features of the current frame are re-encoded to obtain features based on short-term temporal constraints;
[0027] A non-local attention calculation module based on Gaussian correction is used to calculate a feature similarity matrix through features based on short-term temporal constraints and reference frame spatial appearance features; find the position with the greatest similarity to each feature vector of the reference frame spatial appearance features in the features based on short-term temporal constraints, generate a two-dimensional Gaussian distribution centered on the position, assign Gaussian weights to all feature vectors in the features based on short-term temporal constraints according to the two-dimensional Gaussian distribution, and obtain a Gaussian distribution matrix; obtain an enhanced similarity matrix by element-by-element multiplication of the Gaussian distribution matrix and the feature similarity matrix and performing a softmax operation; obtain long-term temporal features by dimensional transformation based on the enhanced similarity matrix;
[0028] The spatiotemporal feature fusion module is used to fuse long-term temporal features with features based on short-term temporal constraints to obtain discriminant features, and segment video targets based on the discriminant features.
[0029] The spatial guidance of the present invention strengthens the short-term temporal modeling capability of the model, so that the spatial appearance features near the target foreground are further emphasized, weakening the model's attention to the background area; on this basis, the inter-frame feature similarity calculation is weighted based on the Gaussian-corrected non-local attention calculation, thereby weakening the weight of similar background and obtaining more robust long-term temporal features.
[0030] The beneficial effects of the present invention are:
[0031] (1) The present invention has a strong ability to resist interference from similar objects, and can effectively solve the problem of poor segmentation accuracy of unsupervised video target segmentation algorithms in scenarios with interference from similar objects.
[0032] (2) The present invention has strong robustness and can achieve target segmentation continuously and stably in complex video scenes with the help of long-term and short-term temporal features. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A flow chart of an unsupervised video target segmentation method based on long-term and short-term temporal features according to an embodiment;
[0034] Figure 2 The overall framework diagram of an unsupervised video target segmentation system based on long-term and short-term temporal features of an embodiment;
[0035] Figure 3 is an internal structural diagram of a space guidance module of an embodiment;
[0036] Figure 4 An internal structure diagram of the Gaussian-corrected non-local attention calculation of an embodiment;
[0037] Figure 5 The following is a comparison of the segmentation examples of the method of the present invention and the traditional method.
[0038] Figure 6 An example of unsupervised video object segmentation of an embodiment. DETAILED DESCRIPTION
[0039] In order to make the above features and advantages of the present invention more obvious and easy to understand, embodiments are given below and described in detail with reference to the accompanying drawings.
[0040] Figure 1 The flowchart of an unsupervised video target segmentation method based on long-term and short-term temporal features disclosed in this embodiment is shown. The method mainly includes three parts: spatial guidance, non-local attention calculation based on Gaussian correction, and spatiotemporal feature fusion, wherein:
[0041] Spatial guidance refers to forming a spatial prior heat map (i.e., short-term temporal constraint) in the current frame with the help of the segmentation mask of the previous frame, thereby strengthening the target feature area and suppressing the response of the background area, maintaining the visual consistency of the target in a short time;
[0042] The Gaussian-corrected non-local attention calculation refers to modeling the long-term temporal relationship between the current frame and the reference frame, calculating the dense matching between the transmitted feature maps of the current frame and the reference frame, and eliminating the matching clutter of similar pixels through Gaussian weighting, thereby forming a more robust long-term temporal feature;
[0043] Spatiotemporal feature fusion refers to the fusion of temporal features and features based on short-term temporal constraints to form spatiotemporal discriminant features. Based on the discriminant features, segmentation can be completed under the condition of video semantic consistency.
[0044] This embodiment also discloses an unsupervised video object segmentation system based on long-term and short-term temporal features, which is used to implement the above method. Figure 2 The figure shows the overall framework of an unsupervised video target segmentation system based on long-term and short-term temporal features disclosed in this embodiment. The system mainly includes three modules: a spatial guidance module, a non-local attention calculation module based on Gaussian correction, and a spatiotemporal feature fusion module. The method is described in detail below in conjunction with the system.
[0045] like Figure 2 As shown, at time t, the input of the network is the current frame image Reference frame image Segmentation result with the previous frame First, after preprocessing, I t , I0 is mapped to the same deep semantic space to obtain the spatial appearance feature F t , F0; secondly, the spatial guidance module segments the mask M in the previous frame t-1 Under the guidance of F t Re-encode, strengthen the foreground area response, and obtain features based on short-term temporal constraints Then, The reference frame feature F0 is input into the Gaussian-corrected non-local attention calculation module. This module corrects the non-local attention mechanism in a Gaussian weighted manner, which can more accurately establish the long-distance dependency relationship between frames and obtain the long-term temporal feature F between frames. intra ; Then, feature fusion is used to intra and The splicing and fusion along the channel obtain the temporal and spatial fusion discriminant feature X; finally, based on X, the segmentation result M of the current frame image is decoded t .
[0046] The specific implementation of the space guidance module is as follows Figure 3As shown in , it is mainly used to model the short-term temporal information of adjacent frames. t-1 With the feature F of the current frame t As input, generate the spatial prior heat map of the current frame, that is, obtain the features based on short-term temporal constraints The purpose is to weaken the characteristic response of the pixel area far away from the target in the previous frame and maintain the visual consistency of the target in a short time. The specific processing steps include:
[0047] First, F t With M t-1 Combined into a whole, the appearance features of the fused target location prior information are obtained The calculation formula is as follows:
[0048]
[0049] Where: f cat Indicates that the concatenation operation is performed along the channel dimension, where h, w, and C are the height, width, and number of channels of the feature map, respectively.
[0050] Secondly, Perform convolution operation to aggregate all channel information and generate a spatial feature descriptor that integrates short-term temporal information. The calculation formula is as follows:
[0051]
[0052] Where: * represents the convolution operation, and W is the learnable parameter of the convolution kernel.
[0053] Again, the sigmoid function is used to construct the gate mechanism, which mainly acts according to Z t The weight of each pixel position is calculated to focus on the area near the target of the previous frame and suppress the area far away from the target of the previous frame, forming a spatial constraint heat map S t , and its calculation formula is as follows:
[0054]
[0055] Where: is the sigmoid function.
[0056] Finally, the spatial constraint heat map S t and the current frame spatial appearance feature F t Multiply each channel to get features based on short-term timing constraints The calculation formula is as follows:
[0057]
[0058] Where: F t,cRepresents the c-th channel feature map of the current frame, Same reason.
[0059] The Gaussian-corrected non-local attention module is mainly used for modeling long-term temporal information between frames. The similarity calculation is corrected by Gaussian weighting, so that the feature matching of foreground pixels is concentrated in the corresponding foreground area, suppressing the response of the visually similar background area, and generating more robust long-term temporal features. The specific implementation method is as follows Figure 4 shown.
[0060] The first step is to perform feature The matrix is multiplied by the reference frame spatial appearance feature F0 matrix to obtain the feature similarity matrix, and its calculation formula is as follows:
[0061]
[0062] Where: for The transposed matrix of .
[0063] The second step is to find out the eigenvectors in F0. The position z with the largest feature similarity i , and z i Generate a two-dimensional Gaussian distribution for the center point, All vectors in are assigned Gaussian weights to obtain the Gaussian distribution matrix G; for the i-th vector in F0, it is The calculation formula for the Gaussian weight assigned to the jth vector in is as follows:
[0064]
[0065] Where: x i =z i %h,y i =z i / h are the horizontal and vertical coordinates of the center point of the two-dimensional Gaussian distribution, % and / represent the modulus and division operations respectively, h represents the height of the feature map, x j With y j is the two-dimensional image coordinate of the j-th vector; sigma is the standard deviation of the Gaussian distribution.
[0066] The third step is to multiply the Gaussian distribution matrix G and the feature similarity matrix S element by element, and perform the softmax operation on the multiplied matrix along the row to obtain the normalized similarity matrix (i.e., enhanced similarity matrix) corrected by the Gaussian function. The calculation formula is as follows:
[0067]
[0068] Where: S i,jrepresents the value of the subscript position (i, j) in the feature similarity matrix S, G i,j Same reason. Indicates the relationship between the i-th pixel in F0 and The similarity score of the j-th pixel in , k represents a general paradigm for softmax operation along the row, and C represents the number of channels.
[0069] The fourth step is to weight the similarity matrix S r and Perform matrix multiplication operation and obtain the long-term temporal features F between frames after dimension conversion intra , and its calculation formula is as follows:
[0070]
[0071] Where: f reshape Represents a dimension transformation operation.
[0072] In the fifth step, the feature fusion module combines F intra and Perform the concatenation operation and obtain the discriminant feature X through the convolution operation. The calculation formula is as follows:
[0073]
[0074] In the formula, * represents the convolution operation, W is the learnable parameter of the convolution kernel, and f cat Indicates that the concatenation operation is performed along the channel dimension.
[0075] In this embodiment, the system is trained, the input scale of the video frame is set to 3×473×473, and the single batch size of the training stage is set to 12. The learning rate of the system is initialized to 0.0001, and the optimizer used for system training is SGD. Through training, the neural network parameters involved in the three modules in the system are optimized and adjusted.
[0076] Figure 5 The figure shows the comparison of target segmentation results between the method of the present invention and the traditional method. It can be seen that the method of the present invention has more robust segmentation performance in most complex video scenes.
[0077] Figure 6 The figure shows an example of segmentation of the method of the present invention. It can be seen that the target segmentation mask is obtained after the original video frame is input, and it can be seen that the segmentation accuracy of the target is very high.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An unsupervised video object segmentation method based on long-term and short-term temporal features, characterized in that: The following steps are involved: Input the current frame image, the reference frame image and the previous frame segmentation mask, map the current frame image and the reference frame image to the same deep semantic space, and obtain the current frame spatial appearance features and the reference frame spatial appearance features; The spatial prior of the target in the current frame is formed by using the segmentation mask of the previous frame as a guide, and the spatial appearance features of the current frame are re-encoded to obtain features based on short-term temporal constraints; The feature similarity matrix is calculated by using the features based on the short-term temporal constraints and the reference frame spatial appearance features; Find the position with the greatest similarity to each feature vector of the reference frame spatial appearance feature in the features based on the short-term temporal constraints, generate a two-dimensional Gaussian distribution centered on the position, assign Gaussian weights to all feature vectors in the features based on the short-term temporal constraints according to the two-dimensional Gaussian distribution, and obtain a Gaussian distribution matrix; The weighted similarity matrix is obtained by multiplying the Gaussian distribution matrix and the feature similarity matrix element by element and performing a softmax operation. Dimension conversion is performed based on the weighted similarity matrix to obtain long-term time series features; The long-term temporal features are integrated with the features based on short-term temporal constraints to obtain discriminative features, and the video targets are segmented based on the discriminative features.
2. The method according to claim 1, characterized in that The method for re-encoding the spatial appearance features of the current frame is: Map the current frame image, the reference frame image, and the segmentation mask of the previous frame to feature maps with the same height, width, and number of channels, and concatenate the current frame image and the reference frame image with the segmentation mask of the previous frame along the channel dimension to obtain the appearance features that fuse the prior information of the target position; Perform a convolution operation on the appearance feature, aggregate all channel information, and generate a spatial feature descriptor that integrates short-term temporal information; The sigmoid function is used to calculate the weight of each pixel position according to the spatial feature descriptor to form a spatial constraint heat map; The spatial constraint heat map is multiplied with the current frame spatial appearance features channel by channel to obtain features based on short-term temporal constraints.
3. The method according to claim 2, characterized in that The sigmoid function is 4. The method according to claim 1, characterized in that The method for calculating the feature similarity matrix is: performing matrix multiplication on the feature matrix based on the short-term temporal constraints and the reference frame spatial appearance feature matrix to obtain the feature similarity matrix.
5. The method according to claim 1, characterized in that The method for performing dimension conversion based on the weighted similarity matrix is: performing a matrix multiplication operation on the weighted similarity matrix and the feature based on the short-term timing constraint, and then performing a dimension conversion operation.
6. The method according to claim 1, characterized in that The long-term temporal features are integrated with the features based on short-term temporal constraints and the discriminative features are obtained through convolution operation.
7. An unsupervised video object segmentation system based on long-term and short-term temporal features, characterized in that: include: A spatial guidance module is used to map the current frame image and the reference frame image to the same deep semantic space to obtain the current frame spatial appearance features and the reference frame spatial appearance features; The spatial prior of the target in the current frame is formed by using the segmentation mask of the previous frame as a guide, and the spatial appearance features of the current frame are re-encoded to obtain features based on short-term temporal constraints; A Gaussian-corrected non-local attention calculation module is used to calculate the feature similarity matrix using features based on short-term temporal constraints and reference frame spatial appearance features; Find the position with the greatest similarity to each feature vector of the reference frame spatial appearance feature in the features based on short-term temporal constraints, generate a two-dimensional Gaussian distribution centered on the position, assign Gaussian weights to all feature vectors in the features based on short-term temporal constraints according to the two-dimensional Gaussian distribution, and obtain a Gaussian distribution matrix; obtain an enhanced similarity matrix by element-by-element multiplication of the Gaussian distribution matrix and the feature similarity matrix and performing a softmax operation; obtain long-term temporal features by dimensional transformation based on the enhanced similarity matrix; The spatiotemporal feature fusion module is used to fuse long-term temporal features with features based on short-term temporal constraints to obtain discriminant features, and segment video targets based on the discriminant features.
8. The system according to claim 7, characterized in that The system is trained using training data, and the optimizer SGD is used to optimize and adjust the network parameters in the system.
