Segmentation recognition and text description method and system based on suggestible segmentation model
By simulating the CLIP visual encoder and generating semantic tags in the SAM architecture, the problem of fixed data scale and category in region-text alignment is solved, the functions of segmentation, recognition and text description are realized, and a universal position-aware image is provided. Markup tools that enhance visual understanding at the regional level.
Patent Information
- Application Number
- CN202311676811.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-12-07
AI Technical Summary
Existing technologies have problems with limited data scale and fixed categories in region-text alignment. Traditional visual-language alignment methods are difficult to achieve fine-grained regional understanding, and integration methods require aligned visual-language training data, which cannot be implemented under a unified architecture. Multi-task prediction.
Adopt a promptable segmentation model based on the SAM architecture to simulate the CLIP visual encoder, generate semantic tags through the mask decoder, predict visual embeddings, and use these embeddings to perform distribution alignment of concept vocabularies, combining large-scale segmentation masks and CLIP Semantic prior knowledge is used to construct a universal regional representation to achieve the functions of segmentation, recognition and text description.
It enables segmentation, recognition and description on large-scale segmentation mask data, avoids specific annotation bias, reduces functional costs, provides a universal position-aware image labeling tool, and enhances regional-level visual understanding.
Smart Images

Figure CN117671688B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence autonomously generated content (AIGC) technology related to images and texts, and in particular to a segmentation recognition and text description method and system based on a suggestible segmentation model. Background Art
[0002] Recent works have focused on building a unified framework to achieve region-level visual-language alignment via a large number of region-text pairs or multimodal datasets, achieving remarkable performance on both open semantic and interactive segmentation benchmarks.
[0003] However, compared to large-scale segmented image datasets such as SA-1B, the currently available region-text data is significantly limited in scale. There are significant challenges in providing detailed semantic annotations for each instance, especially when an object can be attributed to multiple categories; traditional vision-language alignment methods rely on image-text pairs, which limits their fine-grained region understanding capabilities. Existing datasets such as LVIS tend to assign a single semantic label to each object. Therefore, supervised learning on these manually annotated datasets may limit the model's zero-shot transfer capabilities due to their limited scale, fixed categories, and occasionally ambiguous text annotations.
[0004] SAM is an advanced cueable segmentation model for region-level visual representation based on visual cues, but lacks semantic labels in its output.
[0005] The architecture of SAM, which extracts semantic knowledge from pre-trained large visual-language models (such as CLIP), provides a feasible path to achieve zero-shot regional visual understanding. Recent works (e.g., {SAM-CLIP, SAMSpot}) aim to combine the exhaustive segmentation capabilities of SAM with the open vocabulary classification capabilities of CLIP. However, such integration methods usually require aligned visual-language training data and cannot adopt unified cues under a unified architecture. For example, SAM-CLIP retrains a visual encoder using part of the data of the original SAM and CLIP. Although it retains the original advantages of CLIP and SAM, it cannot achieve the prediction of multiple tasks with one cue (such as point, box) at the same time. On the other hand, RegionSpot trains an adapter on an object detection dataset to achieve unified cues, allowing SAM's mask markers to interact with CLIP features of the image at the mask. Despite this, RegionSpot still needs to implement two separate models to achieve multi-task prediction.
[0006] Therefore, it is necessary to establish a universal unified promptable segmentation model that can simultaneously complete the functions of segmentation, recognition and text description, simplify the task volume and reduce functional costs. Summary of the invention
[0007] In order to solve the problems existing in the prior art, the present invention provides the following technical solutions, a segmentation recognition and text description method and system based on a promptable segmentation model, in the promptable segmentation task under the SAM architecture, the visual encoder (image encoder) of CLIP is simulated, wherein the mask decoder (mask decoder) can generate a semantic tag (semantic token) for each predicted mask; then, the visual embedding is predicted from the semantic tag, and these visual embeddings are used to perform distribution alignment of the concept vocabulary between SAM and CLIP. Unlike the general segmentation model SAM, SAM only performs positioning segmentation under given visual cues. The goal of the present invention is to construct a general region representation to achieve general recognition and positioning through visual cues. In order to achieve powerful region representation in practical applications, the model pre-training uses a large number of segmentation masks (such as SA-1B masks) and the semantic prior knowledge of the large CLIP model with 5 billion parameters. On the one hand, we propose a cueable model that can simultaneously segment, recognize, and describe any object, relying entirely on visual cues. On the other hand, we use concept distillation to effectively leverage CLIP for pre-training the proposed unified model. Third, we propose a cueable image tokenization paradigm that implements a general, location-aware image labeling tool to facilitate region-level visual understanding.
[0008] The present invention provides a segmentation recognition and text description method based on a suggestible segmentation model, comprising:
[0009] S1, obtain image target;
[0010] S2, establishing a promptable segmentation model ProTo, the promptable segmentation model ProTo is used to integrate the language ability of CLIP in the promptable segmentation task under the SMA architecture to simultaneously segment and identify the target and describe the text, the promptable segmentation model includes an image encoder, a prompt encoder and an image decoder; the image encoder and the image decoder provide regional semantic information based on visual prompts by simulating CLIP; the image decoder is used to provide regional visual representation based on visual prompts;
[0011] S3, performing segmentation recognition and text description on the image target based on the suggestable segmentation model to obtain suggestable segmentation, concept prediction and suggestable text description.
[0012] Preferably, S2 includes:
[0013] S21, obtaining an image segmentation dataset and a predicted segmentation mask for pre-training of the promptable segmentation model;
[0014] S22, upgrading the mask decoder in the SAM architecture to a general image decoder to obtain the primary architecture of the model, adding a semantic tag to the mask tag of each predicted segmentation mask; the semantic tag is used to learn semantic prior knowledge from a predefined concept space, and the semantic prior knowledge comes from the CLIP large model with 5 billion parameters;
[0015] S23, pre-training the model primary architecture on the image segmentation dataset, and constructing an integrated simulated CLIP visual encoder and a universal image decoder in the model primary architecture based on the model pre-training;
[0016] S24, based on the two subtasks of suggestible segmentation and lexical concept prediction, the mask-based segmentation loss and the semantic-based concept distillation loss are jointly optimized to obtain a pre-trained suggestible segmentation model with region recognition and localization capabilities;
[0017] S25, fine-tune the pre-trained hintable segmentation model on the region-level text description task.
[0018] Preferably, the simulated CLIP visual encoder and the general image decoder are an integrated structure; the image segmentation dataset comes from SA-1B; the prompt encoder obtains input from points, boxes and sketches of the SA-1B data source; two subtasks include predicting the mask through mask embedding, mask marking of the predicted segmentation mask and calculating scores after passing through the image decoder, and obtaining a promptable segmentation; predicting region concepts through text description, visual embedding and text embedding of the CLIP text encoder; the simulated CLIP visual encoder is used to preprocess the image segmentation data of SA-1B; the image decoder generates a total of 9 tags, including 4 semantic tags, 4 mask tags and 1 IoU tag.
[0019] Preferably, a two-stage sampling strategy is used for the pre-training, using a maximum of 9 prompt points; in the first stage, boxes or points are sampled with equal probability from the true mask corresponding to the image segmentation data; in the second stage, 1 to 8 points are uniformly sampled from the error area between the predicted mask and the true mask corresponding to the image segmentation data.
[0020] Preferably, the obtaining of the suggestable segmentation in S3 includes using a sketch or a mask as a first prompt, and the obtaining of the suggestable segmentation includes: sampling from the image segmentation data using a non-interactive sampling method with a probability of 50%; the non-interactive sampling method with a probability of 50% includes:
[0021] During sampling, 1 to 9 points are uniformly obtained from the true mask;
[0022] During inference, nine points are selected from the linear space of planarized 2D coordinates of the ground truth mask or sketch to ensure determinism;
[0023] During the supervised learning of segmentation masks, a linear combination of Focal loss and Dice loss is used to optimize the loss function in a ratio of 20:1.
[0024] Preferably, the obtaining of concept prediction in S3 includes using semantic tags to predict regional concepts, thereby enhancing the semantic understanding ability of the model; the obtaining of concept prediction includes:
[0025] Based on semantic tagging, a 1024-dimensional visual embedding is obtained through a 3-layer multi-layer perceptron;
[0026] The 1024-dimensional visual embedding is further projected into 2560-dimensional distribution logits;
[0027] Optimizing the KL divergence loss between the predicted and target distributions alleviates the performance degradation caused by similar concepts and prevents the annotation bias from being amplified by learning from CLIP.
[0028] Preferably, the obtaining of the promptable text description in S3 includes prompting based on the output semantic tag [S] of the image decoder to generate a regional text description; including:
[0029] Building a generative visual language model through causal language modeling, including:
[0030] (1) A causal Transformer architecture is used to transform visual signals into fixed-length causal sequences, thereby tokenizing visual signals for causal language modeling;
[0031] (2) placing the semantic marker at the leading position of the causal sequence and adding a [BOS] marker at the end;
[0032] (3) Use cross entropy loss to supervise the next tag prediction;
[0033] (4) Positional encoding of multimodal sequences based on rotation embedding integration;
[0034] Establishing a visual encoder, determining a semantic tag co-modeled with the suggestible segmentation, and matching the semantic tag with a dimension of a text embedding based on a linear projection and the visual encoder;
[0035] A text decoder with 25 million parameters and a lightweight structure is established to perform mask-to-text translation; the mask-to-text translation process includes: predicting tokenized region descriptions according to the Llama method based on byte pair encoding and a vocabulary of 32,000 tokens; using an 8-layer standard Transformer with an embedding dimension of 512 for text decoding to accommodate short descriptions;
[0036] Performing text reasoning and generating a regional text description; generating the regional text description includes:
[0037] (1) Iteratively generate up to 40 tags for each mask;
[0038] (2) cache multiple key-value pairs based on the standard approach of autoregression and generate multiple outputs corresponding to each suggestible segmentation;
[0039] (3) Based on the routing strategy between visual embedding and text embedding, the final output is selected from multiple outputs corresponding to each hint segmentation as the region text description.
[0040] The second aspect of the present invention provides a segmentation recognition and text description system based on a suggestable segmentation model, which enhances the region-level semantic understanding capability of a suggestable segmentation model ProTo by aligning vision and language in a suggestable segmentation model SAM; comprising:
[0041] An image target acquisition module, used for acquiring image targets;
[0042] A promptable segmentation model establishment module is used to establish a promptable segmentation model ProTo, wherein the promptable segmentation model ProTo is used to integrate the language ability of CLIP in the promptable segmentation task under the SMA architecture to simultaneously perform segmentation recognition and text description on the target, wherein the promptable segmentation model includes an image encoder, a prompt encoder and an image decoder; the image encoder and the image decoder provide regional-level semantic information based on visual prompts by simulating CLIP; the image decoder is used to provide regional-level visual representation based on visual prompts;
[0043] The segmentation recognition and text description module is used to perform segmentation recognition and text description on the image target based on the suggestable segmentation model to obtain suggestable segmentation, concept prediction and suggestable text description.
[0044] A third aspect of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is configured to read the instructions and execute the method described in the first aspect.
[0045] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, and the plurality of instructions can be read by a processor and execute the method described in the first aspect.
[0046] The method, system and electronic device provided by the present invention have the following beneficial effects:
[0047] 1. Through large-scale and more easily available segmentation mask data, rather than relying on expensive region-text pairs, segmentation, recognition and description can be performed simultaneously;
[0048] 2. By integrating the language capabilities of CLIP into the SAM architecture through large-scale image segmentation data, a detailed “concept distillation” is formed to distinguish it from traditional feature alignment. This method provides some significant advantages:
[0049] (1) Using the CLIP knowledge base can avoid specific annotation biases;
[0050] (2) Using concept distillation instead of feature alignment avoids strict feature similarity measurement between different architecture features;
[0051] (3) Inversely, CLIP is used for vision-language alignment without affecting the original geometric cue space of SAM.
[0052] (4) It is worth noting that by integrating CLIP in the mask decoder, the model acquires new functions based on the segmentation results, such as object recognition and text description.
[0053] 3. By introducing the concept of "Promptable Tokenization" (ProTo), we can express that given a visual prompt (such as a point, box, or sketch), the model can serve as a general, location-aware image tagging tool that can understand and decode region-level visual context and serve a wider range of vision-language tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 The flowchart of the segmentation recognition and text description method based on the suggestible segmentation model is a preferred embodiment of the present invention.
[0055] Figure 2 A schematic diagram of the model architecture of the promptable segmentation model ProTo according to a preferred embodiment of the present invention;
[0056] Figure 3 A schematic diagram of a text generation principle of a preferred embodiment of the present invention;
[0057] Figure 4 A schematic diagram of the structure of a segmentation recognition and text description system based on a suggestible segmentation model according to a preferred embodiment of the present invention;
[0058] Figure 5(a)-5(e) This is the visualization result of the preferred embodiment of the present invention;
[0059] Figure 6 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0060] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0061] The method provided by the present invention can be implemented in the following terminal environment, and the terminal may include one or more of the following components: a processor, a memory, and a display screen. The memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the method described in the following embodiment.
[0062] The processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire terminal, and executes various functions of the terminal and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory.
[0063] The memory may include random access memory (RAM) or read-only memory (ROM). The memory may be used to store instructions, programs, codes, code sets or instructions.
[0064] The display screen is used to display the user interface of each application.
[0065] In addition, those skilled in the art can understand that the structure of the above terminal does not constitute a limitation on the terminal, and the terminal may include more or fewer components, or combine certain components, or arrange the components differently. For example, the terminal also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, and a power supply, which will not be described in detail here.
[0066] Embodiment 1
[0067] like Figure 1 As shown, the present invention provides a segmentation recognition and text description method based on a suggestable segmentation model, by aligning vision and language in the suggestable segmentation model SAM to enhance the regional level semantic understanding ability of the suggestable segmentation model ProTo; comprising:
[0068] S1, obtain image target;
[0069] S2, establishing a promptable segmentation model ProTo, the promptable segmentation model ProTo is used to integrate the language ability of CLIP in the promptable segmentation task under the SMA architecture to simultaneously segment and identify the target and describe the text, the promptable segmentation model includes an image encoder, a prompt encoder and an image decoder; the image encoder and the image decoder provide regional semantic information based on visual prompts by simulating CLIP; the image decoder is used to provide regional visual representation based on visual prompts;
[0070] S3, performing segmentation recognition and text description on the image target based on the suggestable segmentation model to obtain suggestable segmentation, concept prediction and suggestable text description.
[0071] As a preferred embodiment, the suggestible segmentation model maintains the original capabilities of SAM (especially the segmentation capability) while expanding the capabilities of the model to include new capabilities such as object recognition and text description.
[0072] As a preferred implementation, the analog CLIP visual encoder (image encoder) and the universal image decoder are all-in-one.
[0073] like Figure 2 As shown, as a preferred embodiment, the S2 includes:
[0074] S21, obtaining an image segmentation dataset and a predicted segmentation mask for pre-training of the promptable segmentation model;
[0075] In this embodiment, the image segmentation dataset comes from SA-1B.
[0076] S22, replacing the mask decoder in the SAM architecture with a general image decoder to obtain the primary architecture of the model, and adding a semantic tag to the mask tag of each predicted segmentation mask; the semantic tag is used to learn semantic prior knowledge from a predefined concept space, and the semantic prior knowledge comes from the CLIP large model with 5 billion parameters;
[0077] S23, pre-training the model primary architecture on the image segmentation dataset, and constructing an integrated simulated CLIP visual encoder (image encoder) and a universal image decoder in the model primary architecture based on the model pre-training;
[0078] S24, based on the two subtasks of suggestible segmentation and lexical concept prediction, the mask-based segmentation loss and the semantic-based concept distillation loss are jointly optimized to obtain a pre-trained suggestible segmentation model with region recognition and localization capabilities;
[0079] like Figure 2 As shown, the prompt encoder takes inputs of points, boxes, and sketches from the SA-1B data source. The two subtasks include predicting masks after the image decoder through mask embedding, mask tags [M] of the predicted segmentation mask, and calculating scores, and obtaining promptable segmentations; predicting region concepts through text descriptions (semantic tags [S]), visual embeddings, and text embeddings of the CLIP text encoder.
[0080] In this embodiment, unlike previous methods that rely on expensive region-text data, the present invention uses CLIP and image segmentation data from SA-1B to align segmentation masks with language. Since SA-1B is a category-agnostic dataset, the present invention uses off-the-shelf CLIP embedding in an artificially designed concept space and distributes and aligns the concept vocabulary of SAM's predictions and CLIP's projections to achieve segmentation mask alignment with language.
[0081] S25, fine-tune the pre-trained hintable segmentation model on the region-level text description task.
[0082] As a preferred embodiment, the simulated CLIP visual encoder (image encoder) is used to preprocess the image segmentation data of SA-1B.
[0083] In this embodiment, the preprocessing is different from previous prompting methods, such as SAM and SEEM, and the present invention removes the text prompting method. This is because, compared with visual prompts based on points and boxes, text prompts may be ambiguous, especially when responding to 70% of small area masks in SA-1B. The prior art usually uses a pre-trained region proposal network to determine the candidate box, and then uses CLIP to directly extract the image embedding within the candidate box. In contrast, the SA-1B dataset already provides high-quality masks for each object in the image. It allows the image embedding of the mask area to be directly calculated based on these ground-truth masks, avoiding annotation bias or candidate box prediction errors of specific datasets. Specifically, the present invention uses a high-performance, open source CLIP model EVA-CLIP with 5B parameters to calculate the image embedding from the mask image cropping and store it locally.
[0084] As a preferred implementation, the image decoder generates 9 tags in total, including 4 semantic tags, 4 mask tags and 1 IoU tag.
[0085] In this embodiment, the image decoder is related to the hintable segmentation. The mask decoder in SAM adopts a lightweight architecture derived from Mask2Former, which can explicitly respond to specific input prompts. Therefore, hintable segmentation is a necessary prerequisite for mining the semantic capabilities of the model. Following the practice of SAM, the hintable segmentation model ProTo of the present invention predicts four masks for each prompt by default, but the routing strategy will ultimately determine one of them to resolve the ambiguity problem. Therefore, the image decoder generates a total of 9 tags: 4 semantic tags, 4 mask tags and 1 IoU tag.
[0086] As a preferred embodiment, in order to improve the training efficiency of the large-scale SA-1B dataset, a two-stage sampling strategy is used for the pre-training, using a maximum of 9 prompt points. In the first stage, boxes or points are sampled with equal probability from the true mask corresponding to the image segmentation data; in the second stage, 1 to 8 points are uniformly sampled from the error region between the predicted mask and the true mask corresponding to the image segmentation data.
[0087] As a preferred embodiment, the obtaining of the suggestable segmentation in S3 includes using a sketch or a mask as a first hint, which is an aspect not explored in the original SAM, and the obtaining of the suggestable segmentation includes: sampling from the image segmentation data using a non-interactive sampling method with a probability of 50%; the non-interactive sampling method with a probability of 50% includes:
[0088] During sampling, 1 to 9 points are uniformly obtained from the true mask;
[0089] During inference, nine points are selected from the linear space of planarized 2D coordinates of the ground truth mask or sketch to ensure determinism;
[0090] During the supervised learning of segmentation masks, a linear combination of Focal loss and Dice loss is used to optimize the loss function in a ratio of 20:1, following the strategy of the original SAM.
[0091] In this embodiment:
[0092] (1) Focal loss was proposed to solve the problem of class imbalance in one-stage object detection. That is, when detecting an object in an image, 10,000-100,000 candidate locations are evaluated, but only a few of them contain the target object, resulting in low training efficiency and most negative samples being located in the background area. Focal loss is adjusted by introducing parameters in the cross entropy. Generally, when initializing the parameters, the distribution of the last layer is made to match the distribution of samples relative to negative samples.
[0093] (2) Dice Loss is a loss function used for image segmentation tasks. It calculates a score based on the ratio of the overlapping area between the target segmentation image and the model output. Compared with the cross entropy loss function, it is more suitable for dealing with difficult-to-segment targets. The formula of Dice Loss is as follows:
[0094] DiceLoss=1-(2*|X&Y|) / (|X|+|Y|);
[0095] Where X represents the predicted value that can prompt the segmentation model, Y represents the target segmentation image corresponding to the image segmentation data, the & symbol represents the pixel-by-pixel bitwise AND, and |X| represents the sum of all pixel values in X.
[0096] DiceLoss has good performance in dealing with image segmentation tasks with unbalanced categories and small but numerous targets. The cross entropy loss function ignores the similarity between the predicted value and the target value, and is not sensitive enough to extreme pixel values. DiceLoss is an evaluation indicator based on similarity, which values the same pixel values and can handle the situation of unbalanced pixel values well.
[0097] As a preferred implementation, the obtaining of concept predictions in S3 includes using semantic tags to predict regional concepts, thereby enhancing the semantic understanding capability of the model.
[0098] In this embodiment, obtaining a concept prediction includes:
[0099] Based on semantic tagging, a 1024-dimensional visual embedding is obtained through a 3-layer MLP (multi-layer perceptron);
[0100] The 1024-dimensional visual embedding is further projected into 2560-dimensional distribution logits;
[0101] Optimizing the KL divergence loss between the predicted distribution and the target distribution alleviates the performance degradation caused by similar concepts. For example, a bulldog is a form of dog, so it should not deviate too far from related concepts such as dogs or cats in the representation space; the image-text distribution provides more information, preventing the model from learning the amplified annotation bias from CLIP.
[0102] As a preferred embodiment, the obtaining of the suggestible text description in S3 is used to replace the traditional manually customized prediction task with the next tag prediction based on a large language model and to release the potential ability of suggestible semantic tags based on text generation examples.
[0103] The obtaining of the promptable text description includes prompting based on the output semantic tag [S] of the image decoder to generate a regional text description; including:
[0104] 1. Establishing a generative visual language model through causal language modeling to promote the development of visual basic models. Based on the generative visual language model, the semantic tags from the image decoder are directly used to prompt causal text generation. Specifically, establishing a generative visual language model through causal language modeling includes:
[0105] (1) A causal Transformer architecture is used to transform visual signals into fixed-length causal sequences, thereby tokenizing visual signals for causal language modeling;
[0106] (2) placing the semantic marker at the leading position of the causal sequence and adding a [BOS] marker at the end;
[0107] (3) Use cross entropy loss to supervise the next tag prediction;
[0108] (4) Positional encoding of multimodal sequences based on rotation embedding integration.
[0109] Different from the prior art method of roughly coupling three frozen models, the model of the present invention can handle this task end-to-end. Its text generation architecture is as follows: Figure 3 As shown. Many previous works fine-tune the pre-trained model by using a pseudo open semantic classifier on an open semantic dataset. However, this task lags far behind contextual dialogue-based fine-tuning in natural language processing, which can encode unlimited human knowledge from the open world. The present invention is different from the contemporary work of Emu and ASM by introducing an intermediate Transformer to convert the visual signal into a fixed-length causal sequence, essentially tokenizing the visual signal for causal modeling; by placing the semantic tag at the leading position of the sequence, followed by a [BOS] tag, and using cross-entropy loss to supervise the next tag prediction; and using rotation embedding to integrate the positional encoding of multimodal sequences.
[0110] 2. Establish a visual encoder to determine semantic tags that are jointly modeled with the suggestible segmentation, and match the semantic tags with the dimensions of the text embedding based on linear projection and the visual encoder; this encoder is simpler than previous methods, and it parameterizes the region of interest features; and the segmented regions are visually encoded to achieve a more comprehensive visual understanding.
[0111] 3. Build a text decoder with 25 million parameters and a lightweight structure to perform mask-to-text translation; the mask-to-text translation process includes: predicting tokenized region descriptions according to the Llama method based on byte pair encoding and a vocabulary of 32,000 tokens; using an 8-layer standard Transformer with an embedding dimension of 512 for text decoding to accommodate short descriptions (maximum context length of 40);
[0112] 4. Perform text reasoning and generate a regional text description; the generating regional text description includes:
[0113] (1) Iteratively generate up to 40 tags for each mask;
[0114] (2) To speed up the computation of the attention module, we cache multiple key-value pairs based on the standard autoregressive approach and generate multiple outputs corresponding to each hintable segmentation;
[0115] (3) Based on the routing strategy between visual embedding and text embedding, the final output is selected from multiple outputs corresponding to each hint segmentation as the region text description.
[0116] Embodiment 2
[0117] like Figure 4 As shown, this embodiment provides a segmentation recognition and text description system based on a promptable segmentation model, which aligns vision and language in the promptable segmentation model SAM to enhance the regional level semantic understanding ability of the promptable segmentation model ProTo, including:
[0118] An image target acquisition module 101 is used to acquire an image target;
[0119] The promptable segmentation model building module 102 is used to build a promptable segmentation model ProTo, which is used to integrate the language ability of CLIP in the promptable segmentation task under the SMA architecture to simultaneously perform segmentation recognition and text description on the target. The promptable segmentation model includes an image encoder, a prompt encoder and an image decoder; the image encoder and the image decoder provide regional semantic information based on visual prompts by simulating CLIP; the image decoder is used to provide regional visual representation based on visual prompts;
[0120] The segmentation recognition and text description module 103 is used to perform segmentation recognition and text description on the image target based on the suggestable segmentation model to obtain suggestable segmentation, concept prediction and suggestable text description.
[0121] The visualization results are as follows Figure 5(a)-5(e) shown. Figure 5(a)-5(e) The visual explanation is that given a picture, by simply clicking, drawing a box or sketching on the picture, the model can simultaneously perform target segmentation, recognition and text description on the selected area.
[0122] Experimental and visualization results show that the proposed model exhibits strong performance in zero-shot classification recognition (e.g., 58.8AP on LVIS) while maintaining competitive segmentation performance (SAM42.1 vs. 42.0AP of the present invention). It is worth noting that the present invention has created a new benchmark in the regional text description task of the VisualGenome dataset, with a CIDEr score of 150.7. Studies have shown that the model can become a general regional-level image labeling tool, capable of encoding regional-level semantic context for a wider range of visual-language tasks, and the labeled regional features can be directly used to prompt causal language modeling, providing a new perspective for visual-language research.
[0123] The present invention also provides a memory storing a plurality of instructions, wherein the instructions are used to implement the method as in the first embodiment.
[0124] like Figure 6 As shown, the present invention also provides an electronic device, including a processor 301 and a memory 302 connected to the processor 301, the memory 302 stores a plurality of instructions, and the instructions can be loaded and executed by the processor so that the processor can execute the method as in the first embodiment.
[0125] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A segmentation recognition and text description method based on a suggestible segmentation model, It is characterized in that include: S1, obtain image target; S2, establishing a promptable segmentation model ProTo, the promptable segmentation model ProTo is used to integrate the language ability of CLIP in the promptable segmentation task under the SAM architecture to simultaneously segment and identify the target and describe the text, the promptable segmentation model includes an image encoder, a prompt encoder and a universal image decoder; the image encoder and the universal image decoder provide regional semantic information based on visual cues by simulating CLIP; the universal image decoder is used to provide regional visual representation based on visual cues; S3, performing segmentation recognition and text description on the image target based on the suggestable segmentation model to obtain suggestable segmentation, concept prediction and suggestable text description; The S2 includes: S21, obtaining an image segmentation dataset and a predicted segmentation mask for pre-training of the promptable segmentation model; S22, replace the mask decoder in the SAM architecture with a general image decoder to obtain the primary architecture of the model, and add a semantic tag to the mask tag of each predicted segmentation mask; the semantic tag is used to learn semantic prior knowledge from a predefined concept space, and the semantic prior knowledge comes from the CLIP large model with 5 billion parameters; S23, pre-training the model primary architecture on the image segmentation dataset, and constructing an integrated simulated CLIP visual encoder and a universal image decoder in the model primary architecture based on the model pre-training; S24, based on the two subtasks of suggestible segmentation and lexical concept prediction, the mask-based segmentation loss and the semantic-based concept distillation loss are jointly optimized to obtain a pre-trained suggestible segmentation model with region recognition and localization capabilities; S25, fine-tuning the pre-trained hintable segmentation model on the region-level text description task; The simulated CLIP visual encoder and the general image decoder are an integrated structure; the image segmentation dataset comes from SA-1B; the prompt encoder obtains input from points, boxes and sketches of the SA-1B data source; two subtasks include: predicting the mask through mask embedding, mask tags of the predicted segmentation mask and calculating scores after passing through the general image decoder, and obtaining a promptable segmentation; predicting region concepts through text description, visual embedding and text embedding of the CLIP text encoder; the simulated CLIP visual encoder is used to preprocess the image segmentation data of SA-1B; the general image decoder generates a total of 9 tags, including 4 semantic tags, 4 mask tags and 1 IoU tag.
2. A segmentation recognition and text description method based on a suggestible segmentation model according to claim 1, It is characterized in that The pre-training is performed using a two-stage sampling strategy with a maximum of 9 cue points; in the first stage, boxes or points are sampled with equal probability from the true mask corresponding to the image segmentation data; in the second stage, 1 to 8 points are uniformly sampled from the error region between the predicted mask and the true mask corresponding to the image segmentation data.
3. The segmentation recognition and text description method based on a suggestible segmentation model according to claim 2, It is characterized in that The obtaining of the promptable segmentation in S3 includes using a sketch or a mask as a first prompt, and the obtaining of the promptable segmentation includes: sampling from the image segmentation data using a non-interactive sampling method with a probability of 50%; the non-interactive sampling method with a probability of 50% includes: During sampling, 1 to 9 points are uniformly obtained from the true mask; During inference, nine points are selected from the linear space of planarized 2D coordinates of the ground truth mask or sketch to ensure determinism; During the segmentation mask supervised learning, a linear combination of Focal loss and Dice loss is used to optimize the loss function in a ratio of 20:
1.
4. The segmentation recognition and text description method based on a suggestible segmentation model according to claim 3, It is characterized in that The concept prediction of S3 includes predicting regional concepts using semantic tags, thereby enhancing the semantic understanding ability of the model; the concept prediction includes: Based on semantic tagging, a 1024-dimensional visual embedding is obtained through a 3-layer multi-layer perceptron; The 1024-dimensional visual embedding is further projected into 2560-dimensional distribution logits; Optimizing the KL divergence loss between the predicted and target distributions alleviates the performance degradation caused by similar concepts and prevents the annotation bias from being amplified by learning from CLIP.
5. The segmentation recognition and text description method based on a suggestible segmentation model according to claim 4, It is characterized in that The obtaining of the promptable text description in S3 includes performing prompting based on the output semantic tag [S] of the general image decoder to generate a regional text description; including: Building a generative visual language model through causal language modeling, including: (1) A causal Transformer architecture is used to transform visual signals into fixed-length causal sequences, thereby tokenizing visual signals for causal language modeling; (2) Place the semantic marker at the leading position of the causal sequence and add a [BOS] marker at the end; (3) Use cross entropy loss to supervise the next tag prediction; (4) Positional encoding of multimodal sequences based on rotation embedding integration; Establishing a visual encoder, determining a semantic tag co-modeled with the suggestible segmentation, and matching the semantic tag with a dimension of a text embedding based on a linear projection and the visual encoder; A text decoder with 25 million parameters and a lightweight structure is established to perform mask-to-text translation; the mask-to-text translation process includes: predicting tokenized region descriptions according to the Llama method based on byte pair encoding and a vocabulary of 32,000 tokens; using an 8-layer standard Transformer with an embedding dimension of 512 for text decoding to accommodate short descriptions; Performing text reasoning and generating a regional text description; generating the regional text description includes: (1) Iteratively generate up to 40 tags for each mask; (2) cache multiple key-value pairs based on the standard approach of autoregression and generate multiple outputs corresponding to each suggestible segmentation; (3) Based on the routing strategy between visual embedding and text embedding, the final output is selected from multiple outputs corresponding to each hint segmentation as the region text description.
6. A segmentation recognition and text description system based on a suggestible segmentation model, used to implement the method of any one of claims 1 to 5, It is characterized in that include: An image target acquisition module (101), used for acquiring an image target; A promptable segmentation model building module (102) is used to build a promptable segmentation model ProTo, wherein the promptable segmentation model ProTo is used to integrate the language ability of CLIP in the promptable segmentation task under the SAM architecture to simultaneously perform segmentation recognition and text description on the target, wherein the promptable segmentation model includes an image encoder, a prompt encoder and a universal image decoder; the image encoder and the universal image decoder provide regional semantic information based on visual prompts by simulating CLIP; the universal image decoder is used to provide regional visual representation based on visual prompts; The segmentation recognition and text description module (103) is used to perform segmentation recognition and text description on the image target based on the suggestable segmentation model to obtain suggestable segmentation, concept prediction and suggestable text description.
7. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is used to read the instructions and execute the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a plurality of instructions, and the plurality of instructions can be read by a processor to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Open vocabulary image semantic segmentation system based on text supervision
CN116612281A
Three-dimensional image-text template automatic recombination method, device and system
CN116935418A
Remote sensing image-based cultivated land extraction method, device, equipment and medium
CN116994140A
Image segmentation method and system based on multi-modal dialogue language model
CN117036706A
Text anaphora video object segmentation method based on reference analysis and perception enhancement
CN117079177A
