mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Add mask_strength to ConditioningField.
This commit is contained in:
parent
43d5803927
commit
4efd0f7fa9
@ -24,10 +24,13 @@ class AddConditioningMaskInvocation(BaseInvocation):
|
||||
"""Add a mask to an existing conditioning tensor."""
|
||||
|
||||
conditioning: ConditioningField = InputField(description="The conditioning tensor to add a mask to.")
|
||||
image: ImageField = InputField(
|
||||
mask: ImageField = InputField(
|
||||
description="A mask image to add to the conditioning tensor. Only the first channel of the image is used. "
|
||||
"Pixels <128 are excluded from the mask, pixels >=128 are included in the mask."
|
||||
)
|
||||
mask_strength: float = InputField(
|
||||
description="The strength of the mask to apply to the conditioning tensor.", default=1.0
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def convert_image_to_mask(image: Image.Image) -> torch.Tensor:
|
||||
@ -45,6 +48,7 @@ class AddConditioningMaskInvocation(BaseInvocation):
|
||||
context.services.latents.save(mask_name, mask)
|
||||
|
||||
self.conditioning.mask_name = mask_name
|
||||
self.conditioning.mask_strength = self.mask_strength
|
||||
return ConditioningOutput(conditioning=self.conditioning)
|
||||
|
||||
|
||||
|
@ -433,6 +433,11 @@ class ConditioningField(BaseModel):
|
||||
description="The mask associated with this conditioning tensor. Excluded regions should be set to 0, included "
|
||||
"regions should be set to 1.",
|
||||
)
|
||||
mask_strength: float = Field(
|
||||
default=1.0,
|
||||
description="The strength of the mask. Only has an effect if mask_name is set. The strength is relative to "
|
||||
"other masks. The default is 1.0. If set to 0.0, this mask will be ignored.",
|
||||
)
|
||||
|
||||
|
||||
@invocation_output("conditioning_output")
|
||||
|
Loading…
Reference in New Issue
Block a user