timm numpy torch
A ComfyUI custom node for SwinIR (Swin Transformer for Image Restoration) supporting image super-resolution and denoising.
custom_nodes directory:cd ComfyUI/custom_nodes
git clone https://github.com/alexcong/ComfyUI-SwinIR.git
cd ComfyUI-SwinIR
pip install -r requirements.txt
ComfyUI/models/upscale_models/Loads a SwinIR model with specified configuration.
Parameters:
model_name: Select from available models in upscale_models foldermodel_type: Choose model type (classicalSR, lightweightSR, realSR, denoising)upscale: Upscale factor (1-8)window_size: Window size for attention (default: 8)embed_dim: Embedding dimension (default: 180)depths: Comma-separated depths for each layer (e.g., “6, 6, 6, 6, 6, 6”)num_heads: Comma-separated number of attention heads (e.g., “6, 6, 6, 6, 6, 6”)mlp_ratio: MLP ratio (default: 2.0)img_size: Training image size (default: 128) – must match model’s training sizeProcesses images using the loaded SwinIR model.
Parameters:
swinir_model: Model from SwinIR Model Loaderimages: Input imagestile_size: Tile size for processing (default: 512)overlap: Overlap between tiles (default: 32)001_classicalSR_DF2K_s64w8_SwinIR-M_x2.pths64 in filename)002_lightweightSR_DIV2K_s64w8_SwinIR-S_x2.pth003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth005_colorDN_DFWB_s128w8_SwinIR-M_noise25.pths128 in filename)Run the test suite:
python test_nodes.py
The test suite includes a real model loading test that requires downloading a pre-trained model:
005_colorDN_DFWB_s128w8_SwinIR-M_noise25.pth from:test_nodes.pyWithout the model, the real model test will be skipped. Other tests run using synthetic models and don’t require downloads.
This project follows the same license as the original SwinIR repository.