diff --git a/LamaRemove.py b/LamaRemove.py index f74e466..2ecfbdd 100644 --- a/LamaRemove.py +++ b/LamaRemove.py @@ -1,15 +1,11 @@ import os import sys -import cv2 -import numpy as np import torch -from PIL import Image from omegaconf import OmegaConf from pathlib import Path -import torch.nn as nn import torch -import torch.nn.functional as F + sys.path.insert(0, str(Path(__file__).resolve().parent)) diff --git a/lamaworkfolw.json b/lamaworkfolw.json new file mode 100644 index 0000000..553dea6 --- /dev/null +++ b/lamaworkfolw.json @@ -0,0 +1,854 @@ +{ + "last_node_id": 91, + "last_link_id": 126, + "nodes": [ + { + "id": 51, + "type": "CLIPTextEncode", + "pos": [ + 1813, + 1231 + ], + "size": { + "0": 400, + "1": 200 + }, + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 61 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 62 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "" + ] + }, + { + "id": 47, + "type": "VAEDecode", + "pos": [ + 2486, + 782 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 14, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 56 + }, + { + "name": "vae", + "type": "VAE", + "link": 57 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 58 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + } + }, + { + "id": 24, + "type": "ControlNetApply", + "pos": [ + 1845, + 191 + ], + "size": { + "0": 317.4000244140625, + "1": 98 + }, + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "conditioning", + "type": "CONDITIONING", + "link": 110 + }, + { + "name": "control_net", + "type": "CONTROL_NET", + "link": 46 + }, + { + "name": "image", + "type": "IMAGE", + "link": 124 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 70 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ControlNetApply" + }, + "widgets_values": [ + 0.8 + ] + }, + { + "id": 26, + "type": "ControlNetLoader", + "pos": [ + 1398, + 539 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 0, + "mode": 0, + "outputs": [ + { + "name": "CONTROL_NET", + "type": "CONTROL_NET", + "links": [ + 46 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ControlNetLoader" + }, + "widgets_values": [ + "control_v11f1e_sd15_tile.pth" + ] + }, + { + "id": 28, + "type": "CheckpointLoaderSimple", + "pos": [ + 1404, + 662 + ], + "size": { + "0": 315, + "1": 98 + }, + "flags": {}, + "order": 1, + "mode": 0, + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 49 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 61, + 111 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "VAE", + "type": "VAE", + "links": [ + 57, + 125 + ], + "shape": 3, + "slot_index": 2 + } + ], + "properties": { + "Node name for S&R": "CheckpointLoaderSimple" + }, + "widgets_values": [ + "epicrealism_pureEvolutionV3.safetensors" + ] + }, + { + "id": 73, + "type": "VAEEncode", + "pos": [ + 1745, + 1038 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "pixels", + "type": "IMAGE", + "link": 99 + }, + { + "name": "vae", + "type": "VAE", + "link": 125 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 126 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEEncode" + } + }, + { + "id": 27, + "type": "KSampler", + "pos": [ + 2109, + 774 + ], + "size": { + "0": 315, + "1": 262 + }, + "flags": {}, + "order": 13, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 49 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 70 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 62, + "slot_index": 2 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 126 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 56 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "KSampler" + }, + "widgets_values": [ + 1033476427188021, + "randomize", + 24, + 8, + "dpmpp_2m", + "normal", + 0.2 + ] + }, + { + "id": 23, + "type": "ImpactDilateMask", + "pos": [ + 162, + 193 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "mask", + "type": "MASK", + "link": 35 + } + ], + "outputs": [ + { + "name": "MASK", + "type": "MASK", + "links": [ + 115 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImpactDilateMask" + }, + "widgets_values": [ + 30 + ] + }, + { + "id": 18, + "type": "LoadImageMask", + "pos": [ + -217, + 190 + ], + "size": { + "0": 315, + "1": 318 + }, + "flags": {}, + "order": 2, + "mode": 0, + "outputs": [ + { + "name": "MASK", + "type": "MASK", + "links": [ + 35 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LoadImageMask" + }, + "widgets_values": [ + "tmp_ll8id09 (1).png", + "green", + "image" + ] + }, + { + "id": 15, + "type": "LamaModelLoader", + "pos": [ + 392, + 312 + ], + "size": { + "0": 229.20001220703125, + "1": 46 + }, + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "config", + "type": "YAML_CONFIG", + "link": 29 + } + ], + "outputs": [ + { + "name": "LAMA", + "type": "LAMA", + "links": [ + 27 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "YAML_CONFIG", + "type": "YAML_CONFIG", + "links": [], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "LamaModelLoader" + } + }, + { + "id": 17, + "type": "LoadImage", + "pos": [ + -227.90521160279053, + -178.50946044921875 + ], + "size": { + "0": 315, + "1": 314 + }, + "flags": {}, + "order": 3, + "mode": 0, + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 113 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "1 little girl (3).jpeg", + "image" + ] + }, + { + "id": 11, + "type": "YamlConfigLoader", + "pos": [ + 323, + 425 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 4, + "mode": 0, + "outputs": [ + { + "name": "YAML_CONFIG", + "type": "YAML_CONFIG", + "links": [ + 29, + 31 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "YamlConfigLoader" + }, + "widgets_values": [ + "config.yaml" + ] + }, + { + "id": 16, + "type": "LamaApply", + "pos": [ + 743, + 169 + ], + "size": { + "0": 210, + "1": 86 + }, + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 113 + }, + { + "name": "mask", + "type": "MASK", + "link": 115 + }, + { + "name": "lama", + "type": "LAMA", + "link": 27 + }, + { + "name": "config", + "type": "YAML_CONFIG", + "link": 31 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 30, + 99, + 112, + 124 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LamaApply" + } + }, + { + "id": 19, + "type": "PreviewImage", + "pos": [ + 1016, + -108 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 30 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 87, + "type": "CLIPTextEncodeBLIP", + "pos": [ + 1765, + -101 + ], + "size": { + "0": 400, + "1": 200 + }, + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 111 + }, + { + "name": "image", + "type": "IMAGE", + "link": 112 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 110 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncodeBLIP" + }, + "widgets_values": [ + 5, + 20, + "none", + "comfy", + "{{BLIP_TEXT}}" + ] + }, + { + "id": 48, + "type": "PreviewImage", + "pos": [ + 2342, + 373 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 15, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 58 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + } + ], + "links": [ + [ + 27, + 15, + 0, + 16, + 2, + "LAMA" + ], + [ + 29, + 11, + 0, + 15, + 0, + "YAML_CONFIG" + ], + [ + 30, + 16, + 0, + 19, + 0, + "IMAGE" + ], + [ + 31, + 11, + 0, + 16, + 3, + "YAML_CONFIG" + ], + [ + 35, + 18, + 0, + 23, + 0, + "MASK" + ], + [ + 46, + 26, + 0, + 24, + 1, + "CONTROL_NET" + ], + [ + 49, + 28, + 0, + 27, + 0, + "MODEL" + ], + [ + 56, + 27, + 0, + 47, + 0, + "LATENT" + ], + [ + 57, + 28, + 2, + 47, + 1, + "VAE" + ], + [ + 58, + 47, + 0, + 48, + 0, + "IMAGE" + ], + [ + 61, + 28, + 1, + 51, + 0, + "CLIP" + ], + [ + 62, + 51, + 0, + 27, + 2, + "CONDITIONING" + ], + [ + 70, + 24, + 0, + 27, + 1, + "CONDITIONING" + ], + [ + 99, + 16, + 0, + 73, + 0, + "IMAGE" + ], + [ + 110, + 87, + 0, + 24, + 0, + "CONDITIONING" + ], + [ + 111, + 28, + 1, + 87, + 0, + "CLIP" + ], + [ + 112, + 16, + 0, + 87, + 1, + "IMAGE" + ], + [ + 113, + 17, + 0, + 16, + 0, + "IMAGE" + ], + [ + 115, + 23, + 0, + 16, + 1, + "MASK" + ], + [ + 124, + 16, + 0, + 24, + 2, + "IMAGE" + ], + [ + 125, + 28, + 2, + 73, + 1, + "VAE" + ], + [ + 126, + 73, + 0, + 27, + 3, + "LATENT" + ] + ], + "groups": [ + { + "title": "Lama", + "bounding": [ + -253, + -268, + 1532, + 848 + ], + "color": "#3f789e" + } + ], + "config": {}, + "extra": {}, + "version": 0.4 +} \ No newline at end of file