Any visual component separation method based on context instruction

Through a visual component separation method based on contextual instructions, a generative model and a segmentation model are combined to generate input-output paired data for model training, and the Transformer block is used for training, solving the unseen semantic category decoupling performance in the prior art. It solves the problem of insufficient visual components and achieves efficient visual component separation in the open world.

CN118865378APending Publication Date: 2024-10-29CHINA UNIV OF PETROLEUM (EAST CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410814170.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Existing image decoupling algorithms generally have insufficient decoupling performance when facing unseen semantic categories, and cannot effectively handle complex scenes in the open world.

Method used

Adopt an arbitrary visual component separation method based on context instructions, couple the background image and visual components through the basic generation model and segmentation model, generate input-output paired data for model training, and build an image processing network, using Transformer blocks and self-attention Model training and separation of force mechanisms.

Benefits of technology

It significantly improves the decoupling effect on unseen categories, enhances the generalization ability and robustness of the model, and is able to separate arbitrary semantics and mixed visual components in the open world, making it suitable for a variety of computer vision tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865378A_ABST
    Figure CN118865378A_ABST
Patent Text Reader

Abstract

The invention provides an arbitrary visual component separation method based on a context instruction. The method comprises a universal visual component separation model and a corresponding training data synthesis process, and the constructed visual component separation model can separate any visual component from an image in the context. Specifically, the model combines a demonstration example and a query image into a grid form as input, and the model is trained to explicitly refer to semantics of separated visual components in the demonstration example so as to separate the visual components with the same semantics in the query image. This approach enables the model to process any unseen visual component through a learning normal form based on context instructions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer vision, and in particular relates to an image decoupling method. Background Art

[0002] In the field of image decoupling, a variety of methods have been proposed in recent years to handle complex visual tasks, each with its own advantages and disadvantages. The following are several major image decoupling methods and their characteristics:

[0003] 1. Image decoupling algorithm based on supervised learning

[0004] Supervised learning methods are widely used in image decoupling tasks. They train models with a large amount of labeled data to separate known semantic categories. Such methods rely on predefined category labels and use these labels to guide the model's learning process. For example, network structures such as U-Net and ResNet successfully achieve decoupling of complex images through a combination of convolutional layers and deconvolutional layers. These methods are effective in specific tasks and can accurately separate the semantic components that appear in the training set. However, the limitation of such methods is their dependence on training data. Once they encounter unseen semantic categories, their decoupling performance will drop significantly and they cannot generalize to complex scenes in the open world.

[0005] 2. Image decoupling algorithm based on generative adversarial network (GAN)

[0006] Generative adversarial networks can generate realistic images and separate complex backgrounds and foregrounds through adversarial training of generators and discriminators. The application of GAN in image decoupling tasks is mainly to learn the distribution of different components in the image through the generator, so as to achieve accurate decoupling. For example, CycleGAN can achieve image-to-image conversion without paired data. However, the training of GAN models is difficult, prone to mode collapse, and requires a lot of computing resources. In addition, GAN has weak generalization ability for new semantic categories and cannot effectively handle categories that have not been seen during training.

[0007] 3. Image decoupling algorithm based on self-supervised learning

[0008] Self-supervised learning enables the model to learn image features without explicit labels by generating pseudo labels or designing pre-training tasks. This method alleviates the dependence on a large amount of labeled data to a certain extent and improves the generalization ability of the model. For example, Contrastive Learning enables the model to learn to extract useful features from images by designing contrast loss; Masked Autoencoders enables the model to learn the structure and semantic information of images by covering part of the image and requiring the model to reconstruct it. Although self-supervised learning methods have improved the generalization ability of the model to a certain extent, their effects are still affected by the design of pre-training tasks and data distribution, and the performance improvement is limited when dealing with unseen semantic categories.

[0009] 4. Image decoupling algorithm based on unsupervised learning

[0010] Unsupervised learning methods rely on the structure and patterns of the data itself to learn features without any labeled data. Such methods usually optimize a certain objective function so that the model can capture the intrinsic characteristics of the data. For example, Autoencoders try to separate different semantic components by encoding images into low-dimensional features and then decoding them back to the original image; Generative Latent Optimization (GLO) directly optimizes the variables in the latent space to generate images similar to the training images. Although unsupervised methods do not rely on labeled data and have good scalability, their learning process may not be able to capture fine-grained semantic information, especially when dealing with complex scenes that have not been seen before, the effect is limited.

[0011] In summary, current image decoupling algorithms perform well when dealing with semantic categories seen during training, but their decoupling performance is generally insufficient when faced with unseen categories. Summary of the invention

[0012] In view of the above problems, the present invention provides a method for separating arbitrary visual components based on contextual instructions, and the method comprises the following steps:

[0013] S1, coupling the background image and visual components into one image based on the basic generation model and segmentation model;

[0014] S2, by using the method mentioned in S1, multiple visual components are coupled to the background image and spliced ​​into input-output paired data for model training in the form of a grid to supervise model training;

[0015] S3, builds an image processing network and trains the model using the training data synthesized in S2;

[0016] S4, splices a pair of demonstration sample images and a query image into a grid and inputs it into the model built in S3 to separate the corresponding visual components in the query image.

[0017] In a possible design, the specific process of coupling the background image and the visual component into one image based on the basic generation model and the segmentation model in step S1 is:

[0018] S11, first generate the expected image containing the expected semantic visual components through the text-based graph model. Given the selected semantic class S, we first insert it into the predefined text template to obtain the text prompt of the text-based graph model. The text template is customized to generate instance-level, high-quality, single background expected images;

[0019] S12, inputting the inserted textual prompt into the text-generated graph model to generate the desired image with the expected semantic visual components;

[0020] S13, segmenting the generated image into a foreground region of interest using an image segmentation model, and cutting it out to obtain a foreground image with a transparent background;

[0021] S14, apply random rotation and scaling to the obtained transparent foreground image and position it to a position of the target background image, and finally fuse the two images together through nonlinear blending. The method of nonlinear fusion is as follows: first, randomly initialize the target brightness values ​​of the five nodes of 0, 64, 128, 192 and 255; the target brightness of node 0 is fixed to 0, and the target brightness of other nodes is random. Then, we use these five nodes as interpolation points and obtain the entire brightness transformation function through the Lagrange interpolation polynomial. After obtaining the transformation function, we can perform brightness transformation on the given visual component, and finally fuse the two images through linear blending.

[0022] In a possible design, the step S2 couples multiple visual components to the background image by the method mentioned in S1, and splices them into input-output paired data for model training in the form of a grid to supervise the model training. The specific steps are:

[0023] S21, first copies two randomly selected high-quality images to obtain two copies as their corresponding initialization labels; then they go through three random decision mechanisms as a whole;

[0024] S22, in the first decision mechanism, a semantic S is randomly selected from the semantic categories of ADE20K as the visual component to be coupled within the semantic category pool; each semantic category can only be selected once in the synthesis pipeline cycle;

[0025] S23, in the second decision mechanism, the number n of visual components of the S semantic class to be coupled is randomly selected;

[0026] S24, in the third decision mechanism, randomly choose whether to remove the visual component of S semantic class; on the one hand, if it is chosen not to remove, the two backgrounds and their corresponding labels are respectively coupled with n identical visual stickers of S semantic class; on the other hand, if it is chosen to remove, the two backgrounds are respectively coupled with n visual stickers of S semantic classes, and their corresponding labels are not operated;

[0027] S25, finally repeat the above process t times to obtain the final four images, splice them into a grid and mask them to obtain the input and output data for model training.

[0028] In a possible design, the specific steps of building an image processing network in step S3 and training the model using the training data synthesized in S2 are:

[0029] S31, obtain more than 100,000 training data according to the method of S2;

[0030] S32, set the initial training parameters, including: image size is 512*512 pixels; epoch is 300; batch size is 16; the optimizer uses Adam optimizer, the initial learning rate is 0.0001, beta1 is 0.937, beta2 is 0.999, and the weight decay is 0.0005; warmup epoch is 3.0, warmup initial momentum is 0.8, and warmup initial bias is 0.1;

[0031] S33, calculate the loss and perform back propagation to update the model weights. The training ends when the iteration reaches 300 epochs, and the model is saved every 30 rounds.

[0032] S34, test and obtain a converged arbitrary visual component separation model that receives contextual instructions.

[0033] In a possible design, the newly designed image processing network in the step is specifically:

[0034] The image processing network adopts a modular construction of U-shaped structure, which hierarchically cascades multiple customized Transformer blocks to effectively mine contextual instructions and local details, where pixel unshuffle and pixel shuffle operations are used for downsampling and upsampling purposes; each Transformer module contains a customized triple self-attention convolution self-attention to enhance local details, channel attention between paired sub-features to grasp clear decoupling instructions, and global attention to simulate non-local interactions between demonstration examples and queries; given a grid-like feature F, F is first divided along the grid, and F is divided into The four sub-features F1, F2, F3, and F4 are then propagated through four separate spatial convolutional self-attentions and combined with the convolution operations in the Q, K, and V projections to model the fine-grained feature interactions within the grid, resulting in fs1, fs2, fs3, and fs4. Then, (fs1, fs2) and (fs3, fs4) are concatenated together in the channel dimension, respectively, and explicit separation semantics are explored by performing self-attention in the channel dimension. Finally, the connected feature segmentations are merged into a grid form Fg and transmitted through global self-attention to model the dependency between demonstration and query.

[0035] Beneficial effects: Compared with the prior art, the present invention provides a method for separating arbitrary visual components based on contextual instructions, which can separate arbitrary semantic and mixed visual components in images in an open world and produces the following beneficial effects:

[0036] 1. Strong versatility: The existing technology can only process semantic categories seen during training. The present invention unifies various potential visual component separation requirements and establishes a context-based decoupling framework, which enables the model to separate any visual component in the open world. Through example-driven semantic matching, the present invention performs well when processing unseen categories, significantly improving the decoupling effect.

[0037] 2. Example-driven context decoupling: By splicing demonstration examples and query images into a grid-like form and inputting them into the model, the model can explicitly reference the semantics of the separated visual components in the demonstration examples to separate the visual components with the same semantics in the query image. This method enables the model to master the semantic matching ability that is independent of the category, so that it can handle unknown semantics outside the domain during the reasoning process.

[0038] 3. Unsupervised learning: This paper adopts unsupervised learning methods to achieve efficient feature separation by optimizing the structure and pattern of the data itself. Through the automatic encoder and latent space optimization technology, the model can capture the intrinsic characteristics of the data without clear labels, improve the processing ability of complex scenes, and effectively enhance the generalization ability and robustness of the model.

[0039] 4. Wide application: The present invention has good robustness and universality, and can perform multi-task image decoupling in a variety of application environments. Whether processing known semantic categories or unknown new categories, the present invention can provide high-quality decoupling results and is suitable for various computer vision tasks, such as object separation, rain removal, watermark removal, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 The flowchart of training context instruction model of the present invention.

[0041] Figure 2 Flowchart for constructing contextual training data for the present invention.

[0042] Figure 3 The image processing network structure diagram constructed for the present invention. DETAILED DESCRIPTION

[0043] The context-instruction-based visual component separation method in the present invention constructs a context decoupling framework and example-driven separation technology, so that the model can separate visual components of arbitrary semantics in the open world according to instructions, thereby greatly improving the separation effect of visual components of unknown categories in actual scenes.

[0044] The invention will be further described below in conjunction with specific embodiments.

[0045] Embodiment 1:

[0046] like Figure 1 As shown, the specific process of training the context instruction model is: for two given natural images, a data synthesis pipeline is applied to synthesize grid-shaped context data for model training; the grid-shaped context data is sent to the image processing network, and the image processing network semantically separates the visual components with the same semantics in the query image in the lower left corner according to the visual components separated by the demonstration examples in the context data, and stores the separated results in the lower right corner to obtain the output context data; the predicted image in the lower right corner after separation and the true label calculate the loss and back-propagate to optimize the image processing network.

[0047] like Figure 2As shown in the figure, the specific process of constructing contextual training data is as follows: first, copy two high-quality natural images to obtain two copies as their corresponding initialization labels; then they pass through three random decision mechanisms as a whole; in the first decision mechanism, a semantic S is randomly selected from the semantic categories of ADE20K as the visual component to be coupled within the semantic class pool; each semantic class can only be selected once in the synthesis pipeline cycle; in the second decision mechanism, the number n of visual components of the S semantic class to be coupled is randomly selected; in the third decision mechanism, it is randomly selected whether to delete the visual component of the S semantic class; on the one hand, if it is chosen not to remove, the two backgrounds and their corresponding labels are respectively coupled with n identical visual stickers of the S semantic class; on the other hand, if it is chosen to remove, the two backgrounds are respectively coupled with n visual stickers of the S semantic classes, and their corresponding labels are not operated; finally, the above process is repeated t times to obtain the final four images, which are spliced ​​into a grid and masked to obtain the input and output data for model training.

[0048] like Figure 3 As shown in FIG, the specific structure of the image processing model used is as follows: the network adopts a modular construction of a U-shaped structure, which hierarchically cascades multiple customized Transformer blocks to effectively mine contextual instructions and local details, among which pixel unshuffle and pixel shuffle operations are used for downsampling and upsampling purposes; each Transformer module contains a customized triple self-attention, spatial convolutional self-attention to enhance local details, channel self-attention between paired sub-features to grasp clear decoupling instructions, and global self-attention to model the non-local interaction between demonstration examples and queries; given a class grid feature F, it is firstly The grid is divided into four sub-features F1, F2, F3, and F4; then, F1, F2, F3, and F4 are propagated through four separate spatial convolutional self-attentions, and combined with the convolution operations in the Q, K, and V projections, the fine-grained feature interactions within the grid are modeled to obtain fs1, fs2, fs3, and fs4; then, (fs1, fs2) and (fs3, fs4) are concatenated together in the channel dimension, respectively, and explicit separation semantics are explored by self-attention in the channel dimension; finally, the connected feature segmentations are merged into a grid form Fg and transmitted through global self-attention to model the dependency between demonstration and query.

[0049] This example takes the addition of the semantic components of "dog" and "car" during training as an example. Figure 1 , Figure 2 , Figure 3 , the specific workflow of the method for separating arbitrary visual components based on contextual instructions of the present invention is described as follows:

[0050] S1, based on the basic generation model Stable Diffusion and the segmentation model SAM, couples the background image and visual components into one image;

[0051] S2, by using the method mentioned in S1, multiple visual components are coupled to the background image and spliced ​​into input-output paired data for model training in the form of a grid to supervise model training;

[0052] S3, builds an image processing network and trains the model using the training data synthesized in S2;

[0053] S4, splices a pair of demonstration sample images and a query image into a grid and inputs it into the model built in S3 to separate the corresponding visual components in the query image.

[0054] In step S1, the specific process of coupling the background image and the visual component into one image based on the basic generation model Stable Diffusion and the segmentation model SAM is as follows:

[0055] S11, first generate the expected image containing the expected semantic visual components through the Stable Diffusion model of the text graph. Given the selected semantic class S (assuming it is a dog), we first insert it into the predefined text template to obtain the text prompt of the text graph model. The text template is customized to generate instance-level, high-quality, single background expected image: "full view of a singledog positioned in the center of the image on thesimple and monotonous ambient background, singledog, basic white background, highly realistic, highly detailed, intricate detail, sharp high detail, hightextures, sharp focus, crisp lines and color, 8k, plms";

[0056] S12, inputting the inserted textual prompt into the text-generated graph model to generate the desired image with the expected semantic visual components;

[0057] S13, segmenting the generated image into a foreground region of interest using an image segmentation model, and cutting it out to obtain a foreground sticker with a transparent background;

[0058] S14, apply random rotation and scaling to the obtained transparent foreground image and position it to a position of the target background image, and finally fuse the two images together through nonlinear blending. The method of nonlinear fusion is as follows: first, randomly initialize the target brightness values ​​of the five nodes of 0, 64, 128, 192 and 255; the target brightness of node 0 is fixed to 0, and the target brightness of other nodes is random. Then, we use these five nodes as interpolation points and obtain the entire brightness transformation function through the Lagrange interpolation polynomial. After obtaining the transformation function, we can perform brightness transformation on the given visual component, and finally fuse the two images through linear blending.

[0059] In step S2, multiple visual components are coupled to the background image by the method mentioned in S1, and spliced ​​into input-output paired data for model training in the form of a grid to supervise the model training. The specific steps are:

[0060] S21, first copies two randomly selected high-quality images to obtain two copies as their corresponding initialization labels; then they go through three random decision mechanisms as a whole;

[0061] S22, in the first decision mechanism, a semantic S (assumed to be dog or car) is randomly selected from the semantic categories of ADE20K as the visual component to be coupled in the semantic category pool; each semantic category can only be selected once in the synthesis pipeline cycle;

[0062] S23, in the second decision mechanism, the number n of visual components of the S semantic class to be coupled is randomly selected;

[0063] S24, in the third decision mechanism, randomly choose whether to remove the visual component of S semantic class; on the one hand, if it is chosen not to remove, the two backgrounds and their corresponding labels are respectively coupled with n identical visual stickers of S semantic class; on the other hand, if it is chosen to remove, the two backgrounds are respectively coupled with n visual stickers of S semantic classes, and their corresponding labels are not operated;

[0064] S25, finally repeat the above process t times to obtain the final four images, splice them into a grid and mask them to obtain the input and output data for model training.

[0065] In step S3, the specific steps of building an image processing network and training the model using the training data synthesized in S2 are:

[0066] S31, obtain more than 100,000 training data according to the method of S2;

[0067] S32, set the initial training parameters, including: image size is 512*512 pixels; epoch is 300; batch size is 16; the optimizer uses Adam optimizer, the initial learning rate is 0.0001, beta1 is 0.937, beta2 is 0.999, and the weight decay is 0.0005; warmup epoch is 3.0, warmup initial momentum is 0.8, and warmup initial bias is 0.1;

[0068] S33, calculate the loss and perform back propagation to update the model weights. The training ends when the iteration reaches 300 epochs, and the model is saved every 30 rounds.

[0069] S34, test and obtain a converged arbitrary visual component separation model that receives contextual instructions.

[0070] In step S4, a pair of demonstration sample images and a query image are spliced ​​into a grid and input into the model built in S3 to separate the corresponding visual components in the query image, specifically: obtaining the target image; inputting the target image into the built small target detection model to separate the visual components with the same semantics in the query image; and outputting the separated results.

[0071] The present invention provides a visual component separation method based on contextual instructions. By splicing demonstration examples and query images into a grid-shaped input model, an example-driven separation technology is introduced into the context decoupling framework, so that the model can effectively separate various potential visual components according to contextual instructions, thereby greatly improving the separation effect of unknown category visual components in actual scenes.

[0072] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0073] Although the above describes the specific implementation methods of the present invention, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A method for separating arbitrary visual components based on contextual instructions, It is characterized in that The following steps are involved: S1, coupling the background image and visual components into one image based on the basic generation model and segmentation model; S2, by using the method mentioned in S1, multiple visual components are coupled to the background image and spliced ​​into input-output paired data for model training in the form of a grid to supervise model training; S3, builds an image processing network and trains the model using the training data synthesized in S2; S4, splices a pair of demonstration sample images and a query image into a grid and inputs it into the model built in S3 to separate the corresponding visual components in the query image.

2. The method for separating arbitrary visual components based on contextual instructions as claimed in claim 1, It is characterized in that The specific process of coupling the background image and the visual component into one image based on the basic generation model and the segmentation model in step S1 is: S11, first generate the expected image containing the expected semantic visual components through the text-based graph model; given the selected semantic class S, we first insert it into the predefined text template to obtain the text prompt of the text-based graph model; the text template is customized to generate instance-level, high-quality, single background expected image; S12, inputting the inserted textual prompt into the text-generated graph model to generate the desired image with the expected semantic visual components; S13, segmenting the generated image into a foreground region of interest using an image segmentation model, and cutting it out to obtain a foreground image with a transparent background; S14, apply random rotation and scaling to the obtained transparent foreground image and position it to a position of the target background image, and finally fuse the two images together through nonlinear blending; the nonlinear fusion method is as follows: first, randomly initialize the target brightness values ​​of the five nodes 0, 64, 128, 192 and 255; the target brightness of node 0 is fixed to 0, and the target brightness of other nodes is random. Then, we use these five nodes as interpolation points and obtain the entire brightness transformation function through the Lagrange interpolation polynomial; after obtaining the transformation function, we can perform brightness transformation on the given visual component, and finally fuse the two images through linear blending.

3. The method for separating arbitrary visual components based on contextual instructions as claimed in claim 1, It is characterized in that The step S2 is specifically as follows: S21, first copies two randomly selected high-quality images to obtain two copies as their corresponding initialization labels; then they go through three random decision mechanisms as a whole; S22, in the first decision mechanism, a semantic S is randomly selected from the semantic categories of the ADE20K semantic segmentation dataset as the category of the visual component to be coupled; each semantic category can only be selected once in the synthesis pipeline cycle; S23, in the second decision mechanism, the number n of visual components of the S semantic class to be coupled is randomly selected; S24, in the third decision mechanism, randomly chooses whether to delete the visual component of the S semantic class; On the one hand, if you choose not to remove, the two backgrounds and their corresponding labels are coupled with n identical visual stickers of S semantic classes respectively; on the other hand, if you choose to remove, the two backgrounds are coupled with n visual stickers of S semantic classes respectively, and their corresponding labels are not operated; S25, finally repeat the above process t times to obtain the final four images, splice them into a grid and mask them to obtain the input and output data for model training.

4. The method for separating arbitrary visual components based on contextual instructions as claimed in claim 1, It is characterized in that The specific steps of step S3 to build an image processing network and train the model using the training data synthesized in S2 are: S31, obtain more than 100,000 training data according to the method of S2; S32, set the initial training parameters, including: image size is 512*512 pixels; epoch is 300; batch size is 16; the optimizer uses Adam optimizer, the initial learning rate is 0.0001, beta1 is 0.937, beta2 is 0.999, and the weight decay is 0.0005; warmup epoch is 3.0, warmup initial momentum is 0.8, and warmup initial bias is 0.1; S33, calculate the loss and perform back propagation to update the model weights. The training ends when the iteration reaches 300 epochs, and the model is saved every 30 rounds. S34, test and obtain a converged arbitrary visual component separation model that receives contextual instructions.

5. The method for separating arbitrary visual components based on contextual instructions as claimed in claim 1, Features: Designed image processing network: The image processing network adopts a modular construction of U-shaped structure, which hierarchically cascades multiple customized Transformer blocks to effectively mine contextual instructions and local details, where pixel unshuffle and pixel shuffle operations are used for downsampling and upsampling purposes; each Transformer module contains a customized triple convolutional self-attention to enhance local details, channel attention between paired sub-features to grasp clear decoupling instructions, and global attention to simulate non-local interactions between demonstration examples and queries; given a grid-like feature F, F is first divided along the grid into four sub-features F1, F2, F3, F4; subsequently, F1, F2, F3, F4 are propagated through four separate spatial convolutional self-attentions, and combined with the convolution operations in Q, K, V projections, the fine-grained feature interactions within the grid are modeled to obtain fs1, fs2, fs3, fs4; then, (fs1, fs2) and (fs3, fs4) are concatenated together in the channel dimension, respectively, and explicit separation semantics are explored by self-attention in the channel dimension; finally, the connected feature segmentations are merged into a grid form Fg and transmitted through global self-attention to model the dependency between demonstration and query.