Sub-packages: - edge/ — Canny, Lineart, LineartAnime (3 nodes) - restore/ — SCUNet, NAFNet, Adversarial (3 nodes) - compare/ — CCIP, LPIPS (2 nodes) - validate/ — Classify (11 ops), Check (5 ops), Metric (2 ops) - tagging/ — WD14, DeepDanbooru, DeepGelbooru, MLDanbooru, Camie, PixAI (6 nodes) Root nodes: - ImgUtilsOCR — PaddleOCR with heat/box threshold - ImgUtilsDetect — 10 detection types + confidence knob - ImgUtilsPose — DWPose + auto_detect toggle - ImgUtilsSegment — isnetis + scale knob - ImgUtilsTags — tag string processing - ImgUtilsCDC — upscaling + tile_size - ImgUtilsCensor — NSFW censoring with method/confidence/body-part toggles - ImgUtilsAlign — resize to max dimension - ImgUtilsSqueeze — transparency-based auto-crop Every node exposes its native function parameters as knobs. Removed mega-nodes: transform (11 ops), compare (3 ops), validate (18 ops).
36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
"""Node: ImgUtilsCCIP — CCIP character similarity comparison."""
|
|
from __future__ import annotations
|
|
from comfy_api.latest import io
|
|
from ..utils import comfy_to_pil
|
|
|
|
class ImgUtilsCCIP(io.ComfyNode):
|
|
OPS = ["ccip_difference", "ccip_same"]
|
|
|
|
@classmethod
|
|
def define_schema(cls) -> io.Schema:
|
|
return io.Schema(
|
|
node_id="ImgUtilsCCIP", display_name="Imgutils Compare (CCIP)",
|
|
category="imgutils/compare",
|
|
description="Compare anime character identity using CCIP. Outputs similarity distance or same-character check.",
|
|
search_aliases=["compare", "ccip", "character", "similarity", "distance"],
|
|
inputs=[
|
|
io.Image.Input("image_a", tooltip="First image"),
|
|
io.Image.Input("image_b", tooltip="Second image"),
|
|
io.Combo.Input("operation", options=cls.OPS, default="ccip_difference", tooltip="CCIP comparison mode."),
|
|
],
|
|
outputs=[io.String.Output(display_name="text")],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, image_a, image_b, operation) -> io.NodeOutput:
|
|
from imgutils.metrics import ccip_difference, ccip_same
|
|
pil_a = comfy_to_pil(image_a.numpy() if hasattr(image_a, "numpy") else image_a)
|
|
pil_b = comfy_to_pil(image_b.numpy() if hasattr(image_b, "numpy") else image_b)
|
|
|
|
if operation == "ccip_difference":
|
|
result = ccip_difference(pil_a, pil_b)
|
|
return io.NodeOutput(f"CCIP distance: {result:.4f} (lower = more similar)")
|
|
else:
|
|
result = ccip_same(pil_a, pil_b)
|
|
return io.NodeOutput(f"Same character: {'true' if result else 'false'}")
|