Video target segmentation method based on space-time decoupling attention mechanism

By using the spatiotemporal decoupling attention mechanism and the historical video segment fusion mechanism in ultrasound video segmentation, the problem of the STM algorithm introducing misleading information and high computational cost in global attention in ultrasound videos is solved, and high-precision and fast lesion detection is achieved. detection, ensuring real-time performance and low memory consumption.

WO2024183024A1PCT designated stage expired Publication Date: 2024-09-12SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI

Patent Information

Application Number
PCT/CN2023/080290
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

The existing STM algorithm introduces misleading information and high computational cost due to the global attention mechanism in ultrasound video segmentation, making it difficult to achieve real-time detection. Moreover, memory consumption increases with the number of video frames, and there is a risk of memory overflow.

Method used

A video target segmentation method based on a spatio-temporal decoupled attention mechanism is used to perform temporal and spatial parallel similarity calculations through segmented video sequences. Convolution operations are introduced to limit the number of video frames in the memory module. VQVAE and decoders are combined to improve detection accuracy and speed. .

Benefits of technology

It significantly improves the accuracy of lesion segmentation, reduces computational complexity, enables real-time detection, and avoids the risk of memory overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023080290_12092024_PF_FP_ABST
    Figure CN2023080290_12092024_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to a video target segmentation method based on a space-time decoupling attention mechanism. The method comprises: inputting into a trained video target segmentation model a current video clip to be detected, a previous frame of a current frame, and previous memory video clips including the previous frame, to obtain a predicted mask of the current video clip to be detected, so as to complete target segmentation in the current video clip to be detected; and by using a space-time decoupling attention mechanism, the video target segmentation model performing, in both time and space dimensions, parallel similarity calculation on the inputted current video clip to be detected, previous frame of the current frame, and previous memory video clips including the previous frame, at the same time, acquiring temporal features and spatial features of a target, then obtaining fused features, and, on the basis of the fused features, obtaining the predicted mask of the current video clip to be detected, so as to implement target segmentation. According to the method, masks of lesions can be automatically obtained for inputted segmented ultrasonic video clips, thereby increasing the automatic detection speed and precision of ultrasonic video lesions.
Need to check novelty before this filing date? Find Prior Art

Description

Video object segmentation method based on spatiotemporal decoupling attention mechanism Technical Field

[0001] The present invention relates to the field of video segmentation in medical imaging, and in particular to an ultrasound video segmentation method based on a spatiotemporal decoupling attention mechanism. Background Art

[0002] The existing STM algorithm was developed for natural video and utilizes a "global attention" matching mechanism. This requires performing a global similarity matching calculation on all points in the current frame and the memory frames to extract the global semantic information of any point in the current frame and assist in the segmentation of the current frame. However, unlike natural image videos, in ultrasound videos, lesions are typically located within a local neighborhood spanning memory frames, and using global attention can introduce similar misleading information. Furthermore, the computationally intensive nature of the "global attention" matching mechanism inevitably incurs significant computational costs, making it difficult to achieve real-time performance when the number of memory frames is large. Furthermore, the original STM's memory consumption during operation increases with the number of video frames, posing a risk of memory overflow.

[0003] Summary of the Invention

[0004] To address these issues in the existing technology, the present invention proposes a "spatiotemporal decoupled attention for segmented video sequences" mechanism and a "historical video segment fusion" mechanism. These mechanisms effectively conserve computing power, improve target region detection speed, and filter out interference from the data to enhance detection accuracy. Furthermore, by introducing convolution operations into the memory module, the number of video frames in the memory module is consistently maintained at a safe scale.

[0005] To achieve the above objectives, the technical solutions of the present invention are as follows.

[0006] First, this case proposes a video object segmentation method based on a spatiotemporal decoupled attention mechanism. The method is as follows:

[0007] Input the current video segment to be detected, the previous frame of the current frame, and the previous memory video segment including the previous frame into the trained video object segmentation model to obtain the predicted mask of the current video segment to be detected, and complete the object segmentation in the current video segment to be detected;

[0008] The video target segmentation model uses a spatiotemporal decoupling attention mechanism to perform parallel similarity calculations in both time and space dimensions on the input current video segment to be detected, the previous frame of the current frame, and the previous memory video segments including the previous frame. It simultaneously obtains the temporal and spatial features of the target, and then obtains fused features. Based on the fused features, a predicted mask of the current video segment to be detected is obtained to achieve target segmentation.

[0009] The above technical solution proposes a video segmentation method based on deep learning, which can intelligently process the input segmented ultrasound video frames and automatically obtain the mask of the lesion, which is used to improve the accuracy of automatic detection of lesions in computer-assisted ultrasound videos.

[0010] In one embodiment, a video object segmentation model includes an encoder, a VQVAE module, a temporal attention module, a spatial attention module, and a decoder; wherein:

[0011] The encoder is used to obtain a pair of key feature maps (key) and value feature maps (value) of the current video segment to be detected, a pair of key feature maps and value feature maps of the frame before the current frame, and a pair of key feature maps and value feature maps of the previous memory video segment including the previous frame;

[0012] VQ-VAE (Vector Quantised Variational Autoencoder) is used to discretize the key feature map and value feature map of the current video segment to be detected, the key feature map and value feature map of the previous frame of the current frame, and the key feature map and value feature map of the previous memory video segment including the previous frame;

[0013] The temporal attention module performs similarity matching on the local areas of the corresponding positions of the current video segment to be detected and the memory video segment at adjacent time nodes to obtain temporal features;

[0014] The spatial attention module calculates the pairwise similarity between each frame image in the current video segment to be detected and the previous frame image in a non-local attention manner to obtain spatial features.

[0015] In one embodiment, the spatial attention module uses the following formula to calculate the pairwise similarity between each frame image in the current video segment to be detected and the previous frame image in a non-local attention manner:

[0016] Where: K Q is the key feature map of the current video segment to be detected, K P is the key feature map of the current frame, Represents matrix multiplication operation, Softmax is the normalized exponential function;

[0017] The similarity calculation result and the value feature map of the current frame are combined to obtain the optimized spatial feature map y of the spatial dimension S : y S =[V Q , f(K Q , K P )V P ]

[0018] Where: V Q is the value feature map of the current video segment to be detected, V P is the value feature map of the current frame.

[0019] In one embodiment, obtaining the memory value characteristic map includes the following steps:

[0020] The key feature map KQ of the current video segment to be detected is divided into S2 non-overlapping area blocks along the length and width of the feature map, and each block is represented as T, s are natural numbers, T is the total number of memory video segments, and s is the index of the region block;

[0021] The key feature map K of the previous memory video segment including the previous frame M , and the key feature map of the current video segment to be detected is processed in the same way, and each block is represented as And the local area blocks are set up according to the time dimension

[0022] The similarity is calculated as follows:

[0023] Where: Represents a matrix multiplication operation.

[0024] The local similarity is used as the weight of the memory frame value feature map, and each memory frame value feature map is weighted to obtain the weighted memory value feature map V T , and further with the value feature map V of the current frame Q Merge according to the same region index to obtain the time feature map y after time dimension optimization T :

[0025] In one embodiment, the fused feature map corresponding to the fused feature is obtained by splicing the optimized feature map of the spatial dimension and the optimized feature map of the time dimension along the channel dimension and inputting the result into a convolutional layer for feature fusion.

[0026] In one embodiment, the video target segmentation model includes a memory module for storing video data; the memory module sets a maximum value Max of the number of video frames to be stored; when the number of video frames in the memory video segment reaches the maximum value Max, a convolution operation is used to fuse the video frames in the current video segment to be detected and the memory video segment, so that the number of video frames in the memory module is always maintained at a safe scale.

[0027] In one embodiment, the decoder concatenates the channel dimensions of the temporal feature map and the spatial feature map; the decoder is composed of M1 refinement modules, each of which is composed of M2 residual convolution blocks connected in series, where M1 and M2 are set values; in each refinement module, the decoder performs a jump connection between the output of the previous refinement module and the feature map of the encoder corresponding to the current output, and resizes the output feature map to the size of the current frame by interpolation, thereby obtaining a predicted mask for the current frame.

[0028] In one embodiment, the loss function used in the training of the video object segmentation model is as follows: Ltotal=Lseg+αLinfo Lseg=Ldice(pred,GT)+Lbce(pred,GT) Linfo=Func(Fstm,Fmemo)

[0029] Where: α is a hyperparameter greater than 0, such as 1, Ldice represents the Dice loss function, Lbce represents the binary cross entropy loss function, pred represents the predicted mask, GT represents the actual mask, Linfo is the information entropy loss function, Fstm is the frame sequence in the memory video segment before fusion, and Fmemo is the frame sequence in the video segment after fusion.

[0030] On the second aspect, this case proposes a computer-readable storage medium storing a computer program that can be loaded by a processor and execute any of the above methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 is a schematic diagram of an STM network framework in one embodiment;

[0032] Figure 2 is a schematic diagram of a Space-time memory read module in one embodiment;

[0033] FIG3 is a schematic diagram of a video object segmentation model in one embodiment;

[0034] FIG4 is a schematic diagram of a memory module (Memory) memory video segment fusion mechanism in one embodiment. DETAILED DESCRIPTION

[0035] Automatically and accurately segmenting lesions in ultrasound videos is crucial for computer-assisted clinical examination and treatment. This task can be formulated as a binary labeling problem for each frame of an ultrasound video, using a computer-assisted system to automatically perform pixel-level annotation of lesions in ultrasound video data. Compared to ultrasound image segmentation, ultrasound video segmentation provides temporal information about lesions, which is more relevant to clinical diagnosis and treatment needs.

[0036] However, due to the presence of various artifacts in clinical breast ultrasound imaging, such as speckle noise, low contrast and intensity unevenness, and blurred boundaries between lesion and non-lesion areas, the ultrasound video segmentation task is extremely technically challenging. In addition, in order to fully utilize temporal dimension information, existing computational models usually need to simultaneously store, process and fuse multiple frames of image information, which requires huge computational effort and makes it difficult to meet real-time, low-latency clinical needs.

[0037] Figure 1 is a schematic diagram of the overall framework of the Space-Time Memory Network (STM) model. This model assumes that in real-world video segmentation problems, as the prediction results of previous frames increase, the segmentation cues available for the current frame become richer. Therefore, STM proposes using a memory network to record intermediate information, from which it can learn to retrieve relevant information about the segmentation target and assist in the segmentation of subsequent frames. The STM network architecture consists of two processing components: memory and query. The query is the current frame, and the memory stores information about all frames before the current frame, hereafter referred to as the memory frame. The memory frame input is 4D, consisting of an RGB image and a single-channel target mask, while the current frame input is only RGB. The encoders for both the memory and current frames use the ResNet50 network as the base network, but with different numbers of input channels. Two parallel convolutional branches are then connected to generate key and value feature maps, respectively. Then, the Key / Value of the memory frame and the current frame are calculated through the Space-time memory read module for global attention. As shown in Figure 2, the key of the current frame and the memory frame are multiplied and subjected to the Softmax operation. The key is multiplied with the value of the memory frame as a weight coefficient, and then concatenated with the value of the current frame as the input of the decoder. After passing through the decoder, the target mask of the current frame is obtained, and the segmentation of the current frame is completed.

[0038] The aforementioned STM algorithm was developed for natural video and utilizes a "global attention" matching mechanism. This requires pairwise similarity matching between all points in the current frame and all points in the memory frames to extract global semantic information from any point in the current frame, assisting with segmentation. However, unlike natural image videos, lesions in ultrasound videos are often localized within a local neighborhood across memory frames, and using global attention can introduce similar misleading information. Furthermore, the computationally intensive nature of the "global self-attention" matching mechanism inevitably incurs significant computational costs, making it difficult to achieve real-time performance when the number of memory frames is large. Furthermore, the original STM's memory consumption increases with the number of video frames, posing a risk of memory overflow.

[0039] To this end, the video target segmentation method based on the spatiotemporal decoupling attention mechanism proposed in this case can be used, combined with the characteristics of the lesion, to intelligently process the ultrasound video of the segmented video sequence and automatically obtain the lesion mask, which can not only significantly improve the lesion segmentation accuracy, but also greatly reduce the complexity of the calculation.

[0040] Specifically, during the video segmentation process, the video sequence to be detected is first divided into multiple video segments (Clips), and in the subsequent processing, the video segments (Clips) are input as the smallest unit. The memory video segment (Memory Clip) and the current video segment to be detected (Query Clip) are first encoded into key feature maps (key) and value feature maps (value) through the memory encoder (Memory Encoder) and the current video segment encoder (Query Encoder), respectively. Each key feature map (key) and value feature map (value) are then input into VQVAE for discretization, and then the discretized key feature maps (key) and value feature maps (value) are input into the subsequent time-space decoupling attention module.

[0041] Unlike STM, which constructs a global memory reading module in video space, the method proposed in this paper decomposes the spatiotemporal memory module into two parallel lightweight modules along the spatial and temporal dimensions. In the temporal attention module, attention is paid to the local areas of the corresponding positions of the current video segment to be detected (Query Clip) and the memory video segment (Memory Clip) at adjacent time nodes for similarity matching, and the movement trajectory of the target area in the memory video segment (Memory Clip) is modeled; while in the spatial attention module, the attention between each frame image in the current video segment to be detected (Query Clip) and the previous frame image is calculated in a non-local attention manner, which simulates the global similarity of the static background texture between two adjacent video frames of the current video segment to be detected (Query Clip).

[0042] Furthermore, the memory consumption of the original STM during operation increases with the number of video frames, posing a risk of memory overflow. The method proposed in this paper introduces a convolution operation in the memory module, ensuring that the number of video frames in the memory module is always maintained at a safe scale.

[0043] In one embodiment, an ultrasound video segmentation model based on a spatiotemporal decoupled attention mechanism for segmented video sequences is shown in FIG3 , and its components are described as follows:

[0044] (I) Encoder

[0045] Use Query Clip to mark the current video segment to be detected, Previous is the frame before the current frame, Memory Clip is all previous memory video segments including the previous frame, the encoder is recorded as Enc, the decoder is recorded as Dec, and the result generated by the deep learning model is recorded as pred.

[0046] ResNet50 is used as the encoder backbone. For the memory clip, the input channels of the first convolutional layer are modified to 4. The feature maps output by the ResNet50 feature layer are further input into two independent convolutional layers to generate a pair of key feature maps (key) and value feature maps (value). The encoder can also use other popular feature extraction networks, such as ResNet-152, AlexNet, VGGNet, and Inception.

[0047] Therefore, the current video segment to be detected (Query Clip), the previous frame and the memory video segment (Memory Clip) are respectively outputted by the encoder as a pair of key-value feature maps, which are represented as (K Q , V Q ), (K P , V P ), (K M , V M Next, the key and value feature maps are processed sequentially using VQVAE, which maps the feature values ​​to a discrete space to pre-process each pixel. The discretized feature maps are then fed into the time-space decoupled attention module.

[0048] By calculating the similarity in both time and space dimensions in parallel, the present invention not only greatly alleviates the computational complexity of STM, but also effectively obtains the temporal and spatial characteristics of the target, thereby improving the accuracy of target segmentation.

[0049] (II) Temporal-Spatial Decoupled Attention Module

[0050] The memory attention module of STM is decomposed into a temporal attention module and a spatial attention module, which are combined into a temporal-spatial decoupling module in parallel. Among them, the temporal attention module takes the key feature map K of the current video segment to be detected as Q Divide the feature map into S along its length and width 2 non-overlapping area blocks, each of which is represented by T, s are natural numbers, T is the total number of memory video segments, s is the index of the region block, S is a set value, which is any integer greater than 1. The specific value can be set according to the experimental results. The key feature map K of the previous memory video segment including the previous frame M , and the key feature map of the current video segment to be detected is processed in the same way, and each block is represented as And the local area blocks are set up according to the time dimension

[0051] Then, the similarity is calculated using matrix multiplication:

[0052] Where: Represents a matrix multiplication operation.

[0053] After obtaining the normalized similarity, the similarity is used as the weight of the memory frame value feature map to perform weighted calculation of the memory value feature map of the time attention:

[0054] Where: Represents the memory value feature map after weighted calculation of time attention, is the value feature map of the memory frame.

[0055] The memory feature map will be obtained Further and current frame value feature map V Q Merge according to the same region index to obtain the time feature map y T ,Right now:

[0056] For the spatial attention module, the method proposed in the present invention assumes that the motion or change difference between the previous and next frames is small, and the mask of the previous frame can provide a rough guide for the current frame. In an embodiment, to obtain non-local spatial correlation, the pairwise similarity between the previous frame and the current frame is calculated in the following way:

[0057] Where: K Q is the key feature map of the current video segment to be detected, K P is the key feature map of the current frame, Represents matrix multiplication operation, and Softmax is the normalized exponential function.

[0058] Then, the similarity calculation result is merged with the value feature map of the current frame to obtain the spatial attention output: y S =[V Q , f(K Q , K P )V P ]

[0059] The temporal attention module and the spatial attention module, after parallel calculation, will output y S and y T After merging, the features are input into a convolutional layer for feature fusion to obtain a new feature map, which is then input into the decoder.

[0060] It is worth noting that for the temporal attention module in the time dimension, the current video segment (Query Clip) and the memory video segment (Memory Clip) are further split into t time sub-segments. The local regions at corresponding positions on the corresponding time sub-segments are then similarity matched. This method models the movement trajectory of the target region in the memory video segment (Memory Clip). For the spatial dimension attention module, calculations are performed within the current video segment (Query Clip). Each frame within the video segment is similarity matched with the previous frame. This method optimizes the local detail features in each frame.

[0061] In some other embodiments, instead of forming the time-space decoupling module in parallel with the temporal attention module and the spatial attention module, they are combined in serial.

[0062] The temporal attention module and spatial attention module in the present invention can be superimposed N times, and this example uses 1 time.

[0063] (III) Memory Module Historical Video Segment Fusion Mechanism

[0064] Unlike the STM algorithm, which allows the number of video frames in the memory module to grow indefinitely, the method proposed in this paper sets the maximum number of video frames in the memory module to Max. When the number of frames in the memory module reaches Max, a convolution operation is used to fuse the current video segment (Query Clip) with the video frames in the memory module, ensuring that the number of video frames remains at Max.

[0065] Specifically, first, the key and value feature graphs corresponding to the current video segment (Query Clip) and the key and value feature graphs corresponding to the memory video segment (Memory Clip) are evenly divided into X groups along the time dimension. In one embodiment, based on experimental results, X=3 is selected, see Figure 4.

[0066] Next, we group the feature maps using the method shown in Figure 2 to calculate the above features. For group 1, the key feature map K of the first group in the current video segment is Q1 , the key and value feature map of the first group in the memory video segment (K M1 , QM1 ) Execute the calculation of Figure 2 to obtain the value feature map V of the first group in the current video segment Q1 .

[0067] To calculate the next x-th group, we will use the feature map involved in the previous calculation to update the key and value feature maps of the memory video segment: the key feature map K of the previous group in the current video segment Q(x-1) The key feature map of the front end of the memory video segment and the value feature map V of the previous group in the current video segment are spliced ​​along the channel dimension. Q(x-1) Splice it along the channel dimension to the front of the value feature map of the memory video segment. Then perform the calculation in Figure 2 to obtain the value feature map of the xth group of the current video segment.

[0068] And so on, until all X groups of feature maps (V Q1 , V Q2 , V Q3 ).

[0069] Then, we combine all X groups of feature maps (V Q1 , V Q2 , V Q3 ) along the channel dimension to obtain the final result, namely: the value feature map V of the current video segment (Query Clip) Q .

[0070] To ensure the segmentation accuracy of the deep learning model, an information entropy loss function is used to guide the training of this module during the model training phase. Specifically, the information entropy loss function takes two inputs: the video sequence generated by the original STM memory module and the video sequence generated by our memory module's historical video segment fusion mechanism. During the training phase, we minimize the differences between these two sets of video frames. This ensures that the memory module's historical video segment fusion mechanism retains sufficient information when fusing historical frames.

[0071] (IV) Decoder

[0072] The decoder concatenates the channel dimensions of the temporal feature map and the spatial feature map. The decoder consists of M1 refinement modules, each of which consists of M2 residual convolution blocks connected in series. M1 and M2 are adjustable setting values, and the feature map is gradually amplified by the residual convolution block. In each refinement module, the decoder jumps the output of the previous refinement module and the feature map of the encoder corresponding to the current output, and resizes the output feature map to the size of the current frame by interpolation, where the channel is 1, and outputs the predicted mask of the current frame. The interpolation method may be bilinear interpolation, nearest neighbor interpolation, or trilinear interpolation, among others.

[0073] (V) Loss Function

[0074] In summary, the method proposed in the present invention is to input the current video segment to be detected, the previous frame of the current frame, and the previous memory video segment including the previous frame into the trained video target segmentation model, obtain the predicted mask of the current frame, and complete the target segmentation in the current video segment to be detected.

[0075] Among them, the video target segmentation model uses a spatiotemporal decoupling attention mechanism to perform parallel similarity calculations in both time and space dimensions on the input current video segment to be detected, the previous frame of the current frame, and the previous memory video segment including the previous frame. It simultaneously obtains the memory value features and spatial value features of the target, and then obtains the fusion features. Based on the fusion features, the predicted mask of the current video segment to be detected is obtained to achieve target segmentation.

[0076] As shown in Figure 3, the video object segmentation model includes an encoder, a VQVAE module, a temporal attention module, a spatial attention module, and a decoder; among them:

[0077] (1) Encoders: Two encoders are provided in the embodiment, and are used to obtain a pair of key feature maps (key) and value feature maps (value) of the current video segment to be detected, and a pair of key feature maps and value feature maps of the previous memory video segment including the previous frame. The pair of key feature maps and value feature maps of the previous frame of the current frame can be obtained by processing the previous memory video segment including the previous frame.

[0078] (2) VQ-VAE (Vector Quantised Variational Autoencoder), which discretizes the key feature map and value feature map of the current video segment to be detected, a pair of key feature maps and value feature maps of the previous frame of the current frame, and the key feature maps and value feature maps of the previous memory video segment including the previous frame;

[0079] (3) Temporal attention module, which performs similarity matching on the local areas of the corresponding positions of the current video segment to be detected and the memory video segment at adjacent time nodes to obtain the memory value features;

[0080] (4) Spatial attention module, which calculates the pairwise similarity between each frame image in the current video segment to be detected and the previous frame image in a non-local attention manner to obtain spatial value features.

[0081] The loss function used in the training of the video target segmentation model is divided into two parts. One part is the segmentation loss composed of binary cross entropy loss and Dice loss. The segmentation loss function Lseg includes the predicted mask And the pixel-level binary cross entropy loss and Dice loss of the labeled Y: Lseg = Ldice (pred, GT) + Lbce (pred, GT)

[0082] Where: Ldice represents the Dice loss function, Lbce represents the binary cross entropy loss function, pred represents the predicted mask, and GT represents the actual mask.

[0083] The other part is the information entropy loss function Linfo implemented by information entropy loss: Linfo = Func(Fstm, Fmemo)

[0084] Where: Func represents the information entropy loss function, Linfo is the information entropy loss function, Fstm is the video frame sequence generated by the memory module before fusion, and Fmemo is the video sequence generated by the fusion mechanism of the historical video segments of our memory module (Memory). Ltotal = Lseg + αLinfo

[0085] Wherein: α is a hyperparameter greater than 0, which measures the weight of the two losses and is set to 1 in one embodiment.

[0086] In one embodiment, the video target segmentation method based on the spatiotemporal decoupling attention mechanism is implemented as a video target segmentation system based on the spatiotemporal decoupling attention mechanism.

[0087] Through the above description of the embodiments, those skilled in the art will clearly understand that the present disclosure can be implemented using software plus necessary general-purpose hardware. Of course, it can also be implemented using dedicated hardware, including application-specific integrated circuits, dedicated CPUs, dedicated memories, and dedicated components. Generally speaking, any function performed by a computer program can be easily implemented using corresponding hardware. Moreover, the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits, or dedicated circuits. However, for the present disclosure, software implementation is often the preferred embodiment.

[0088] In one embodiment, the method proposed in the present invention is experimentally verified. The experimental results show that compared with the existing technology, the present invention not only has higher detection accuracy, but also faster detection speed, and can achieve real-time detection. In the experiment, 63 sets of clinical breast nodule ultrasound video data with a resolution of 300×200 and a total of 4619 frames were used to test the present invention. In order to make a quantitative comparison, in addition to the frame rate, four convincing indicator parameters were also used for comparison, namely: Jaccard, Dice, Precision, and Recall. The experimental results are shown in Table 1 below:

[0089] Table 1

[0090] It can be seen from the table that the method proposed in the present invention is superior to the existing methods in terms of detection accuracy and detection speed.

[0091] In summary, the method proposed in the present invention has the following beneficial effects:

[0092] (1) Applicable to lesion segmentation of ultrasound videos. Different from the medical image segmentation method, the present invention makes full use of the temporal dimension information of the video to improve the segmentation results.

[0093] (2) The temporal-spatial decoupled attention module in the method is composed of a temporal attention module and a spatial attention module in parallel. Compared with convolutional neural networks, this module has an infinite field of view when learning features. Compared with the attention mechanism of STM, it greatly reduces the computational complexity.

[0094] (3) The method adopts a memory module historical video segment fusion mechanism. Compared with the historical video frame fusion mechanism used in the previous STM, the algorithm model proposed in the present invention can be run with a smaller device memory while ensuring that the historical frame information will not be discarded at will, further improving the practical applicability.

[0095] (4) The most time-consuming time and space decoupling attention module in the entire method is calculated separately and then combined in a parallel segmented manner. The parallel segmented approach can effectively improve the calculation rate and accelerate the reasoning speed.

[0096] Although the embodiments of the present invention have been described above with reference to the accompanying drawings, the present invention is not limited to the above-mentioned specific embodiments and application fields. The above-mentioned specific embodiments are merely illustrative and instructive, and are not restrictive. A person skilled in the art, guided by this specification and without departing from the scope of protection of the claims of the present invention, may also devise various forms, all of which fall within the scope of protection of the present invention.

Claims

1. A video object segmentation method based on spatiotemporal decoupled attention mechanism, characterized in that: The method is as follows: Input the current video segment to be detected, the previous frame of the current frame, and the previous memory video segment including the previous frame into the trained video target segmentation model to obtain the predicted mask of the current video segment to be detected, and complete the target segmentation in the current video segment to be detected; The video target segmentation model uses a spatiotemporal decoupled attention mechanism to perform parallel similarity calculations in both time and space dimensions on the input current video segment to be detected, the previous frame of the current frame, and the previous memory video segment including the previous frame, and simultaneously obtains the time features and spatial features of the target, and then obtains the fused features. Based on the fused features, the predicted mask of the current video segment to be detected is obtained to achieve target segmentation.

2. The method according to claim 1, characterized in that: The video object segmentation model includes an encoder, a VQVAE module, a temporal attention module, a spatial attention module, and a decoder; among them: The encoder is used to obtain the key feature map (key) and the value feature map (value) of the current video segment to be detected, the key feature map and the value feature map of the previous frame of the current frame, and the key feature map and the value feature map of the previous memory video segment including the previous frame; VQ-VAE (Vector Quantised Variational Autoencoder) is used to discretize the key feature map and value feature map of the current video segment to be detected, the key feature map and value feature map of the previous frame of the current frame, and the key feature map and value feature map of the previous memory video segment including the previous frame; The temporal attention module performs similarity matching on the local areas of the corresponding positions of the current video segment to be detected and the memory video segment at adjacent time nodes to obtain temporal features; The spatial attention module calculates the pairwise similarity between each frame image in the current video segment to be detected and the previous frame image in a non-local attention manner to obtain spatial features.

3. The method according to claim 2, characterized in that: The spatial attention module uses the following formula to calculate the pairwise similarity between each frame image in the current video segment to be detected and the previous frame image in a non-local attention manner: Where: KQ is the key feature map of the current video segment to be detected, K P is the key feature map of the current frame, Represents matrix multiplication operation, Softmax is the normalized exponential function; The similarity calculation result and the value feature map of the current frame are combined to obtain the spatial feature map y after the spatial dimension is optimized. S : y S =[V Q ,f(K Q ,K P )V P ] Where: V Q is the value feature map of the current video segment to be detected, V P is the value feature map of the current frame.

4. The method according to claim 2, characterized in that: The acquisition of the time feature map includes the following steps: The key feature map K of the current video segment to be detected Q , along the length and width of the feature map is divided into S 2 non-overlapping blocks, each of which is represented by k=1, 2,..., T, i=1, 2,..., s, j=1, 2,..., s; T, s are natural numbers, T is the total number of video segments to be remembered, s is the index of the region block, and S is the set value; The key feature map K of the previous memory video segment including the previous frame M , and the key feature map of the current video segment to be detected is processed in the same way, and each block is represented as And the bureau The regional blocks are set up according to the time dimension The similarity is calculated as follows: Where: Represents a matrix multiplication operation. The local similarity is used as the weight of the memory frame value feature map, and each memory frame value feature map is weighted to obtain the weighted memory value feature map V T , and further with the value feature map V of the current frame Q Merge according to the same region index to obtain the time feature map y after time dimension optimization T :

5. The method according to claim 1, characterized in that The fused feature map corresponding to the fused feature is obtained by concatenating the optimized feature map of the spatial dimension and the optimized feature map of the temporal dimension along the channel dimension and inputting them into a convolutional layer for feature fusion.

6. The method according to claim 2, characterized in that: The video object segmentation model includes a memory module for storing memory video segment data; Set the maximum number of video frames to be stored in the memory module Max; When the number of stored video frames reaches the maximum value Max, a convolution operation is used to fuse the video frames in the current video segment to be detected and the stored video segments.

7. The method according to claim 5, characterized in that: The decoder concatenates the channel dimensions of the temporal feature map and the spatial feature map; The decoder consists of M1 refinement modules, each of which is composed of M2 residual convolution blocks connected in series, where M1 and M2 are set values; In each refinement module, the decoder performs a jump connection between the output of the previous refinement module and the feature map of the encoder corresponding to the current output, and resizes the output feature map to the size of the current frame by interpolation to obtain the predicted mask of the current frame.

8. The method according to claim 6, characterized in that: The loss function used in the training of the video object segmentation model is as follows: Ltotal=Lseg+αLinfo Lseg=Ldice(pred,GT)+Lbce(pred,GT) Linfo = Func(Fstm, Fmemo) Among them: α is a hyperparameter greater than 0, Ldice represents the Dice loss function, Lbce represents the binary cross entropy loss function, pred represents the predicted mask, GT represents the actual mask, Linfo is the information entropy loss function, Fstm is the frame sequence in the memory video segment before fusion, and Fmemo is the frame sequence in the video segment obtained after fusion.

9. The method according to claim 8, characterized in that: α=1。 10. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Video target segmentation method, device and equipment

    CN111210446A

  • Interactive video matting system based on mask propagation network

    CN114549574A

  • Image processing method and device

    CN114926479A

  • Image segmentation method and apparatus, model training method and apparatus, device, and storage medium

    US20210366126A1

Cited By

  • Video saliency target detection method based on image annotation

    CN119313885A

  • Video restoration detection method and system based on multi-domain feature fusion

    CN119444621A

  • Action detection method and device, equipment and storage medium

    CN119649472A

  • Motion detection method, device, equipment and storage medium

    CN119649472B

  • Method for recovering blind degraded video with stable time sequence

    CN119693267A