ComfyUI Node

Neural Neighbor

The slow, gorgeous, no-download style transfer node

By FuouM·Created 2 years ago·Updated about a year ago· 15
Neural Neighbor
  • src_img
  • style_img
  • res_img
size512
scale_longtrue
flipfalse
content_lossfalse
colorizetrue
content_weight0.75
max_iter200

Neural Neighbor is the slowest node in ComfyUI-StyleTransferPlus - the README tags it "2020-2022, Slowest" - and it's also the one that needs no model download at all, which makes it the easiest to get running and the hardest to wait for. It's the old-school version of style transfer: instead of a trained feed-forward network, it optimizes an output image to match the style, pixel-by-pixel over hundreds of iterations. Think of it as style transfer the way it was done before anyone made it fast.

The mechanism is where the "neural neighbor" name comes from. The algorithm works on an image pyramid (4 scaling levels at size=512, 5 at size=1024). At each level it compares patches of the output to patches of the style image in VGG feature space, finds each patch's nearest neighbor in the style, and nudges the output toward those matches - then upsamples and repeats. The result has a signature look: strongly textured, detail-faithful stylization that a lot of people find more "painterly" than the fast methods. It uses a bundled VGG16 with no external weights, hence the zero downloads.

Inputs that matter

  • src_img / style_img - content and style.
  • size - 512 or 1024. 512 is the sane default; 1024 costs 6–12 GB of VRAM and much longer runtimes.
  • max_iter - iterations per pyramid level (default 200). Total = max_iter × number of levels. More = better and sharper, linearly slower.
  • content_weight - 1.0 = maximum content preservation, 0.0 = maximum stylization (default 0.75). This is your main quality dial.
  • content_loss - an experimental extra content loss. Off by default because it has drawbacks, but it fixes the classic failure mode: colors shifting within an object, producing visible artifacts. Nice bonus: with it on, content_weight can usually go to 0.0 and content stays recognizable.
  • scale_long - scale by the longest side (True) or shortest side (False) to reach size.
  • flip - augments the style with rotations. Better content preservation, slower and more memory-hungry, slightly weaker stylization. Leave off unless content is breaking apart.
  • colorize - color correction on the result (default True). Keep it on.

Output: res_img (IMAGE) → Preview/Save.

Install

Simplest node in the pack to set up:

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

or ComfyUI Manager → search ComfyUI-StyleTransferPlus → restart. That's it - no model files, no Google Drive, nothing. Dependencies are the pack's standard torch, torchvision, scikit-image, einops.

Common issues

  • It's just slow - that's the method. Start at size=512, low max_iter (like 100), and only crank up once the result looks right.
  • Color shifts/artifacts within objects - enable content_loss, which is exactly what it's for.
  • OOM at size=1024 - needs 6–12 GB VRAM by design. If you're below that, stay at 512.

This is the node you reach for when you want the best-looking result and have time to burn - or when you want to show off that a node can run with zero model downloads. Just don't put it on a video, and don't expect it to be patient.

CategoryStyleTransferPlus

Inputs (9)

NameTypeDefaultDescription
src_imgIMAGE
style_imgIMAGE
sizeCOMBO5122 options: 512, 1024
scale_longBOOLEANtrue
flipBOOLEANfalse
content_lossBOOLEANfalse
colorizeBOOLEANtrue
content_weightFLOAT0.750.01–1
max_iterINT200

Outputs (1)

NameTypeDescription
res_imgIMAGE