ComfyUI Node

EFDM

The multi-style, tweakable workhorse of StyleTransferPlus

By FuouM·Created 2 years ago·Updated about a year ago· 15
EFDM
  • src_img
  • style_img
  • res_img
style_interp_weights
model_archefdm
style_strength1.00
do_cropfalse
preserve_colorfalse
size512
use_cpufalse

EFDM ("Exact Feature Distribution Matching", CVPR 2022) is the pack's most configurable node, and for a lot of people it ends up being the favorite. Where the older CAST gives you one dropdown, EFDM gives you five model architectures, a strength slider, multi-style blending, color preservation, and a CPU fallback. It's fast, it scales to genuinely high resolutions, and it's the closest thing this pack has to a Swiss Army knife.

The idea: most style transfer normalizes content features so their mean and standard deviation match the style's (that's AdaIN). EFDM's claim to fame is that it matches the entire feature distribution instead - it sorts the content and style feature values and swaps them, so the output keeps the style's full histogram, not just its average and spread. In practice that means stronger, more faithful texture transfer than AdaIN with less structural mush.

Inputs that matter

  • src_img / style_img - content and style.
  • model_arch - dropdown of adain, adamean, adastd, efdm (default), hm (histogram matching). The first three are the classic statistics-matching baselines from the AdaIN family; efdm and hm are the newer, stronger distribution-matching methods. Default efdm is a fine starting point.
  • style_strength - 0.0 to 1.0, default 1.0. How hard the style is applied. This is your main dial.
  • style_interp_weights - comma-separated weights for multiple styles (e.g. 0.7,0.3 for two styles). Weights are normalized automatically; empty string = equal weights. Feed several style images in a batch on style_img and this blends between them.
  • preserve_color - keep the content's colors, transfer only texture. Great when you like a painting's strokes but not its palette.
  • size - height after resizing (content keeps aspect, styles get squished to match). Higher = better, more VRAM. The author says tested at size=2048 on a 12 GB card.
  • do_crop - resize-then-center-crop to square.
  • use_cpu - CPU fallback for OOM situations. Warning: slow, ~21 seconds per the default workflow. It's a lifeline, not a preference.

Output is res_img (IMAGE) → Preview/Save.

Install

Same pack install as always:

cd ComfyUI/custom_nodes
git clone https://github.com/FuouM/ComfyUI-StyleTransferPlus

or via ComfyUI Manager (search ComfyUI-StyleTransferPlus), restart. Two model files:

ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/hm_decoder_iter_160000.pth
ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/vgg_normalised.pth

The decoder comes from the EFDM repo (ArbitraryStyleTransfer/models), and vgg_normalised.pth is the same shared file used by CAST and TSSAT - download it once. Dependencies are the pack's standard torch, torchvision, scikit-image, einops.

Common issues

  • OOM at high size - drop size, or tick use_cpu and go make tea. size=2048 on 12 GB is the stated ceiling.
  • Multiple styles look unbalanced - that's what style_interp_weights is for; empty string means equal.
  • Colors bleeding in - preserve_color fixes exactly this.

If you want one node in this pack to actually experiment with, EFDM is it. CAST is simpler, AesFA is newer, but EFDM gives you knobs that change the result in ways you'll feel.

CategoryStyleTransferPlus

Inputs (9)

NameTypeDefaultDescription
src_imgIMAGE
style_imgIMAGE
style_interp_weightsSTRING
model_archCOMBOefdm5 options: adain, adamean, adastd, efdm, hm
style_strengthFLOAT1.000–1
do_cropBOOLEANfalse
preserve_colorBOOLEANfalse
sizeINT512
use_cpuBOOLEANfalse

Outputs (1)

NameTypeDescription
res_imgIMAGE