fix mask dimension input bug of LAMA node

This commit is contained in:
chflame163
2024-08-30 10:30:18 +08:00
parent bb43b17f6b
commit 53aa0b25db
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -39,6 +39,7 @@ class LaMa:
l_images = []
l_masks = []
ret_images = []
print(f"########################mask.shape={mask.shape},dim={mask.dim()}")
for l in image:
l_images.append(torch.unsqueeze(l, 0))
@@ -47,7 +48,7 @@ class LaMa:
l_masks.append(m.split()[-1])
if mask is not None:
if mask.dim() == 2:
layer_mask = torch.unsqueeze(mask, 0)
mask = torch.unsqueeze(mask, 0)
l_masks = []
for m in mask:
if invert_mask:
@@ -106,7 +107,7 @@ class LaMa:
log(f"Error: {NODE_NAME} skipped, because unable to create temporary file.", message_type='error')
return (image, )
file_name_list.append(file_name)
# process
# process
from .iopaint import cli
cli.run(model=lama_model, device=device, image=Path(image_dir), mask=Path(mask_dir), output=Path(result_dir), config=Path(config_dir))
ret_images = [pil2tensor(check_image_file(os.path.join(result_dir, file_name), 500)) for file_name in file_name_list]
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_layerstyle"
description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress."
version = "1.0.36"
version = "1.0.37"
license = "MIT"
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools"]