add debug info of ImageBatchToList and ImageListToBatch nodes
This commit is contained in:
+16
-1
@@ -464,6 +464,10 @@ class QueueStopNode():
|
||||
|
||||
|
||||
class LS_ImageBatchToMultiList:
|
||||
|
||||
def __init__(self):
|
||||
self.NODE_NAME = 'ImageBatchToList'
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -491,15 +495,23 @@ class LS_ImageBatchToMultiList:
|
||||
"""
|
||||
B = image.shape[0]
|
||||
out = []
|
||||
sizes = []
|
||||
|
||||
for i in range(0, B, batch_size):
|
||||
batch = image[i:i + batch_size]
|
||||
out.append(batch)
|
||||
sizes.append(batch.shape[0])
|
||||
|
||||
log(f"{self.NODE_NAME}: Convert a batch of {B} images to {sizes}.", message_type='finish')
|
||||
|
||||
return (out,)
|
||||
|
||||
|
||||
class LS_MultiImageListToBatch:
|
||||
|
||||
def __init__(self):
|
||||
self.NODE_NAME = 'ImageListToBatch'
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -524,6 +536,7 @@ class LS_MultiImageListToBatch:
|
||||
# 以第一个 batch 的第一张图作为基准尺寸
|
||||
base_h, base_w = image[0].shape[1:3]
|
||||
out = []
|
||||
sizes = []
|
||||
|
||||
for batch in image:
|
||||
# batch: [B, H, W, C]
|
||||
@@ -541,11 +554,13 @@ class LS_MultiImageListToBatch:
|
||||
|
||||
# 转回 [B, H, W, C]
|
||||
batch = batch.permute(0, 2, 3, 1)
|
||||
|
||||
print(f"batch.shape={batch.shape}")
|
||||
sizes.append(batch.shape[0])
|
||||
out.append(batch)
|
||||
|
||||
# 沿 batch 维拼接
|
||||
out = torch.cat(out, dim=0)
|
||||
log(f"{self.NODE_NAME}: Convert {sizes} list(s) to a batch of {out.shape[0]} images.", message_type='finish')
|
||||
|
||||
return (out,)
|
||||
|
||||
|
||||
+1
-1
@@ -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 = "2.0.36"
|
||||
version = "2.0.37"
|
||||
license = {text = "MIT License"}
|
||||
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "timm", "colour-science", "transformers", "blend_modes", "huggingface_hub", "loguru"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user