Patent information
IP India · live recordAbstract
Abstract Disclosed are techniques to propagate labels in a video (10). An encoder network (2) obtains a first set of ground truth feature maps (11) from a labelled frame (I1) of the video, and a second set of ground truth feature maps (12, 13) from at least one labelled key frame (I6, I12) of the video. The encoder network also obtains plurality of sets of feature maps (14) from the plurality of frames (I1, I2, I3……In). The labels are propagated from the labelled frame (I1) to a current frame (I3) based on the first set of ground truth feature maps (11), the set of feature maps for frames (I1, I2) preceding the current frame (I3), and the second set of ground truth feature maps (12, 13) for the identified at least one labelled key frame.
Applicants
2Inventors
2Specification
Show full textCollapse
Description:Complete Specification: The following specification describes and ascertains the nature of this invention and the manner in which it is to be performed
Field of the invention
[001] The present invention relates to the field of video object segmentation and more specifically to a method to propagate labels in a video.
[002] Background of the invention
[003] Label propagation is an approach in the domain of semi-supervised machine learning wherein labels are assigned to previously unlabeled data. Label propagation in video sequences involves transferring labels from a frame in a video to a subsequent frame. These labels may be generated to identify a class of an object or multiple classes of objects or regions of interest.
[004] Typically, label generation is carried out at the frame level independently of the frame sequence in the video. The labels so generated may be sparse. Sparse annotations are not useable for training and validating the modern camera-based AI functions. Further generating labels is costly and time consuming. The prior art : YangZ., Wei, Y., & Yang, Y. (2021). Associating Objects with Transformers for Video Object Segmentation suggests approaches that use a Long-Short-Term-Transformer for constructing hierarchical matching and label propagation using attention-based mechanism across the video. In these approaches, a segmentation mask is generated manually for a frame to serve as a ground truth to propagate the said mask to future frames. For the subsequent frames of the video, the tracked mask are generated for each frame of the video and are added to the memory of the transformer as guidance images. The manually generated segmentation mask is used for long term attention and the tracked mask generated are used for short term attention for label propagation. These approaches however only use the ground truth of the first frame for long term attention. Due to the appearance variations of the objects, fast motion, and occlusions, the semantic labels of the objects are not preserved with time. As a result, incorrect labels get propagated into the neighboring regions and creation of ghost objects. In the present invention, the applicant proposes various improvement concepts to circumvent these limitations.
[005] The present disclosure proposes to improve multi-object tracking and label propagation in video sequences by using a Long Short-Term Transformer (LSTT) model. The objective of the present invention is to handle challenges like object appearance variations, fast motion, and occlusions by incorporating more reliable information into the tracking process. A segmentation mask is generated manually as a ground truth mask and the same is used for long term attention. This segmentation mask is tracked in the subsequent frames of the video to generate tracked mask for each frame and the same is used as temporal information for short term attention. Further, pseudo ground truth masks are infused into the memory at regular intervals, specifically at key frames of the video when the scene (of the frames) changes significantly. These pseudo ground truth masks are also used for long term attention.
[006] The present disclosure provides a forward attention mechanism, wherein, the key frame of the video can be a future frame for a current frame to which the label is to be propagated. Thus, Ground truth of a future key frame can also be used for long term attention, along with the current key frame mask to add more information while calculating the attention, while generating the label for the current frame. Further, the tracked mask for each frame is refined with forward and back ward attention wherein, the tracked mask generated in a frame preceding the current frame and the ground truth mask in a frame succeeding the current frame, both are used to refine tracking of the current frame.
Brief description of the accompanying drawings
[007] An embodiment of the invention is described with reference to the following accompanying drawings:
[008] Figure 1 depicts a processor to propagate labels in a video.
[009] Figure 2 depicts a method to propagate labels in a video.
[0010] Detailed description of the drawings:
[0011] The present disclosure proposes to improve multi-object tracking and label propagation in video sequences by using a Long Short-Term Transformer (LSTT) model. The objective of the present invention is to handle challenges like object appearance variations, fast motion, and occlusions by incorporating more reliable information into the tracking process. A segmentation mask (label) is generated manually as a ground truth mask and the same is used for long term attention. This segmentation mask is tracked in the subsequent frames of the video to generate tracked mask for each frame and the same is used as temporal information for short term attention. Further, pseudo ground truth masks are infused into the memory at regular intervals, specifically at key frames of the video when the scene (of the frames) changes significantly. These pseudo ground truth masks are also used for long term attention.
[0012] The present invention will now be described by way of example, with reference to accompanying drawings. Throughout all the figures, same or corresponding elements may generally be indicated by same reference numerals. These depicted embodiments are to be understood as illustrative of the invention and not as limiting in any way. It should also be understood that the figures are not necessarily to scale and that the embodiments are sometimes illustrated by graphic symbols, phantom lines, diagrammatic representations, and fragmentary views. In predetermined instances, details which are not necessary for an understanding of the present invention, or which render other details difficult to perceive may have been omitted.
[0013] Referring to Figure 1, the same discloses a processor (1) to propagate labels in a video (10). According to an embodiment of the present invention, the video comprises plurality of frames (I1, I2, I3……In) in a sequence. The processor (1) comprises an input-output interface, an associated memory, an encoder network (2), a transformer (6) and a Feature pyramid network (FPN) decoder (5).
[0014] The encoder network (2) is configured to obtain a first set of ground truth feature maps (11) from a labelled frame (I1) of the video, and a second set of ground truth feature maps (12, 13) from at least one labelled key frame (I6, I12) of the video.
[0015] The encoder network is further configured to obtain plurality of sets of feature maps (14) from the plurality of frames (I1, I2, I3……In) such that a set of feature map is received for each frame in the plurality of frames.
[0016] The processor (1) comprises the transformer (6) , the transformer is configured to store the set of feature maps obtained for each frame in the plurality of frames for short term attention, and to store the first and the second set of ground truth feature maps for long term attention.
[0017] The processor is configured to propagate a set of labels from the labelled frame (I1) to a current frame (I3) in the sequence based on the first set of ground truth feature maps (11), the set of feature maps for frames (I1, I2) preceding the current frame (I3), and the second set of ground truth feature maps (12, 13) for the identified at least one labelled key frame.
[0018] The processor (1) comprises the FPN decoder (5) configured to obtain at least one mask for at least one class of an object in the plurality of frames (I1, I2, I3……In) of the video (10).
[0019] The components of the processor are further described. According to the present invention, the processor (1) is a computing device capable of storing and executing instructions stored in a memory. According to an example, the processor may include one or more processing cores, such as a 4-core processor and an 8-core processor. The processor may be implemented in hardware or virtually on a cloud. The processor is configured to process calculation operations related to machine learning. The memory of the processor may include one or more computer-readable storage media, which may be non-transitory. The memory may also include a high-speed random-access memory and a non-volatile memory, such as one or more magnetic disk storage devices and flash storage devices. According to the present invention, the memory is configured to store at least one instruction, the at least one instruction, when executed by the processor implements the method (100) to propagate labels in a video as disclosed in the present invention.
[0020] According to the present invention, the processor comprises the encoder network (2), the transformer (6), and the Feature pyramid network (FPN) decoder (5). A person skilled in the art will appreciate that the encoder network, the transformer and the FPN decoder are Artificial Intelligence based models stored in persistent storage of the processor and loaded into the volatile memory when required for execution.
[0021] The processor comprises the encoder network (2). The encoder network takes an image or a frame (I1….In) from the video (10) as input. This image is usually represented as a matrix of pixel values with dimensions corresponding to the width, height, and number of color channels (e.g., RGB channels). A person skilled in the art will understand that encoder network as known in the art comprises convolutional neural networks (CNNs) to process the image to capture spatial hierarchies in images through a series of convolutional layers, pooling layers, and activation functions. As the image passes through the convolutional layers, it gets transformed into a series of feature maps (11, 12, 13, 14) at various levels of abstraction. These feature maps are essentially representations of the original image, with each map focusing on different aspects or features. Said aspects or features according to an example can be low-level features like edges and textures, complex patterns such as shapes and parts of objects in the image and high-level semantic features such as presence of specific objects or parts of objects in the image. The output from the last convolutional layer of the encoder network serves as the encoded representation of the input image. This encoded form is a set of feature maps that summarize the critical information from the original image.
[0022] According to the present invention, the encoder network (2) is configured to obtain a first set of ground truth feature maps (11) from a labelled frame (I1) of the video. The labelled frame is a semantic segmentation mask that serves as an initial reference or a ground truth for the object of interest in the video. The system then uses this initial mask to track the object across subsequent frames, generating new masks (tracked masks) for each frame. The segmentation mask provides a clear definition of the object's boundaries at the start of the video. This mask serves as a key input to the model. The same is done by a pixel-wise annotation of a video frame where each pixel is labeled with the object class it belongs to. According to an example, said labelled frame is manually created by annotators. Said labelled frame is inputted to the encoder network to obtain the first set of ground truth feature maps.
[0023] According to the present invention, the encoder network (2) is configured to obtain a second set of ground truth feature maps (12, 13) from at least one labelled key frame (I6, I12) of the video. A key frame, according to the present invention is a frame in the video wherein, a scene in the video changes significantly. The term ‘significantly’ is used to denote its general meaning in common parlance. According to an example, if an arm of a dancer is being tracked through label propagation, a significant frame can be a , not in a limiting manner, a frame when the dancer is not present in the frame, a frame where the background of the dancer changes, a frame where the arm gets hidden behind another object in the frame and so on. Hence, a key frame can be a frame due to which propagation of temporal information from the previous frame becomes difficult and affects the overall tracking of the object. These Key frames are also labelled and inputted into the encoder network to receive a second set of ground truth feature maps.
[0024] According to the present invention, the encoder network is configured to obtain plurality of sets of feature maps (14) from plurality of frames (I1, I2, I3 ..I6, …I12…In) such that a set of feature map is received for each frame in plurality of frames. The set of feature map is being generated for all the frames of the video. The ground truth feature maps with labels are compared with the feature maps of the subsequent frames to propagate labels. Through the feature maps of each frame, attention is calculated to propagate the labels from the first frame (I1) to an Nth frame (In). That is, through the feature maps of each frame, attention is calculated to propagate the labels from the first frame (I1) to an Nth frame (In). ‘Attention’ is defined as a mechanism to selectively focus on certain features of feature maps to enhance label propagation. Attention mechanisms are designed to weigh the importance of different elements in the feature map and prioritizing the most relevant features for label propagation.
[0025] According to an embodiment of the present invention, identification embeddings are used to track multiple objects and added to the value feature map before computing attention. Identification embedding are feature vectors (embeddings) for individual objects within a video frame, which helps in distinguishing and tracking these objects across multiple frames.
[0026] According to the present invention, the processor comprises a transformer (6). A person skilled in the art will understand that transformers are neural networks that learn context and understanding through sequential data analysis. Transformers draw inspiration from the encoder-decoder architecture found in RNNs because of their attention mechanism. It can handle sequence-to-sequence (seq2seq) tasks while removing the sequential component.
[0027] According to an embodiment of the present disclosure, the transformer (6) is Long Short-Term transformer (LSTT). LSTTs are capable of learning long-term dependencies due to their memory cells and gating mechanisms. The short-term component of the LSTT can effectively manage and remember short-term dependencies within the data, making it well-suited for tasks where recent context is crucial such as propagating labels across video frames and the Long term component of the LSTT captures long-term dependencies, making it ideal for tasks that require understanding context spread across longer sequences.
[0028] According to the present invention, the transformer (6) is configured to store the set of feature map obtained for each frame in plurality of frames for short term attention. A Short-term attention network (4) of the transformer uses the feature maps generated using the encoder on previously tracked frame to compare them with the feature maps of the current frame. As the temporal continuity is maintained in the current frame, when comparing with the previous frame, matching of the pixel in the feature maps of the current frame is performed with only neighboring pixels in the short-term memory frame. The idea behind the same is that an object’s motion in the frame sequence (continuous frame) mostly reflects in the neighboring regions. Hence matching with only neighboring pixels suffices. This also saves lots of computations.
[0029] According to the present invention, the transformer is configured to store the first and the second set of ground truth feature maps (11, 12, 13) for long term attention. A long-term attention network (3) of the transformer uses the first and second ground truth feature maps from the labelled frame and at least one labelled key frame respectively. As the temporal continuity is not maintained in the current frame, when comparing with the long-term memory frame, matching of the current pixel in the feature maps of the current frame is performed with all the pixels in the first and second ground truth feature maps.
[0030] The feature maps stored in the long term and short-term attention network, mainly the plurality of set of feature maps and the first and second ground truth feature maps, herein, are collectively referred to as ‘memory maps’ (11,12,13,14). Each feature map for the current frame is compared with each memory map using SoftMax. Softmax is a mathematical function that converts raw scores (logits) from the network into probabilities. It is commonly used in the final layer of a neural network for classification tasks because it provides a probability distribution over possible classes, ensuring that the sum of all probabilities is 1.
[0031] According to the present disclosure, said processor (1) is configured to propagate the set of labels from the labelled frame (I1) to the current frame (I3) in the sequence based on the first set of ground truth feature maps (11), the set of feature maps (14) for frames (I1, I2) preceding the current frame (I3), and the second set of ground truth feature maps (12, 13) for the identified at least one labelled key frame.
[0032] During label propagation from frame to frame, each label is associated with a confidence score that indicates a model’s certainty in its predictions. The present disclosure, as a best-known technique to the applicant for implementation of the present invention, proposes to improve the long-term attention by using average confidence across all classes of objects in the frame as a criterion to select the ‘key’ frame for long term attention. The feature maps stored in the long term and short-term attention network herein are alternatively referred to as ‘memory maps’. The present disclosure, as a best-known technique to the applicant for implementation of the present invention, proposes to improve the short-term attention by fusing the confidence scores of ‘memory maps’ using Softmax and further using the corresponding labels to generate the final labels. The refined labels so obtained are used for short term attention. The present disclosure, as a best-known technique to the applicant for implementation of the present invention, proposes to improve short term attention calculation by adopting ‘empirical neighborhood based short term attention’ methodologies. Empirical neighborhood typically refers to a set of pixels or regions around a given pixel or object. This neighborhood is used to calculate attention values, which help the system focus on relevant parts of the frame when determining what objects are present and what labels to assign to them. A global motion in the frames have an adverse impact during label propagation. Global motion refers to the movement of the entire frame, often caused by camera movements such as panning, tilting, or zooming. This global motion can be significant, causing all objects in the scene to shift position uniformly. When there is significant global motion, the predefined empirical neighborhood may no longer accurately represent the relevant area around an object. To solve this problem of global motion affecting label accuracy, the present invention proposes to adaptively update the neighborhood. Instead of using a fixed area, the neighborhood can be dynamically adjusted based on the global motion detected in the frame. By accounting for global motion, the system can better capture the relevant portions of the scene for each object, even if those objects have moved significantly due to the overall movement of the frame. In order to implement the same, feature detection algorithms like IFT (Scale-Invariant Feature Transform), SURF (Speeded Up Robust Features), and ORB (Oriented FAST and Rotated BRIEF) may be used.
[0033] According to the present invention, each pixel of the current frame (through the corresponding feature map of the current frame) is matched with all the pixels in the memory maps using Softmax and the corresponding value is weighed and aggregated.
[0034] According to the present invention, an aggregated feature value is obtained by comparing a set of current feature maps from the current frame (I3) with the memory maps, that is, the first and second ground truth feature maps, and plurality of sets of feature maps from plurality of frames. This aggregate feature value maps are inputted to the FPN decoder (5). The FPN decoder produces a one-hot mask for each object class in the frame. The Feature Pyramid Network (FPN) is an architecture that enhances feature maps at different scales by combining high-level semantic information with fine-grained, low-level details. The decoder part of the FPN takes these multi-scale feature maps and processes them to produce the final output, which, in this case, is segmentation masks. A one-hot mask is a type of representation where each pixel in the mask corresponds to a specific class. In the context of segmentation, a one-hot mask is typically a binary matrix (or tensor for multiple classes) where each channel corresponds to a different class. For a given pixel in a frame, the mask will have a value of 1 in the channel corresponding to the class of the object present at that pixel, and 0 in all other channels.
[0035] Referring to figure 2, the same depicts a method to propagate labels in a video. It is to be understood that the method disclosed herein is to be implemented by the processor described in Figure 1 above.
[0036] According to the present invention, the video comprising plurality of frames (I1, I2, I3… I6…I12…In) in a sequence. The method (100) to propagate labels in the video comprises several steps. The first step (101) is obtaining, from an encoder network, a first set of ground truth feature maps from a labelled frame (I1) of the video. The step (102) is obtaining, from the encoder network, a second set of ground truth feature maps from at least one labelled key frame (I6, I12) of the video. The step (103) is obtaining, from the encoder network, plurality of sets of feature maps from plurality of frames (I1, I2, I3..I6…I12…In) such that, a set of feature map is received for each frame in plurality of frames (I1, I2, I3……In). The characterizing step of method (100) is the step (104) of propagating, a set of labels from the labelled frame (I1) to a current frame (I3) in the sequence based on the first set of ground truth feature maps (101a), the set of feature maps (103a) for frames (I1, I2) preceding the current frame (I3), and the second set of ground truth feature maps (102a) for the at least one labelled key frame (I6,I12), wherein, the at least one key frame (I6, I12) is a frame, that succeeds the current frame (I3).
[0037] The method step (102) further includes the step (102b) of identifying at least one key frame (I6, I12) in plurality of frames (I1, I2, I3……In) and labelling it to obtain said at least one labelled key frame.
[0038] The at least one key frame is a frame in the video wherein, a scene in the video changes significantly. The term ‘significantly’ is used to denote its general meaning in common parlance. According to an example, if an arm of a dancer is being tracked through label propagation, a significant frame can be a, not in a limiting manner, a frame when the dancer is not present in the frame, a frame where the background of the dancer changes, a frame where the arm gets hidden behind another object in the frame and so on. Hence, a key frame can be a frame due to which propagation of temporal information from the previous frame becomes difficult and affects the overall tracking of the object. These Key frames are also labelled and inputted into the encoder network to receive a second set of ground truth feature maps.
[0039] The method (100) includes the step (105) of storing the set of feature map obtained for each frame in plurality of frames in the memory of the transformer for short term attention, and step (106) of storing the first and the second set of ground truth feature maps in the memory of transformer-decoder network for long term attention.
[0040] The further step (107) is obtaining an aggregated feature value by comparing a set of current feature maps from the current frame (I3) with the first and second ground truth feature maps, and plurality of sets of feature maps from plurality of frames. The further step (108) is inputting said aggregated feature value to a FPN decoder to obtain at least one mask for at least one class of an object in plurality of frames (I1, I2, I3… I6…I12…In) of the video. According to the present invention, the labelled frame and the labelled key frame are labelled by any one of a manual annotation and a tool-based annotation.
[0041] According to the present invention, identification embeddings are used to track multiple objects and added to the value feature map before computing attention. Identification embedding are feature vectors (embeddings) for individual objects within a video frame, which helps in distinguishing and tracking these objects across multiple frames.
[0042] A working of the present disclosure is further described. A labelled frame I1 is fed to the encoder network to obtain corresponding ground truth feature maps. Further, key frames are identified and fed to the encoder to obtain another set of ground truth feature maps. These ground truth feature maps are stored for long term attention. Further, the feature map of all the frames wherein label is to to be propagated is also obtained from the encoder. While propagation of label from I1 to a current frame I3, feature maps of the current frame are compared with feature maps stored in the long term and short-term networks of the LSTT using SoftMax. An aggregated value is obtained post this comparison and fed to the feature pyramid network decoder to obtain one hot mask for each object class. To track multiple objects, identification embeddings are used to embed each object mask using identification vectors generated randomly. These identification embedding is added to the value feature map of the memory frame before computing the attention.
[0043] The present invention poses several advantages. Firstly, by using forward attention in a hierarchical manner in long short-term transformer, pixel labels can be improved. Secondly, propagated label mask at each frame can be refined by executing the same algorithms with forward and backward attention. At a time t, attention is calculated with both t-1 and t+1 propagated labels.
[0044] Thirdly, confidence scores of ground truth feature maps and the current frame feature maps are fused for refined label generation. This methodology helps in reducing the overall noise as it considers joint confidences of both the predicted labels and the ground truth labels. , Claims:We Claim: 1. A method (100) to propagate labels in a video, the video comprising plurality of frames (I1, I2, I3… I6…I12…In) in a sequence, the method comprising the steps of:
-obtaining, from an encoder network, a first set of ground truth feature maps from a labelled frame (I1) of the video (101),
-obtaining, from the encoder network, a second set of ground truth feature maps from at least one labelled key frame (I6, I12) of the video (102),
-obtaining, from the encoder network, plurality of sets of feature maps from the plurality of frames (I1, I2, I3… I6…I12…In) such that, a set of feature maps is received for each frame in the plurality of frames (I1, I2, I3… I6…I12…In) (103),
characterized in that,
-propagating, a set of labels from the labelled frame (I1) to a current frame (I3) in the sequence based on:
- the first set of ground truth feature maps,
-the set of feature maps for frames (I1, I2) preceding the current frame (I3), and
-the second set of ground truth feature maps for the at least one labelled key frame (I6, I12) (104).
2. The method (100) as claimed in Claim 1, wherein, identifying at least one key frame (I6, I12) in the plurality of frames (I1, I2, I3… I6…I12…In) and labelling the respective frame to obtain said at least one labelled key frame (102b).
3. The method (100) as claimed in claim 1, wherein, the identified at least one key frame (I6, I12) is a frame succeeding the current frame (I3).
4. The method (100) as claimed in Claim 1, wherein, storing the set of feature maps obtained for each frame in the plurality of frames in a memory of the transformer for short term attention (105).
5. The method as claimed in Claim 1, wherein, storing the first and the second set of ground truth feature maps in the memory of the transformer for long term attention (106).
6. The method (100) as claimed in Claim 1, wherein, obtaining an aggregated feature value by comparing a set of current feature maps from the current frame (I3) with:
-the first and second ground truth feature maps, and
-plurality of sets of feature maps corresponding to the plurality of frames (106).
7. The method (100) as claimed in Claim 5, wherein, inputting said aggregated feature value to a FPN decoder to obtain at least one mask for at least one class of an object in plurality of frames (I1, I2, I3… I6…I12…In) of the video (107).
8. The method (100) as claimed in Claim 1, wherein, obtaining the labelled frame and the labelled key frame by any one of a manual annotation and a tool-based annotation.
9. A processor (1) to propagate labels in a video (10), the video comprising plurality of frames (I1, I2, I3… I6…I12…In) in a sequence , the processor comprising an input-output interface, an associated memory, an encoder network, a transformer and an FPN decoder,
characterized in that processor:
-the encoder network (2) configured to:
- obtain a first set of ground truth feature maps (11) from a labelled frame (I1) of the video,
-obtain a second set of ground truth feature maps (12, 13) from at least one labelled key frame (I6, I12) of the video and,
-obtain plurality of sets of feature maps (14) from the plurality of frames (I1, I2, I3… I6…I12…In) such that a set of feature map is received for each frame in the plurality of frames,
-the transformer (6) configured to store:
-the set of feature maps obtained for each frame in the plurality of frames for short term attention, and
-the first and the second set of ground truth feature maps for long term attention,
-said processor (1) configured to propagate a set of labels from the labelled frame (I1) to a current frame (I3) in the sequence based on:
- the first set of ground truth feature maps (11),
-the set of feature maps for frame s (I1, I3) preceding the current frame (I3), and
-the second set of ground truth feature maps (12,13) for the identified at least one labelled key frame.
10. The processor as claimed in Claim 9, wherein, the processor comprises the FPN decoder (5) configured to obtain at least one mask for at least one class of an object in the plurality of frames (I1, I2, I3… I6…I12…In) of the video.