Training diffusion model for particular equivariance
Patent Information
- Application Number
- JP2024059380
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-03
- Filing Date
- 2024-04-02
- Publication Date
- 2024-10-16
Smart Images

Figure 2024147525000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a diffusion model that processes noisy inputs into realistic images. [Background technology]
[0002] background Training an image classifier in a supervised fashion requires a large number of training images that are labeled with "ground truth". Labeling the training images is often a manual process and is therefore expensive. Also, in some situations, the number of training images is too small. For example, it is difficult to safely stage near-crash situations involving pedestrians for training a classifier to handle traffic situations.
[0003] For this reason, many data augmentation methods have been explored: given an image with known semantic content and therefore known "ground truth" labels, generate a modified image with substantially equivalent content, such that the existing "ground truth" labels remain valid for the modified image.
[0004] Recently, image generators based on diffusion models have emerged that take a noisy input and remove the noise in multiple stages to generate a realistic image. The input here can be a realistic image with added noise to give the diffusion model some guidance, but the control over the semantic content of the final output is still limited. Summary of the Invention [Means for solving the problem]
[0005] Disclosure of the Invention The invention provides a method for training a diffusion model, which is configured to generate a denoised output image o from an input image i containing at least one noise sample ε. In particular, the input image i may consist only of the noise sample ε. However, the input image i may also be, for example, a superimposition (for example an additive superimposition) of an arbitrary image with the noise sample ε. In particular, such a superimposition can be performed in a Markov chain consisting of several stages that progressively erase information in the arbitrary image.
[0006] In the course of the method, noise training samples ε are provided. For example, these noise samples ε can be drawn randomly from a given distribution. Also, the training images x * will also be provided.
[0007] The training objective here is to make the diffusion model equivalent with respect to at least one transformation T. Thus, a transformation T is provided that takes an image I and maps it to a transformed image. By equivalent, the diffusion model with respect to the transformation T, we mean that when the transformation T is applied to an input i of the diffusion model, the change that occurs in the output o of the diffusion model is predictable.
[0008] To move the training of the diffusion model in this direction, each noise sample ε is generated from one or more training images x * which results in a noisy image x t is obtained. As mentioned before, this can be done gradually in several stages.
[0009] Then, the transformation T is applied to the noisy image x t This allows the input i = T(x t) is generated from the input, from which the diffusion model to be trained generates an output o. Similar to the addition of noise ε, the noise removal here can also be performed in a multi-stage Markov chain. Alternatively or in combination, the transformation T is applied to the training images x * is applied to the noisy image x t We can also apply the transformation T to the noise samples ε before forming ε. For simplicity, in both cases we denote the result of the transformation as t Transformation of T(x t ) is considered to be the same.
[0010] Based on the transformation T and the noise samples ε, the predicted output o of the diffusion model to be trained # is calculated. The predicted output o # represents the predictable change that should occur in the output o of the diffusion model to be trained upon application of a transformation T to the input i of this diffusion model.
[0011] Prediction Output # The deviation of the output o from is evaluated by a given loss function L. The parameters characterizing the behavior of the diffusion model to be trained are optimized towards the goal that the value of the loss function L improves as further noisy training samples ε are processed.
[0012] In this way, the diffusion model is trained towards the goal that application of a transformation T to an input i produces a predictable change in its output o. This in turn allows deliberate edits to be made to the input i to produce desired changes in the output o using appropriate transformations T. In this regard, the input space i can be considered as a latent space suitable for making edits, somewhat similar to the feature maps that convolutional neural networks generate from images. The main difference is that the latent space is now pixel-aligned to the space of the output images o. In particular, the diffusion model can be trained to be equivalent with respect to multiple transformations T that form a "toolbox" for making desired modifications to the output image o.
[0013] Pixel alignment latent variables i have the ability to allow fine-grained image control by allowing specific regions in a given image to be resampled. Equivalence with respect to edits using a given transformation T can constrain, for example, that local resampling of latent variable i will result in a local change in appearance in the output o. Similarly, moving a local segment relative to a particular object in the surroundings will also change the object's position, but the object's appearance must be preserved.
[0014] In a particularly advantageous embodiment, the loss function L also measures the deviation of the output o from the noise sample ε, whose prediction is the standard objective for training a diffusion model. In combination with this, the newly introduced equality objective is a regularization term: if no transformation T is applied to the input i, the diffusion model behaves exactly in the standard form after training, but if a transformation T is applied in addition to this, the output o will be what is predicted taking into account the properties of the transformation T.
[0015] In the loss function L, both of the two objectives can be weighted relative to each other in any suitable manner. In particular, during training, On the other hand, the predicted output #and the deviation of output o from On the other hand, the deviation of the output o from the noise sample ε and The weights between can be varied according to an annealing schedule, thus facilitating convergence towards the two objectives.
[0016] In one example, the annealing schedule is # This involves gradually shifting the weights towards the deviation of the output o from the σ. That is, at the beginning of training, it is more important that the behavior of the diffusion model matches the standard behavior, i.e., that the noise samples ε are accurately predicted. In this regard, as training progresses, the equivalence objective can be gradually introduced.
[0017] In a particularly advantageous embodiment, a transformation T is applied to the noise samples ε, which results in a predicted output o # The transformed noise sample T(ε) is obtained as: In this way, the diffusion network is trained towards the equivalence that modifying the input i by the transformation T produces a corresponding modification of the output o.
[0018] Examples of transformations T that can be used to edit the target image include: Flip the image I to be transformed horizontally or vertically, Rotating the image I to be transformed, Scaling the image I to be transformed, and selectively applying at least one editing step to specific regions of interest in the image I to be transformed; Includes:
[0019] Especially in the latter case, pixel alignment between the input i and output o of the diffusion model is advantageous.
[0020] In a further particularly advantageous embodiment, the editing steps applied are: moving the contents of the region of interest to another location within the image I to be transformed, and Applying an optical flow field to the region of interest; Selectively include one or more of:
[0021] Such editing steps are most useful for generating variants of an image that still have equivalent semantic content, meaning that the "ground truth" labels assigned to the original image are still valid in the new image. For example, if the content of a region corresponding to an object is moved to another location in the image, the image still contains the same object. Also, by applying an optical flow field to a region corresponding to an object, the appearance of the object (e.g., a face) may change, but the object will still remain the same. In particular, the application of an optical flow field can help change the apparent pose of a person in an image. In the absence of training for equivalence, when a region corresponding to a face is translated to a different location (or distorted by application of an optical flow field) so that an input image of a face and noise ε are superimposed to form the input i for a diffusion model trained on a face dataset, the output o of the diffusion model may show a completely different face.
[0022] Therefore, the present invention also provides a method for editing at least one image X.
[0023] In the course of the method, a trained diffusion model is provided together with a transformation T that maps an image I to a transformed image T(I). The trained diffusion model is equivalent with respect to the transformation T. In particular, the trained diffusion model has been trained according to the method described above.
[0024] A noise sample ε is drawn randomly from a given distribution. Applying the noise sample to an image X produces a noisy image X t is obtained.
[0025] The transformation T is a noisy image X t This generates the input i for the trained diffusion model. Alternatively or in combination, a transformation T is applied to image X to generate the noisy image X t We can also apply the transformation T to the noise samples ε before forming ε. For simplicity, in both cases we denote the result of the transformation as t Transformation of T(x t ) and use it as input i for the trained diffusion model.
[0026] From the input i, the trained diffusion model generates an output o as a result of editing.
[0027] As described above, editing produces controllable effects on the semantic content of image X by applying a transformation T that has known equivalence with respect to the trained diffusion model. In particular, transformation T can be selected to leave the semantic content of image X unchanged or to apply well-defined changes to that semantic content.
[0028] In a particularly advantageous embodiment, the noise sample ε is at most 100% of the noise sample X t is applied to image X with an intensity that leaves a given content recognizable in . By doing so, the diffusion network is encouraged to preserve more of the semantic content of the original image X.
[0029] In a further particularly advantageous embodiment, the image X comprises a road traffic situation and the transformation T comprises a repositioning of at least one object in the road traffic situation. In this way, realistic looking images can be created for road traffic situations that occur only rarely and / or that are too difficult or too dangerous to stage. For example, the transformation T can be applied to a noisy image X t By applying the algorithm, a pedestrian walking casually on the sidewalk of the road in the original image X can be moved in front of an approaching vehicle. This is a highly dangerous situation that cannot be staged in public road traffic. Nevertheless, training images of such situations are necessary to train an image classifier for road traffic situations, so that the trained image classifier can correctly recognize them.
[0030] In a further advantageous embodiment, the image X is obtained from an image sequence including at least one object motion between the images, and the transformation T is a transformation of the noisy image X t or parts thereof. In this way, the motion extracted from an image sequence can be transferred to an output image o generated from image X while preserving the integrity of the rest of the semantic content of image X. For example, a sequence of output images o can be generated that show different or modified objects moving in the same way as in the original image X. In this case, the sequence is time-congruent, i.e. changes between one frame of the sequence and the next can be explained by the motion, and there is no sudden and unexpected change, such as one object being suddenly replaced by another.
[0031] As mentioned above, an advantage of editing an image with a transformation T in the latent space is that it provides good control over whether and how the semantic content of the image is changed. If the original image X has been labeled with ground truth labels for training the neural network, then by known equivalence, the ground truth labels for the output image o can be determined. Thus, in a further particularly advantageous embodiment, the method further comprises: Given an image X and a transformation T, we have known ground truth labels G X From the,ground truth labels G,for the output,o,on the task of the neural network to be trained. O determining Output o and ground truth labels G O training the neural network to be trained in a supervised manner using Includes.
[0032] In particular, the neural network to be trained may be an image classifier whose ability to generalize to unobserved situations relies on sufficient variability in the dataset of training images.
[0033] The method may be wholly or partly computer-implemented and realizable in software. The invention therefore also relates to a computer program comprising machine-readable instructions which, when executed by one or more computers and / or computing instances, cause the one or more computers and / or computing instances to carry out the method. Control units for vehicles or robots and other embedded systems capable of executing machine-readable instructions shall likewise be considered as computers in this specification. Computing instances include virtual machines, containers or other execution environments that allow the execution of machine-readable instructions in the cloud.
[0034] The non-transitory storage medium and / or download product may include a computer program. The download product is an electronic product that can be sold online and transferred over a network for rapid delivery. One or more computers and / or computing instances may include the computer program and / or the non-transitory storage medium and / or download product.
[0035] The present invention will now be described with the aid of drawings, without any intention of limiting the scope of the invention. [Brief description of the drawings]
[0036] [Figure 1] FIG. 1 illustrates an exemplary embodiment of a method 100 for training a diffusion model 1 configured to generate a denoised output image o from an input image i that includes at least one noise sample ε. [Diagram 2] FIG. 2 illustrates an exemplary embodiment of a method 200 for editing at least one image X. [Diagram 3] FIG. 2 illustrates the effect of the method 200 for transforming T by flipping noise samples ε. [Figure 4] 2 illustrates the effect of the method 200 for a transformation T that shifts a latent image region. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0037] 1 is a schematic flow chart of an embodiment of a method 100 for training a diffusion model 1. The diffusion model 1 is configured to generate a denoised output image o from an input image i that includes at least one noise sample ε.
[0038] In step 110, a noisy training sample ε is provided.
[0039] In step 120, the training image x* is provided.
[0040] In step 130, at least one transformation T is provided that maps an image I to a transformed image T(I). The training goal here is to equate the diffusion model 1 with respect to the transformation T.
[0041] According to block 131, the transformation T is Flip the image I to be transformed horizontally or vertically, Rotating the image I to be transformed, Scaling the image I to be transformed, and selectively applying at least one editing step to specific regions of interest in the image I to be transformed; may include one or more of:
[0042] According to block 131a, the editing step comprises: moving the contents of the region of interest to another location within the image I to be transformed, and Applying an optical flow field to the region of interest; may include one or more of:
[0043] In step 140, each noise sample ε is * Each time this is done, the noisy image x t is generated.
[0044] In step 150, a transform T is applied to the noisy image x t This allows us to train the input i=T(x t Alternatively or in combination, a transformation T is generated for the training images x * is applied to the noisy image x tWe can also apply the transformation T to the noise samples ε before forming ε. For simplicity, in both cases we denote the result of the transformation as t Transformation of T(x t ) is considered to be the same.
[0045] In step 160, the diffusion model to be trained generates outputs o from inputs i.
[0046] In step 170, a predicted output o is calculated based on at least the transform T and the noise samples ε. # is calculated.
[0047] According to block 171, the predicted output o is obtained by applying a transformation T to the noise samples ε. # can be determined.
[0048] In step 180, the predicted output o is calculated using a predetermined loss function L. # The deviation of the output o from is evaluated.
[0049] According to block 181, from the loss function L, we can also measure the deviation of the output o from the noise samples ε as the standard loss for the diffusion model 1.
[0050] According to block 182, in the loss function L, On the other hand, the predicted output # and the deviation of output o from On the other hand, the deviation of the output o from the noise sample ε and The weights between can be varied according to an annealing schedule.
[0051] In step 190, parameters 1a characterizing the behavior of the diffusion model 1 are optimized towards the goal of improving the value of the loss function L as further noise training samples ε are processed. The optimized state of parameters 1a is denoted by the reference 1a * The optimized parameters are shown in Table 1a. *is the trained state 1 of diffusion model 1 * This section stipulates:
[0052] FIG. 2 is a schematic flow chart of an embodiment of a method 200 for editing at least one image X.
[0053] In step 210, a trained diffusion model 1 and a transformation T are provided. The transformation T maps an image I to a transformed image T(I). The trained diffusion model 1 is equivalent with respect to the transformation T.
[0054] According to block 205, the image X may comprise a road traffic situation. According to block 211, the transformation T may in this case comprise a repositioning of at least one object in the road traffic situation.
[0055] According to block 206, an image X can be obtained from an image sequence that includes motion of at least one object between the images. Then, according to block 212, a transformation T is performed to convert the motion into a noisy image X t or a portion thereof.
[0056] In step 220, a noise sample ε is drawn randomly from a given distribution.
[0057] In step 230, the noise sample ε is applied to image X, resulting in a noisy image X t is obtained.
[0058] According to block 231, the noise sample ε is at most 100% of the noise in the noisy image X according to a given criterion. t can be applied to image X with an intensity that leaves a given content recognizable in
[0059] In step 240, the transform T is transformed to the noisy image X tThis generates the input i for the trained diffusion model 1. Alternatively or in combination, a transformation T is applied to the image X to generate the noisy image X t A transformation T can also be applied to the noise samples ε before ε is formed.
[0060] In step 250, the trained diffusion model 1 generates an output o from an input i as a result of editing.
[0061] In step 260, we use the ground truth labels G known for the image X and the transformation T. X From the,ground truth labels G,for the output,o,on the task of the neural network,2,to be trained. O is determined.
[0062] In step 270, the output o and the ground truth label G O The neural network 2 to be trained is trained in a supervised manner using the neural network 2 trained in a supervised manner. * is attached.
[0063] FIG. 3 illustrates the effect that method 200 has in an application where the transformation T flips the noise samples ε.
[0064] The image X to be edited is an image of a road traffic situation 10. The road traffic situation 10 includes a road 11, a tree 12 and a speed limit sign 13 of 70 km / h.
[0065] In the example shown in FIG. 3, the noise sample ε has a higher density on its left side than on its right side. If we apply the noise sample ε as it is to the image X, we get the noisy image X as the input i for the diffusion model 1. t is obtained.
[0066] Image X with the noise tWhen processed by the diffusion model 1, an output image o is obtained. In the example shown in Figure 3, the appearance of the tree 12 has changed in the output image o compared to the original image X, but it still appears as a tree.
[0067] The transformation T horizontally flips the noise samples ε. When these modified noise samples are applied to the original image X, the resulting noisy image X t ', which becomes another input i' for the diffusion model 1.
[0068] If the diffusion models 1 are not equivalent with respect to the transformation T, as required by method 200, then the output o' generated by the diffusion model 1 from an input i' will be significantly different from the output o generated from an input i. In the example shown in Figure 3, a tree 12 mutates to a house 14 and a speed limit sign 13 mutates to a stop sign 15.
[0069] In contrast, if diffusion model 1 has the above equivalence as required in method 200 (which can be provided, for example, by training according to method 100), then the above dramatic semantic changes in the output image o′ are avoided.
[0070] FIG. 4 shows a noisy image X t The effect of the method for transforming T to shift latent image regions in the image X with noise is shown. That is, unlike the example shown in FIG. 3, transforming T is now t It operates on the latent space above and does not operate on the noise samples ε that are used to progress from the space of the original images X into the latent space.
[0071] In the example shown in FIG. 4, the image X to be edited is a photo 20 of a smartphone 21. By applying a noise sample ε to the image X, a noisy image X tThe transformation T is formed by transforming the area where the smartphone 21 is visible in the original image X into the noisy image X t The content is moved to an equally sized region in the lower right corner of the image. The noise in the remaining region is left unchanged, and the holes in the content at their original positions are filled with random noise. The transformed image T(X t ) is the input i for diffusion model 1.
[0072] Contrary to what is required in method 200, if the diffusion model 1 is not equivalent with respect to the transformation T, then in the output image o, not only the position of the smartphone 21 changes as intended. Rather, in the output image o, a mobile phone 22, a predecessor to the smartphone, is shown instead of the smartphone 21. This is a significant semantic change.
[0073] In contrast, if diffusion model 1 has the above equivalence as required in method 200 (which can be provided, for example, by training according to method 100), then the above dramatic semantic changes in the output image o are avoided.
Claims
1. A method (100) for training a diffusion model (1) configured to generate a denoised output image o from an input image i containing at least one noise sample ε, comprising: Providing (110) a noisy training sample ε; ・Training images x * providing (120) - providing (130) at least one transformation T to equate said diffusion model (1), said transformation T mapping an image I to a transformed image T(I); Each noise sample ε is compared with one or more training images x * , whereby the noisy image x t Step (140) of obtaining The noisy image x t and / or the noisy image x t applying (150) the transformation T to the noise samples ε before they are formed, thereby obtaining inputs i=T(x t ) in step (150); - generating (160) an output o from said input i by said diffusion model to be trained (1); A predicted output o based on at least the transform T and the noise samples ε # Calculating (170) Using a predetermined loss function L, the predicted output o # evaluating (180) the deviation of said output o from Optimizing (190) parameters (1a) characterizing the behavior of the diffusion model (1) towards the goal of improving the value of the loss function L as further noisy training samples ε are processed; The method (100) comprising:
2. applying (171) the transform T to the noise samples ε, thereby obtaining a predicted output o # obtaining a transformed noise sample T(ε) as 2. The method of claim 1 (100).
3. The transformation T is Flip the image I to be transformed horizontally or vertically; Rotating the image I to be transformed; Scaling the image I to be transformed, and Selectively applying at least one editing step to specific regions of interest in the image I to be transformed (131) including one or more of:
3. The method (100) of claim 1 or 2.
4. The editing step includes: - moving the content of the region of interest to another location in the image I to be transformed, and Applying an optical flow field to the region of interest (131a), 4. The method (100) of claim 3.
5. The loss function L also measures the deviation of the output o from the noise samples ε (181). The method (100) of any one of claims 1 to 4.
6. During the training, in the loss function L, One of the predicted outputs o # the deviation of said output o from the deviation of the output o from the other noise sample ε; The weights between are varied according to an annealing schedule (182); 6. The method (100) of claim 5.
7. The annealing schedule is # 182a), gradually shifting weights towards deviations of the output o from 7. The method (100) of claim 6.
8. A method (200) for editing at least one image X, comprising: - providing (210) a trained diffusion model (1) and a transformation T that maps an image I to a transformed image T(I), said trained diffusion model (1) being equivalent with respect to said transformation T; A step of randomly drawing (220) a noise sample ε from a given distribution; applying (230) the noise sample ε to the image X, thereby obtaining a noisy image X t Step (230) of obtaining The noisy image X t and / or the noisy image X t applying (240) the transformation T to the noise samples ε before they are formed, thereby obtaining inputs i for the trained diffusion model (1); A step (250) of generating an output o as a result of editing from the input i by the diffusion model (1); The method (200) comprising:
9. The noise sample ε is at most 100% of the noise in the noisy image X according to a given criterion. t 231, applied to the image X at an intensity such that a given content remains recognizable in 9. The method (200) of claim 8.
10. The image X includes a road traffic situation (205), said transformation T comprising a rearrangement of at least one object in said road traffic situation (211); 10. The method (200) of claim 8 or 9.
11. said image X is acquired from a sequence of images including motion of at least one object between the images (206); The transformation T is the noisy image X t or a portion thereof (212). The method (200) of any one of claims 8 to 10.
12. Ground truth labels G known for the image X and the transformation T X , the ground truth labels G for the output o on the task of the neural network (2) to be trained. O determining (260) The output o and the ground truth label G O training (270) the neural network to be trained (2) in a supervised manner using Further comprising: The method (200) of any one of claims 8 to 11.
13. A computer program comprising machine-readable instructions that, when executed on one or more computers and / or computing instances, cause the one or more computers and / or computing instances to perform a method (100, 200) according to any one of claims 1 to 12.
14. A non-transitory machine-readable data carrier and / or download product comprising a computer program according to claim 13.
15. One or more computers containing a computer program according to claim 13 and / or comprising a machine-readable data carrier and / or a download product according to claim 14.
