diff --git a/invokeai/app/invocations/create_gradient_mask.py b/invokeai/app/invocations/create_gradient_mask.py index 8db0b463ae5..18f586e7f17 100644 --- a/invokeai/app/invocations/create_gradient_mask.py +++ b/invokeai/app/invocations/create_gradient_mask.py @@ -28,7 +28,10 @@ class GradientMaskOutput(BaseInvocationOutput): """Outputs a denoise mask and an image representing the total gradient of the mask.""" - denoise_mask: DenoiseMaskField = OutputField(description="Mask for denoise model run") + denoise_mask: DenoiseMaskField = OutputField( + description="Mask for denoise model run. Values of 0.0 represent the regions to be fully denoised, and 1.0 " + + "represent the regions to be preserved." + ) expanded_mask_area: ImageField = OutputField( description="Image representing the total gradient area of the mask. For paste-back purposes." ) diff --git a/invokeai/app/invocations/fields.py b/invokeai/app/invocations/fields.py index bd841808f48..8767cf5032b 100644 --- a/invokeai/app/invocations/fields.py +++ b/invokeai/app/invocations/fields.py @@ -181,7 +181,7 @@ class FieldDescriptions: ) num_1 = "The first number" num_2 = "The second number" - denoise_mask = "A mask of the region to apply the denoising process to." + denoise_mask = "A mask of the region to apply the denoising process to. Values of 0.0 represent the regions to be fully denoised, and 1.0 represent the regions to be preserved." board = "The board to save the image to" image = "The image to process" tile_size = "Tile size" diff --git a/invokeai/app/invocations/flux_denoise.py b/invokeai/app/invocations/flux_denoise.py index af02b053e8d..0260a2f476d 100644 --- a/invokeai/app/invocations/flux_denoise.py +++ b/invokeai/app/invocations/flux_denoise.py @@ -39,7 +39,7 @@ title="FLUX Denoise", tags=["image", "flux"], category="image", - version="1.0.0", + version="2.0.0", classification=Classification.Prototype, ) class FluxDenoiseInvocation(BaseInvocation, WithMetadata, WithBoard): @@ -220,13 +220,19 @@ def _prep_inpaint_mask(self, context: InvocationContext, latents: torch.Tensor) device, and dtype for the inpaint mask. Returns: - torch.Tensor | None: Inpaint mask. + torch.Tensor | None: Inpaint mask. Values of 0.0 represent the regions to be fully denoised, and 1.0 + represent the regions to be preserved. """ if self.denoise_mask is None: return None mask = context.tensors.load(self.denoise_mask.mask_name) + # The input denoise_mask contains values in [0, 1], where 0.0 represents the regions to be fully denoised, and + # 1.0 represents the regions to be preserved. + # We invert the mask so that the regions to be preserved are 0.0 and the regions to be denoised are 1.0. + mask = 1.0 - mask + _, _, latent_height, latent_width = latents.shape mask = tv_resize( img=mask,