From cb6c5c23ce93e50f5dc5662128999a1c75f436c6 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Tue, 20 Feb 2024 18:28:59 -0500 Subject: [PATCH] Fix AddConditioningMaskInvocation logic. --- invokeai/app/invocations/conditioning.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/invokeai/app/invocations/conditioning.py b/invokeai/app/invocations/conditioning.py index a4a244e992..07d27995b9 100644 --- a/invokeai/app/invocations/conditioning.py +++ b/invokeai/app/invocations/conditioning.py @@ -36,12 +36,12 @@ class AddConditioningMaskInvocation(BaseInvocation): def convert_image_to_mask(image: Image.Image) -> torch.Tensor: """Convert a PIL image to a uint8 mask tensor.""" np_image = np.array(image) - torch_image = torch.from_numpy(np_image[0, :, :]) + torch_image = torch.from_numpy(np_image[:, :, 0]) mask = torch_image >= 128 return mask.to(dtype=torch.uint8) def invoke(self, context: InvocationContext) -> ConditioningOutput: - image = context.services.images.get_pil_image(self.image.image_name) + image = context.services.images.get_pil_image(self.mask.image_name) mask = self.convert_image_to_mask(image) mask_name = f"{context.graph_execution_state_id}__{self.id}_conditioning_mask"