Fixes "Cannot handle this data type: (1, 1, 1024), |u1" error in PreviewImage node: - Maintain (H,W,C) tensor format instead of transposing to (C,H,W) - Add explicit float32 data type conversion for PyTorch tensors - Implement comprehensive error handling with fallback values - Fix OpenCV guided filter data type compatibility issues Ensures GrabCut nodes output tensors in ComfyUI's expected format: (batch, height, width, channels) for images and (batch, height, width) for masks.
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Test node imports and registration."""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Add parent directory to path for module import
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
# Import directly from modules
|
|
from nodes import NODE_CLASS_MAPPINGS as NODES_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as NODES_DISPLAY_MAPPINGS
|
|
from grabcut_nodes import NODE_CLASS_MAPPINGS as GRABCUT_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS as GRABCUT_DISPLAY_MAPPINGS
|
|
|
|
# Combine mappings as done in __init__.py
|
|
NODE_CLASS_MAPPINGS = {**NODES_MAPPINGS, **GRABCUT_MAPPINGS}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {**NODES_DISPLAY_MAPPINGS, **GRABCUT_DISPLAY_MAPPINGS}
|
|
|
|
print(f"✓ Successfully imported and combined node mappings")
|
|
print(f"Found {len(NODE_CLASS_MAPPINGS)} total nodes:")
|
|
for name, cls in NODE_CLASS_MAPPINGS.items():
|
|
display = NODE_DISPLAY_NAME_MAPPINGS.get(name, "Unknown")
|
|
print(f" - {name}: {display}")
|
|
|
|
# Check GrabCut nodes specifically
|
|
grabcut_nodes = [k for k in NODE_CLASS_MAPPINGS if 'GrabCut' in k]
|
|
print(f"\n✓ Found {len(grabcut_nodes)} GrabCut nodes:")
|
|
for node in grabcut_nodes:
|
|
print(f" - {node}: {NODE_DISPLAY_NAME_MAPPINGS[node]}") |