Nodes/Eric_Image_Processing_Nodes/SFHformer Dual-Domain
ComfyUI Node

SFHformer Dual-Domain

The honest read on 'use_model' before you flip it on

By EricRollei·Created 9 months ago·Updated 8 months ago· 9
SFHformer Dual-Domain
  • image
  • enhanced_image
  • processing_info
presetrestoration
domain_blend0.5
sharpening_strength0.4
bilateral_sigma75
use_modeltrue

This node has a use_model toggle that defaults to on, and a "Use Model" description in the tooltip implying you're choosing between a trained neural network and a classical fallback. Worth knowing exactly what that means in practice: the "model" path builds a fresh Spatial-Frequency Hybrid Transformer with no pretrained checkpoint anywhere in the pack, and runs it as-is. There's no weights file it's failing to find and falling back from - it's not looking for one at all. What you get with use_model on is an untrained transformer's output; what you get with it off is honest, deterministic, classical dual-domain processing. For actual results, the fallback is the one doing real work.

The idea SFHformer is built around

The underlying concept is legitimate and worth understanding independent of this specific implementation: SFHformer (Spatial-Frequency Hybrid transformer) processes an image in both the spatial domain and the frequency domain simultaneously, using FFT mechanisms folded directly into the transformer architecture, then blends the two views. Spatial processing handles local structure well; frequency-domain processing is naturally good at separating fine texture and noise from broader content, since noise and detail sit in different frequency bands. Blending both gets you strengths from each. This node's classical fallback implements that blend directly with a spatial-domain filter pass and a frequency-domain filter pass, combined by domain_blend - no transformer required for that part, just the concept it's named for.

Inputs and outputs that matter

  • preset - restoration (balanced, general use), denoising (stronger noise reduction with detail preservation), sharpening (detail-focused), or high_quality (heavier processing, more VRAM).
  • domain_blend (default 0.5) - 0.0 is pure frequency-domain processing, 1.0 is pure spatial-domain, 0.5 blends evenly. This is the parameter actually doing the "dual-domain" work regardless of use_model.
  • use_model (default true) - leave this off for predictable, classical dual-domain results. Turn it on only if you're specifically experimenting with the transformer path and understand it's running without any trained weights.
  • sharpening_strength and bilateral_sigma - fine controls for the fallback's detail-enhancement and noise-reduction components respectively.

Outputs: enhanced_image and processing_info, which reports model_loaded - check this field; it'll say "Yes" even for the untrained transformer, since "loaded" here just means a model object was constructed, not that it's trained.

Installing it

Through ComfyUI Manager, search Eric's Image Processing Nodes. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Eric_Image_Processing_Nodes
cd Eric_Image_Processing_Nodes
pip install -r requirements.txt

Restart ComfyUI. Nothing to download for the fallback path - it's classical processing. If a future pack update ships real SFHformer weights, this article's guidance to keep use_model off should be revisited; as of this writing, no such checkpoint exists in the repository.

Where people get burned

The trap is trusting use_model: true because it sounds like the "better," more modern option. In practice it's an untrained network, and untrained transformers don't produce garbage-looking noise the way you might expect - they can produce plausible-but-wrong output that's hard to distinguish from a subtle bug elsewhere in your workflow. If results from this node look inconsistent or oddly artifact-prone compared to its neighbors in the pack, set use_model to false first and see if the problem disappears - it usually does, because you've switched to the code path that's actually doing something principled.

CategoryEric's Nodes/AI Enhancement

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
presetCOMBOrestorationProcessing preset: • restoration: Balanced restoration for general images • denoising: Strong denoising with detail preservation • sharpening: Detail enhancement and sharpening • high_quality: High-quality processing (requires more VRAM)
domain_blendFLOAT0.50–1Blend between spatial and frequency domain processing: • 0.0: Frequency domain only • 0.5: Balanced blend • 1.0: Spatial domain only
sharpening_strengthoptFLOAT0.40–1Sharpening strength for detail enhancement
bilateral_sigmaoptFLOAT7510–150Bilateral filter sigma for noise reduction
use_modeloptBOOLEANtrueUse neural network model if available: • True: Use SFHformer model • False: Use fallback dual-domain processing

Outputs (2)

NameTypeDescription
enhanced_imageIMAGE
processing_infoSTRING