Method and apparatus for performing open vocabulary image segmentation

The Mask-Refocused Network (MASON) addresses the inefficiencies of traditional CLIP models by employing selective fine-tuning of query projection layers, enabling efficient open-vocabulary image segmentation with reduced resource usage and adaptability to new data distributions.

WO2026036271A1PCT designated stage Publication Date: 2026-02-19ROBERT BOSCH GMBH +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/111652
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2026-02-19

AI Technical Summary

Technical Problem

Traditional panoptic segmentation models rely on fixed and predetermined classes, limiting their performance in open-vocabulary scenarios where they encounter semantic classes not included in their training data, and existing adaptations of CLIP models for image segmentation are inefficient and resource-intensive.

Method used

The proposed Mask-Refocused Network (MASON) employs a two-stage framework with a feature backbone, mask generator, masked cross-attention encoder, language encoder, and classifying module to perform open-vocabulary image segmentation, using selective fine-tuning of query projection layers to adapt to new data distributions efficiently.

Benefits of technology

MASON maintains high performance in open-vocabulary scenarios while reducing computational resources, allowing for quick updates to evolving test-time data distributions, particularly beneficial for mobile and edge devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024111652_19022026_PF_FP_ABST
    Figure CN2024111652_19022026_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure provides a computer implemented method for performing open-vocabulary image segmentation, comprising: generating a plurality of masks based on an image; determining a plurality of mask tokens for the plurality of masks; generating a plurality of image tokens based on the image; performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of attended mask tokens; generating a plurality of language tokens based on a plurality of category labels; and determining classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD AND APPARATUS FOR PERFORMING OPEN VOCABULARY IMAGE SEGMENTATIONFIELD

[0001] Aspects of the present disclosure relate generally to artificial intelligence (AI) , and more particularly, to method and apparatus for performing open-vocabulary image segmentation.BACKGROUND

[0002] Deep learning has greatly improved the performance of vision algorithms on many popular image segmentation tasks, such as semantic segmentation, instance segmentation and panoptic segmentation. Panoptic segmentation is a complex task in computer vision that combines the semantic segmentation of background elements, such as roads and sky, with the instance segmentation of foreground objects, like people and tables. Its application has profound implications for enhancing scene comprehension in domains like autonomous driving and robotics, leading to widespread research interest.

[0003] A notable limitation in traditional approaches to panoptic segmentation has been the reliance on fixed and predetermined classes, stemming from the prohibitive costs associated with annotating training datasets for additional classes. Consequently, these models exhibit limitations in practical open-vocabulary scenarios, where they encounter semantic classes not included in their training data.

[0004] Recent breakthroughs have emerged with the integration of Vision-Language models, such as Contrastive Language-Image Pre-Training (CLIP) models, known for their robust zero-shot learning capabilities. These models are revolutionizing open-vocabulary panoptic segmentation by enabling the classification of objects and stuff that are not seen during training. Since CLIP models are not initially trained on specific image regions, adaptations are necessary for effective usage in panoptic segmentation, a task which requires precise differentiation and categorization of every part of an image.

[0005] It would be desirable if the performance of the trained CLIP models can be maintained or improved while the efficiency of the adaptive training of the CLIP models can be improved.SUMMARY

[0006] In order to address the above-mentioned problem, the disclosure proposes a novel structure of CLIP models for performing open-vocabulary image segmentation and accordingly proposes a novel method for adaptively training the model for performing open-vocabulary image segmentation, which is able to implement the adaptive training with limited cross-domain training data and computational resources while achieving effective performance. This is particularly important in situations where training resources are limited, such as on mobile or edge devices. Moreover, being able to quickly train these models would allow for ongoing updates in response to changes in the real-world applications, where frequent updates are necessary to adapt to evolving test-time data distributions. The novel structural of CLIP models may be referred as a Mask-Refocused Network (MASON) for open-vocabulary panoptic segmentation, which is designed to balance training efficiency and performance when adapting to various data distributions.

[0007] According to an embodiment, there provides a computer implemented method for performing open-vocabulary image segmentation, comprising: generating a plurality of masks based on an image, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image; determining a plurality of mask tokens for the plurality of masks; generating a plurality of image tokens based on the image, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image; performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of attended mask tokens; generating a plurality of language tokens based on a plurality of category labels; and determining classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.

[0008] According to an embodiment, there provides a computer implemented method for training a neural network (NN) model for performing open-vocabulary image segmentation, comprising: generating a plurality of masks based on an image by a mask generator of the NN model, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image; determining a plurality of mask tokens for the plurality of masks; generating a plurality of image tokens based on the image by a feature backbone of the NN model, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image; performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks by a masked cross attention encoder of the NN model to obtain a plurality of attended mask tokens; generating a plurality of language tokens based on a plurality of category labels by a language encoder of the NN model; predicting classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens; determining a loss based at least in part on the predicted classifications; and updating learnable parameters of the NN model based on the loss.

[0009] According to an embodiment, there provides an apparatus for performing open-vocabulary image segmentation, comprising: a mask generator for generating a plurality of masks based on an image, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image; a mask token determining module for determining a plurality of mask tokens for the plurality of masks; a feature backbone for generating a plurality of image tokens based on the image, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image; a masked cross attention encoder for performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of attended mask tokens; a language encoder for generating a plurality of language tokens based on a plurality of category labels; and a classifying module for determining classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.

[0010] According to an embodiment, there provides a computer system, which comprises one or more processors and one or more storage devices storing computer-executable instructions that, when executed, cause the one or more processors to perform the operations of the method as mentioned above as well as to perform the operations of the method according to aspects of the disclosure.

[0011] According to an embodiment, there provides one or more computer readable  storage media storing computer-executable instructions that, when executed, cause one or more processors to perform the operations of the method as mentioned above as well as to perform the operations of the method according to aspects of the disclosure.

[0012] According to an embodiment, there provides a computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform the operations of the method as mentioned above as well as to perform the operations of the method according to aspects of the disclosure.BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The disclosed aspects will hereinafter be described in connection with the appended drawings that are provided to illustrate and not to limit the disclosed aspects.

[0014] Fig. 1 is a schematic block diagram illustrating a NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0015] Figs. 2 to 4 each is a schematic block diagram illustrating a submodule of a masked cross attention encoder 140 according to aspects of the disclosure.

[0016] Fig. 5 is a schematic block diagram illustrating a NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0017] Fig. 6 is a schematic block diagram illustrating training of the NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0018] Fig. 7 illustrates an exemplary process for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0019] Fig. 8 illustrates an exemplary process for training a NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0020] Fig. 9 illustrates an exemplary apparatus for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0021] Fig. 10 illustrates an exemplary computing system according to aspects of the disclosure.DETAILED DESCRIPTION

[0022] The present disclosure will now be discussed with reference to several example implementations. It is to be understood that these implementations are discussed only for enabling those skilled in the art to better understand and thus implement the embodiments of the present disclosure, rather than suggesting any limitations on the scope of the present disclosure.

[0023] Various embodiments will be described in detail with reference to the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts. References made to particular examples and embodiments are for illustrative purposes, and are not intended to limit the scope of the disclosure.

[0024] Vision-language pre-training has given rise to models with aligned image and text representations. When trained on billion-scale data using contrastive learning, seminal models such as CLIP and its variants exhibit impressive zero-shot classification performance. This strong capability has inspired many subsequent works to apply vision-language models for open-vocabulary detection and segmentation tasks. Following this trend, embodiments of the  disclosure employ a CLIP model to classify mask outputs from a separate mask generator to perform open-vocabulary segmentation.

[0025] Fig. 1 is a schematic block diagram illustrating a NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0026] The NN model 1 for performing open-vocabulary image segmentation may be referred to as Mask-Refocused Network (MASON) as explained in the following. As illustrated in Fig. 1, MASON 1 includes a feature backbone 110, a mask generator 120, a mask token determining module 130, a masked cross attention encoder 140, a language encoder 150 and a classifying module 160. As shown by the dashed blocks, the MASON 1 may be considered as a two-stage framework designed for the generation and classification of masks of an image. The first stage S1 may include the feature backbone 110 and the mask generator 120 and the second stage S2 is implemented as a transformer-based CLIP model, which includes the masked cross attention encoder 140, the language encoder 150 and the classifying module 160. The masked cross attention encoder 140 may also be referred to as an image encoder or a CLIP image encoder in the CLIP model structure.

[0027] The feature backbone 110 takes an image I as input and output image tokens IT of the image, wherein the image tokens IT represents the features of the image I in the latent space. A token is represented as a vector, such as a C-dimension vector, where C can be 64, 128, 256 and so on, therefore the term image token may also be referred to as image vector. For example, the image I may be of a size 896 × 896, and may be partitioned into 3136 patches with a patch size 16 × 16. It is appreciated that the image and the patch may be of other sizes. The feature backbone 110 may process the 3136 patches and output 3136 image tokens IT, each image token may be represented as a C-dimensional vector, and C =128 is taken as an example for sake of easy description. The output image tokens IT, such as the 3136 image tokens, may also be referred to as a sequence of image tokens or a sequence of image vectors. The feature backbone 110 can be any conventional pre-trained feature backbone. For example, the feature backbone 110 can be a pre-trained Swin backbone such as Swin-B, a Residual Net (ResNet) backbone such as ResNet50, which are all known feature backbones used to extracting image features in latent space. It is appreciated that the feature backbone 110 can be implemented by using any suitable NN model for extracting image features in latent space.

[0028] The mask generator 120 takes the image tokens IT, for example the 3136 C-dimensional image tokens IT, as input and generates a plurality of masks M, which correspond respectively to a plurality of segmentations of the image. Particularly, the mask generator 120 performs image segmentation for the image I and outputs masks corresponding to the segmentations of the image. The mask generator 120 may be implemented with any conventional pre-trained segmentation NN model. For example, the mask generator 120 can be a pre-trained Mask2Former model, which is a commonly used image segmentation model. It is appreciated that the mask generator 120 can be implemented by using any suitable NN model for performing image segmentation. It is appreciated that the image segmentation may be semantic segmentation, instance segmentation, panoptic segmentation, or the like.

[0029] The mask token determining module 130 determines a mask token MT for each of the plurality of masks M. The mask tokens MT for the plurality of masks M may be determined or selected from a set of predefined mask tokens. For example, if the mask  generator 120 generates m masks corresponding to m segmentations of the image, m mask tokens may be randomly selected from the set of predefined mask tokens, or may be sequentially selected from the set of predefined mask tokens. It is appreciated that the mask tokens MT for the plurality of masks M may be determined or selected from a set of predefined mask tokens. The set of predefined mask tokens may be obtained in any suitable way. For example, the set of predefined mask tokens may be randomly generated mask tokens, each mask token may be a C-dimensional vector.

[0030] The masked cross attention encoder 140 takes the mask tokens MT and the image tokens IT as input and performs masked cross-attention for the mask tokens MT based on the image tokens IT and the masks M to obtain attended mask tokens AMT. For example, the feature backbone generates n image tokens IT, the mask generator 120 generates m masks M, and the mask token determining module 130 assigns m mask tokens MT for the m masks. The masked cross attention encoder 140 performs cross-attention for each of the m mask tokens based on image tokens falling in the scope of the mask corresponding to the mask token while excluding image tokens falling outside the scope of the mask corresponding to the mask token. In this way, each mask token can only extract information from image tokens that fall within their corresponding masked region through the masked cross attention. During the fine-tuning process as explained in the following, the learnable parameters corresponding to the mask tokens are tuned so as to quickly enable the mask tokens to refocus on the related image regions of new data distribution.

[0031] Fig. 2 is a schematic block diagram illustrating a submodule of a masked cross attention encoder 140 according to aspects of the disclosure.

[0032] As illustrated in Fig. 2, the masked cross attention encoder 140 comprises L attention submodules, where the illustrated attention submodule 140-l denotes the l-th one of the L attention submodules. The attention submodule 140-l takes the mask tokens MTl-1 and the image tokens IT as input, where the mask tokens MTl-1 is the mask tokens MT provided by the mask token determining module 130 when the attention submodule 140-l is the first one of the L attention submodules, that is, when l = 1. The mask tokens MTl-1 is the attended mask tokens outputted by the previous (l-1) -th attention submodule when the attention submodule 140-l is a subsequent one of the L attention submodules, that is, when l = 2 to L.

[0033] The m mask tokens may be referred to as a sequence of mask tokens, the n image tokens may be referred to as a sequence of image tokens. After layer normalization process to the sequence of mask tokens and the sequence of image tokens at the normalization block N, the mask tokens MTl-1 is processed with a query projection function fq to obtain a query sequence qmask = fq (xmask) , the image tokens IT is processed with a key projection function fk and a value projection function fv respectively to obtain a key sequence kimg = fk (ximg) and a value sequence vimg = fv (ximg) . The query projection function fq, key projection function fk and value projection function fv may be implemented in any suitable way, for example, may be implemented as a C×C dimensional query matrix, a C×C dimensional key matrix and a C×C dimensional value matrix, which are learnable parameters. Each of the query projection function fq, key projection function fk and value projection function fv may be implemented as a full connection NN layer.

[0034] The masked cross attention block MCA performs masked cross attention for the  mask tokens xmask and the image tokens ximg based on the query sequence fq (xmask) , the key sequence fk (xmask) and the value sequence fv (xmask) and the masks M, as illustrated in equations (1) to (2) :

[0035] where is obtained by

[0036] Where is a mask coverage matrix, the rows and columns of which correspond respectively to the masks M and the images patches corresponding to the image tokens IT.

[0037] As defined in equation (2) , the mask coverage matrix indicates the image patches covered by a mask and the image patches uncovered by a mask. When a maski covers a patchj, matrix element is given a value 0, and accordingly the mask token xmask (i) is normally attended by the image token ximg (j) , and when a maski does not cover a patchj, matrix element is give a value -∞, and accordingly the mask token xmask (i) is not attended by the image token ximg (j) because the corresponding element Softmax (-∞) would be zero. Therefore, the masked cross attention block MCA performs cross-attention for each of the plurality of mask tokens based on image tokens falling in the scope of the mask corresponding to the mask token while excluding the image tokens falling outside the scope of the mask corresponding to the mask token, so as to allow each mask token only extract information from image tokens falling within the corresponding masked region and thus focuses on its segmentation area.

[0038] The attended sequence MaskedCrossAttn (xmask, ximg) is then sequentially processed at the addition block A, where the attended sequence is added with the mask token MTl-1, at the normalization block N, where layer normalization is performed, at the Multilayer Perceptron block MLP, and at the addition block A, where the output of the MLP is added with the output of the previous addition block, so as to obtain the output attended mask sequence MTl. It is appreciated that the layer normalization blocks N, the addition blocks A and the MLP block are all commonly used processing blocks, and embodiments of the disclosure are not limited to the specific configuration of these blocks as illustrated in Fig. 2, there may be more or less processing blocks in the attention submodule 140-l, and there may be more or less types of processing blocks in the attention submodule 140-l.

[0039] The L attention submodules 140-1 to 140-L iteratively performs masked cross-attention for the mask tokens MT so as to output the attended mask tokens ATM.

[0040] Go back to Fig. 1, the language encoder 150 takes language contents L as input and output language tokens LT of the language contents, wherein the language tokens LT represents the features of the language contents L in the latent space. The language token may be a C-dimension vector. The language contents L may be a predefined set of category labels or names, the language encoder 150 encodes the category labels into respective language tokens, for example, the language encoder 150 sequentially encodes the category labels into respective language tokens. For example, the predefined set of category labels may be “sky” , “grass” , “car” , and so on. The language encoder 150 can be any conventional pre-trained  language encoder. It is appreciated that the language encoder 150 can be implemented by using any suitable NN model for encoding language into embedding vectors in latent space.

[0041] The classifying module 160 determines classifications for the masks based on the language tokens LT and the attended mask tokens AMT. In an embodiment, for each mask token, the classifying module assesses the similarities between the mask token and all the language tokens, and designate the label with the closest language token to the mask token as the predicted category for the mask corresponding to the mask token. For example, the classifying module 160 may computing the cosine similarity between the mask token and each language tokens. After obtaining the classification prediction of the segmentations indicated by the masks, the open vocabulary segmentation for the image is completed, where masks and corresponding classification labels are obtained for the image.

[0042] Fig. 3 is a schematic block diagram illustrating a submodule of a masked cross attention encoder 140 according to aspects of the disclosure.

[0043] The masked cross attention encoder 140 comprises L attention submodules, where the illustrated attention submodule 140A-l denotes the l-th one of the L attention submodules. The attention submodule 140A-l takes the mask tokens MTl-1 and the image tokens ITl-1 as input, where the mask tokens MTl-1 and the image tokens ITl-1 are the mask tokens MT provided by the mask token determining module 130 and the image tokens IT provided by the feature backbone 110 when the attention submodule 140A-l is the first one of the L attention submodules. The mask tokens MTl-1 and the image tokens ITl-1 are the attended mask tokens and the attended image tokens outputted by the previous (l-1) -th attention submodule when the attention submodule 140A-l is a subsequent one of the L attention submodules.

[0044] The left branch of the attention submodule 140A-l shown in the left dash block has same structure as the attention submodule 140-l as illustrated in Fig. 2 and performs masked cross attention to the mask tokens MTl-1 and the image tokens ITl-1 in a same way as the attention submodule 140-l as illustrated in Fig. 2. Therefore details of the left branch of the attention submodule 140A-l are not repetitively described.

[0045] The right branch of the attention submodule 140A-l shown in the right dash block performs self-attention to the image tokens ITl-1 at the self-attention block SA. The self-attention operation may be as the equation (3) and (4) qimg=fq (ximg) , kimg=fk (ximg) , vimg=fv (ximg)        (4)

[0046] Other blocks in the right branch are similar as those of the attention submodule 140-l as illustrated in Fig. 2 and thus are not repetitively described.

[0047] Fig. 4 is a schematic block diagram illustrating a submodule of a masked cross attention encoder 140 according to aspects of the disclosure.

[0048] The masked cross attention encoder 140 comprises L attention submodules, where the illustrated attention submodule 140B-l denotes the l-th one of the L attention submodules. The attention submodule 140B-l takes the mask tokens MTl-1 and the image tokens ITl-1 as input, where the mask tokens MTl-1 and the image tokens ITl-1 are the mask tokens MT provided by the mask token determining module 130 and the image tokens IT provided by the feature backbone 110 when the attention submodule 140B-l is the first one of  the L attention submodules. The mask tokens MTl-1 and the image tokens ITl-1 are the attended mask tokens and the attended image tokens outputted by the previous (l-1) -th attention submodule when the attention submodule 140B-l is a subsequent one of the L attention submodules.

[0049] The left branch of the attention submodule 140B-l shown in the left dash block has same structure as the attention submodule 140-l as illustrated in Fig. 2 and performs masked cross attention to the mask tokens MTl-1 and the image tokens ITl-1 in a same way as the attention submodule 140-l as illustrated in Fig. 2. Therefore details of the left branch of the attention submodule 140B-l are not repetitively described.

[0050] The right branch of the attention submodule 140B-l shown in the right dash block performs masked cross attention to the image tokens ITl-1 and the mask tokens MTl-1 at the masked cross attention block MCA. The self-attention operation may be performed as the equation (5) to (7) qimg=fq (ximg) , kmask=fk (xmask) , vmask=fv (xmask)       (6)

[0051] where is obtained by

[0052] Where is a mask coverage matrix, the rows and columns of which correspond respectively to the image patches corresponding to the image tokens IT and the masks M.

[0053] Other blocks in the right branch are similar as those of the attention submodule 140-l as illustrated in Fig. 2 and thus are not repetitively described.

[0054] Figs. 2 to 4 provide different exemplary embodiments for implementing the masked cross attention encoder 140, it is appreciated that the detailed implementations of the masked cross attention encoder 140 are not limited to the illustrated embodiments, for example, the specific blocks in the attention submodules 140-l may be not in the specific order as illustrated in Figs. 2 to 4, there may be other blocks or submodules in the masked cross attention encoder 140.

[0055] Fig. 5 is a schematic block diagram illustrating a NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0056] The NN model 1 illustrated in Fig. 5 differs from that in Fig. 1 in that the mask generator 120 receives the image I directly rather than receiving the image token IT outputted by the feature backbone 110, and generates the masks M based on the image I. Other parts of the NN model 1 illustrated in Fig. 5 are same as that in Fig. 1, and thus are not repetitively described.

[0057] Figs. 1 and 5 provide different exemplary embodiments for implementing the NN model 1 for performing open-vocabulary image segmentation, it is appreciated that the detailed implementations of the NN model 1 are not limited to the illustrated embodiments, for example, the specific modules in NN model 1 may be not in the specific order as illustrated in Figs. 1 and 5, there may be other modules in the NN model 1.

[0058] Fig. 6 is a schematic block diagram illustrating training of the NN model for  performing open-vocabulary image segmentation according to aspects of the disclosure.

[0059] The NN model 1 illustrated in Fig. 1 and the masked cross attention encoder 140 illustrated in Fig. 2 are taken as example in Fig. 6 to illustrate the training of the NN model for performing open-vocabulary image segmentation. To improve performance of the NN model 1 for performing open-vocabulary image segmentation for new data distributions, embodiments of the disclosure propose to selectively fine-tune some of CLIP model’s internal parameters so as to allow CLIP model’s adaptation to new data distributions. As illustrated in Fig. 1 or 6, the stage S2 may be considered as CLIP model or CLIP part.

[0060] Specifically, embodiments of the disclosure propose a simple yet effective technique called Mask-Refocused Tuning. As illustrated in Fig. 6, embodiments of the disclosure fine-tune the masked cross attention encoder 140 while freezing the other parts, such as the feature backbone 110, the mask generator 120 and the language encoder 150, where the “fire” symbol denotes trainable part and the “snow” symbol denotes the frozen part. In the embodiment of Fig. 6, only the query projection layers fq within the CLIP model are fine-tuned based on training data that may be corresponding to a new data distribution. By altering the interaction between MASON’s mask tokens and CLIP’s image tokens, this approach can help mask tokens to better focus on relevant image regions. The Mask-Refocused Tuning enhances concentration of mask tokens on pertinent areas following the fine-tuning process. A significant advantage of Mask-Refocused Tuning is its ability to maintain the integrity of CLIP’s pre-trained knowledge base. By selectively fine-tuning only specific components, embodiments of the disclosure avoid the pitfalls of catastrophic forgetting, ensuring that CLIP’s open-vocabulary capabilities remain intact, thus allowing the model to achieve superior performance.

[0061] In an embodiment, the loss function may be a weighted combination of the following 3 different losses:

[0062] where is the cross-entropy loss for classification, and and are the Dice loss and binary cross entropy loss for mask generation. As the loss and are all known losses and are not introduced in further details. λCE, λDice and λBCE are predefined coefficients. In an implementation, the known AdamW optimizer may be used to update the MASON model 1 based on the loss

[0063] The learnable parameters of the NN model 1 may be updated based on the loss In the embodiment of Fig. 6, only the learnable parameters of the query projection layers fq of the masked cross attention encoder 140, which is also referred to as CLIP image encoder, are updated based on the loss while the other parts of the NN model 1 are frozen. As described above, the query projection layer fq may be implemented as a C×C dimensional query matrix, a full connection NN layer, or the like. Since only the query projection layers in each attention submodule are fine-tuned in the training process, most of CLIP’s internal pre-trained knowledge remains largely intact, and accordingly the performance for the fine-tuned open vocabulary segmentation model is achieved while the training efficiency is improved.

[0064] As illustrated in the embodiment of Fig. 3, the masked cross attention branch corresponding to the mask tokens and the self-attention branch corresponding to the image  tokens both include the query projection layers fq. In an embodiment, during the training or fine-tune process, only the query projection layers fq corresponding to the mask tokens are fine-tuned while other parts of the open vocabulary segmentation model 1 are frozen. In an embodiment, during the training or fine-tune process, only the query projection layers fq in the image encoder 140, that is, in both branches of image encoder 140, are fine-tuned while other parts of the open vocabulary segmentation model 1 are frozen.

[0065] As illustrated in the embodiment of Fig. 4, the masked cross attention branch corresponding to the mask tokens and the masked cross attention branch corresponding to the image tokens both include the query projection layers fq. In an embodiment, during the training or fine-tune process, only the query projection layers fq corresponding to the mask tokens are fine-tuned while other parts of the open vocabulary segmentation model 1 are frozen. In an embodiment, during the training or fine-tune process, only the query projection layers fq in the image encoder 140, that is, in both branches of image encoder 140, are fine-tuned while other parts of the open vocabulary segmentation model 1 are frozen.

[0066] It is appreciated that fine-tuning of some other selected parameters in the image encoder 140 may be possible in other embodiments, for example, the query projection layers fq and the key projection layer fk may be fine-tuned.

[0067] In an embodiment, Top-K Tuning may be employed to further enhance efficiency with minimal loss in performance by restricting the adaptation only to the few K top projection layers of the L projection layers in the L attention submodules. Although the Mask-Refocused Tuning is already highly memory-efficient, the Top-K Tuning in this embodiment enables to further decrease the number of trainable parameters without sacrificing much performance, so as to further reduce the memory required for fine-tuning. In an embodiment, only the top K query projection layers are selectively fine-tuned. The value of K can be adjusted based on the specific memory requirements of different devices. This is particularly important in situations where training resources are limited, such as on mobile device or edge devices. For example, for a mobile device or edge device, the circumstances around the device may be changed from time to time, and the reduced memory requirement and increased training speed would allow for such a device to perform ongoing updates in response to changes in the real world applications. The top K Tuning is grounded in the understanding that the lower layers of a neural network typically encode more generic features, whereas the upper layers are more specialized and task-specific. Therefore, it is sufficient to fine-tune only the top few layers for a memory-efficient adaptation of the NN model to new open-vocabulary segmentation tasks.

[0068] Fig. 7 illustrates an exemplary process for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0069] At step 710, a plurality of masks are generated based on an image, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image.

[0070] At step 720, a plurality of mask tokens are determined for the plurality of masks.

[0071] At step 730, a plurality of image tokens are generated based on the image, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image, wherein the image is divided into the plurality of patches.

[0072] At step 740, masked cross-attention is performed for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of  attended mask tokens.

[0073] At step 750, a plurality of language tokens are generated based on a plurality of language category labels or names.

[0074] At step 760, classifications are determined for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.

[0075] According to an embodiment, at step 720, the plurality of mask tokens for the plurality of masks are selected from a set of predefined mask tokens. According to an embodiment, the set of predefined mask tokens are randomly generated mask tokens.

[0076] According to an embodiment, at step 740, cross-attention is performed for each of the plurality of mask tokens based on image tokens of the plurality of image tokens falling in the scope of the mask corresponding to the mask token while excluding image tokens falling outside the scope of the mask corresponding to the mask token. According to an embodiment, if an image patch corresponding to an image token has at least one pixel falling in the scope of the mask, the image token is falling in the scope of the mask, otherwise if the image patch has no pixel falling in the scope of the mask, the corresponding image token is falling outside the scope of the mask.

[0077] According to an embodiment, at step 740, masked cross-attention is performed for the plurality of mask tokens iteratively in a plurality of attention submodules, wherein output of a former attention submodule is taken as input of a subsequent attention submodule.

[0078] According to an embodiment, at step 740, in a first one of the plurality of attention submodules, a query sequence is generated by a query projection layer based on the plurality of mask tokens, a key sequence is generated by a key projection layer based on the plurality of image tokens, a value sequence is generated by a value projection layer based on the plurality of image tokens, and the masked cross-attention is performed for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks to obtain a plurality of intermediately attended mask tokens; in each subsequent one of the plurality of attention submodules, a query sequence is generated by a query projection layer based on a plurality of intermediately attended mask tokens obtained from its previous attention submodule, a key sequence is generated by a key projection layer based on a plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, a value sequence is generated by a value projection layer based on the plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, the masked cross-attention is performed for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks, wherein the last one of the plurality of attention submodules outputs the plurality of attended mask tokens.

[0079] According to an embodiment, at step 740, in each of the plurality of attention submodules, the masked cross-attention is performed for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and a mask coverage matrix, wherein the mask coverage matrix is obtained based on the plurality of masks and the plurality of patches corresponding to the plurality of image tokens.

[0080] Fig. 8 illustrates an exemplary process for training a NN model for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0081] At step 810, a plurality of masks are generated based on an image by a mask  generator of the NN model, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image.

[0082] At step 820, a plurality of mask tokens are assigned for the plurality of masks.

[0083] At step 830, a plurality of image tokens are generated based on the image by a feature backbone of the NN model, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image.

[0084] At step 840, masked cross-attention are performed for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks by a masked cross attention encoder of the NN model to obtain a plurality of attended mask tokens.

[0085] At step 850, a plurality of language tokens are generated based on a plurality of category labels by a language encoder of the NN model.

[0086] At step 860, classifications are predicted for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.

[0087] At step 870, a loss is determined based at least in part on the predicted classifications.

[0088] At step 880, learnable parameters of the NN model are updated based on the loss.

[0089] According to an embodiment, at step 880, a part of learnable parameters of the masked cross attention encoder are updated based on the loss while the other learnable parameters of the NN model being frozen.

[0090] According to an embodiment, the masked cross attention encoder comprises a plurality of query projection layers corresponding to the plurality of mask tokens, wherein at step 880, learnable parameters of at least a part of the query projection layers are updated based on the loss while the other learnable parameters of the NN model being frozen. According to an embodiment, the masked cross attention encoder comprises a plurality of attention submodules, each of which comprises a query projection layer corresponding to the plurality of mask tokens, wherein at step 880, learnable parameters of the query projection layers in at least a part of the plurality of attention submodules are updated based on the loss while the other learnable parameters of the NN model being frozen.

[0091] According to an embodiment, at step 880, learnable parameters of a part of the query projection layers are updated based on the loss while the other learnable parameters of the NN model being frozen, wherein the number of the part of query projection layers is determined based on a memory requirement of a device on which the method is performed.

[0092] According to an embodiment, at step 820, the plurality of mask tokens for the plurality of masks are selected from a set of predefined mask tokens. According to an embodiment, the set of predefined mask tokens are randomly generated mask tokens.

[0093] According to an embodiment, at step 840, cross-attention is performed for each of the plurality of mask tokens based on image tokens of the plurality of image tokens falling in the scope of the mask corresponding to the mask token.

[0094] According to an embodiment, the masked cross attention encoder comprises a plurality of attention submodules which are connected consecutively, and at step 840, masked cross-attention for the plurality of mask tokens is performed iteratively in the plurality of attention submodules.

[0095] According to an embodiment, at step 840, in a first one of the plurality of attention submodules, a query sequence is generated by a query projection layer based on the  plurality of mask tokens, a key sequence is generated by a key projection layer based on the plurality of image tokens, a value sequence is generated by a value projection layer based on the plurality of image tokens, the masked cross-attention for the plurality of mask tokens is performed based on the query sequence, the key sequence, the value sequence and the plurality of masks to obtain a plurality of intermediately attended mask tokens; in each subsequent one of the plurality of attention submodules, a query sequence is generated by a query projection layer based on a plurality of intermediately attended mask tokens obtained from its previous attention submodule, a key sequence is generated by a key projection layer based on a plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, a value sequence is generated by a value projection layer based on the plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, and the masked cross-attention for the plurality of mask tokens is performed based on the query sequence, the key sequence, the value sequence and the plurality of masks, wherein the last one of the plurality of attention submodules outputs the plurality of attended mask tokens.

[0096] According to an embodiment, at step 840, in each of the plurality of attention submodules, the masked cross-attention for the plurality of mask tokens is performed based on the query sequence, the key sequence, the value sequence and a mask coverage matrix, wherein the mask coverage matrix is obtained based on the plurality of masks and the plurality of patches corresponding to the plurality of image tokens.

[0097] Fig. 9 illustrates an exemplary apparatus for performing open-vocabulary image segmentation according to aspects of the disclosure.

[0098] The apparatus 900 comprises: a mask generator 910 for generating a plurality of masks based on an image, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image; a mask token determining module 920 for determining a plurality of mask tokens for the plurality of masks; a feature backbone 930 for generating a plurality of image tokens based on the image, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image; a masked cross attention encoder 940 for performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of attended mask tokens; a language encoder 950 for generating a plurality of language tokens based on a plurality of category labels; and a classifying module 960 for determining classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.

[0099] According to an embodiment, the mask token determining module 920 is for determining the plurality of mask tokens for the plurality of masks from a set of predefined mask tokens. According to an embodiment, the set of predefined mask tokens are randomly generated mask tokens.

[0100] According to an embodiment, the masked cross attention encoder 940 is for performing cross-attention for each of the plurality of mask tokens based on image tokens of the plurality of image tokens falling in the scope of the mask corresponding to the mask token.

[0101] According to an embodiment, the masked cross attention encoder 940 comprises a plurality of attention submodules which are connected consecutively, and the masked cross  attention encoder 940 is for performing masked cross-attention for the plurality of mask tokens iteratively in the plurality of attention submodules, wherein output of a former attention submodule is taken as input of a subsequent attention submodule.

[0102] According to an embodiment, the masked cross attention encoder 940 is for: in a first one of the plurality of attention submodules, generating a query sequence by a query projection layer based on the plurality of mask tokens, generating a key sequence by a key projection layer based on the plurality of image tokens, generating a value sequence by a value projection layer based on the plurality of image tokens, and performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks to obtain a plurality of intermediately attended mask tokens; in each subsequent one of the plurality of attention submodules, generating a query sequence by a query projection layer based on a plurality of intermediately attended mask tokens obtained from its previous attention submodule, generating a key sequence by a key projection layer based on a plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, generating a value sequence by a value projection layer based on the plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks, wherein the last one of the plurality of attention submodules outputs the plurality of attended mask tokens.

[0103] According to an embodiment, the masked cross attention encoder 940 is for performing the masked cross-attention for the plurality of mask tokens in each of the plurality of attention submodules based on the query sequence, the key sequence, the value sequence and a mask coverage matrix, wherein the mask coverage matrix is generated based on the plurality of masks and the plurality of patches corresponding to the plurality of image tokens.

[0104] Fig. 10 illustrates an exemplary computing system according to aspects of the disclosure. The computing system 1000 may comprise at least one processor 1010. The computing system 1000 may further comprise at least one storage device 1020. The storage device 1020 may store computer-executable instructions that, when executed, cause the processor 1010 to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-9.

[0105] The embodiments of the present disclosure may be embodied in a computer-readable medium such as non-transitory computer-readable medium. The non-transitory computer-readable medium may comprise instructions that, when executed, cause one or more processors to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-9.

[0106] The embodiments of the present disclosure may be embodied in a computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-9.

[0107] It should be appreciated that all the operations in the methods described above are merely exemplary, and the present disclosure is not limited to any operations in the methods or sequence orders of these operations, and should cover all other equivalents under the same or similar concepts.

[0108] It should also be appreciated that all the modules in the apparatuses described above may be implemented in various approaches. These modules may be implemented as hardware, software, or a combination thereof. Moreover, any of these modules may be further functionally divided into sub-modules or combined together.

[0109] The previous description is provided to enable any person skilled in the art to practice the various aspects described herein. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. Thus, the claims are not intended to be limited to the aspects shown herein. All structural and functional equivalents to the elements of the various aspects described throughout the present disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims.

Claims

1.A computer implemented method for performing open-vocabulary image segmentation, comprising:generating a plurality of masks based on an image, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image;determining a plurality of mask tokens for the plurality of masks;generating a plurality of image tokens based on the image, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image;performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of attended mask tokens;generating a plurality of language tokens based on a plurality of category labels; anddetermining classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.2.The method of claim 1, wherein the determining a plurality of mask tokens for the plurality of masks comprises: selecting the plurality of mask tokens for the plurality of masks from a set of predefined mask tokens.3.The method of claim 2, wherein the set of predefined mask tokens are randomly generated mask tokens.4.The method of claim 1, wherein the performing masked cross-attention for the plurality of mask tokens comprises: performing cross-attention for each of the plurality of mask tokens based on image tokens of the plurality of image tokens falling in the scope of the mask corresponding to the mask token.5.The method of claim 4, wherein the performing masked cross-attention for the plurality of mask tokens comprises:performing masked cross-attention for the plurality of mask tokens iteratively in a plurality of attention submodules.6.The method of claim 5, wherein the performing masked cross-attention for the plurality of mask tokens comprises:in a first one of the plurality of attention submodules, generating a query sequence by a query projection layer based on the plurality of mask tokens, generating a key sequence by a key projection layer based on the plurality of image tokens, generating a value sequence by a value projection layer based on the plurality of image tokens, performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks to obtain a plurality of intermediately attended mask tokens;in each subsequent one of the plurality of attention submodules, generating a query sequence by a query projection layer based on a plurality of intermediately attended mask tokens obtained from its previous attention submodule, generating a key sequence by a key projection layer based on a plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, generating a value sequence by a value projection layer based on the plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks, wherein the last one of the plurality of attention submodules outputs the plurality of attended mask tokens.7.The method of claim 6, wherein the performing the masked cross-attention for the plurality of mask tokens in each of the plurality of attention submodules comprises: performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and a mask coverage matrix, wherein the mask coverage matrix is obtained based on the plurality of masks and the plurality of patches corresponding to the plurality of image tokens.8.A computer implemented method for training a neural network (NN) model for performing open-vocabulary image segmentation, comprising:generating a plurality of masks based on an image by a mask generator of the NN model, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image;determining a plurality of mask tokens for the plurality of masks;generating a plurality of image tokens based on the image by a feature backbone of the NN model, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image;performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks by a masked cross attention encoder of the NN model to obtain a plurality of attended mask tokens;generating a plurality of language tokens based on a plurality of category labels by a language encoder of the NN model;predicting classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens;determining a loss based at least in part on the predicted classifications; andupdating learnable parameters of the NN model based on the loss.9.The method of claim 8, wherein the updating learnable parameters of the NN model based on the loss comprises: updating a part of learnable parameters of the masked cross attention encoder based on the loss while freezing the other learnable parameters of the NN model.10.The method of claim 9, wherein the masked cross attention encoder comprises a plurality of query projection layers corresponding to the plurality of mask tokens, wherein the updating learnable parameters of the NN model based on the loss comprises: updating learnable parameters of at least a part of the query projection layers based on the loss while freezing the other learnable parameters of the NN model.11.The method of claim 10, wherein the updating learnable parameters of the NN model based on the loss comprises:updating learnable parameters of a part of the query projection layers based on the loss while freezing the other learnable parameters of the NN model, wherein the number of the part of query projection layers is determined based on a memory requirement of a device on which the method is performed; orupdating learnable parameters of top K query projection layers of the query projection layers based on the loss while freezing the other learnable parameters of the NN model, wherein the number K is determined based on a memory requirement of a device on which the method is performed.12.The method of one of claims 8 to 11, wherein the determining a plurality of mask tokens for the plurality of masks comprises: selecting the plurality of mask tokens for the plurality of masks from a set of predefined mask tokens.13.The method of claim 12, wherein the set of predefined mask tokens are randomly generated mask tokens.14.The method of one of claims 8 to 11, wherein the performing masked cross-attention for the plurality of mask tokens comprises: performing cross-attention for each of the plurality of mask tokens based on image tokens of the plurality of image tokens falling in the scope of the mask corresponding to the mask token.15.The method of claim 14, wherein the masked cross attention encoder comprises a plurality of attention submodules which are connected consecutively, and the performing masked cross-attention for the plurality of mask tokens comprises:performing masked cross-attention for the plurality of mask tokens iteratively in the plurality of attention submodules.16.The method of claim 15, wherein the performing masked cross-attention for the plurality of mask tokens comprises:in a first one of the plurality of attention submodules, generating a query sequence by a query projection layer based on the plurality of mask tokens, generating a key sequence by a key projection layer based on the plurality of image tokens, generating a value sequence by a value projection layer based on the plurality of image tokens, performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks to obtain a plurality of intermediately attended mask tokens;in each subsequent one of the plurality of attention submodules, generating a query sequence by a query projection layer based on a plurality of intermediately attended mask tokens obtained from its previous attention submodule, generating a key sequence by a key projection layer based on a plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, generating a value sequence by a value projection layer based on the plurality of intermediate image tokens obtained from its previous attention submodule or based on the plurality of image tokens, performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and the plurality of masks, wherein the last one of the plurality of attention submodules outputs the plurality of attended mask tokens.17.The method of claim 16, wherein the performing the masked cross-attention for the plurality of mask tokens in each of the plurality of attention submodules comprises: performing the masked cross-attention for the plurality of mask tokens based on the query sequence, the key sequence, the value sequence and a mask coverage matrix, wherein the mask coverage matrix is obtained based on the plurality of masks and the plurality of patches corresponding to the plurality of image tokens.18.An apparatus for performing open-vocabulary image segmentation, comprising:a mask generator for generating a plurality of masks based on an image, wherein the plurality of masks corresponding respectively to a plurality of segmentations of the image;a mask token determining module for determining a plurality of mask tokens for the plurality of masks;a feature backbone for generating a plurality of image tokens based on the image, wherein the plurality of image tokens corresponding respectively to a plurality of patches of the image;a masked cross attention encoder for performing masked cross-attention for the plurality of mask tokens based on the plurality of image tokens and the plurality of masks to obtain a plurality of attended mask tokens;a language encoder for generating a plurality of language tokens based on a plurality of category labels; anda classifying module for determining classifications for the plurality of masks based on the plurality of language tokens and the plurality of attended mask tokens.19.A computer system, comprising:one or more processors; andone or more storage devices storing computer-executable instructions that, when executed, cause the one or more processors to perform the operations of the method of one of claims 1-17.20.One or more computer readable storage media storing computer-executable instructions that, when executed, cause one or more processors to perform the operations of the method of one of claims 1-17.

Citation Information

Patent Citations

  • Weak supervision semantic segmentation method and device based on attention mask

    CN116935055A

  • Image segmentation method and device based on open vocabulary segmentation

    CN118351299A

  • Systems and methods for open vocabulary instance segmentation in unannotated images

    US20240070868A1

  • Diffusion-based open-vocabulary segmentation

    US20240153093A1

  • Class agnostic object mask generation

    US20240169545A1