ComfyUI Node

UniST

The square-only style transfer node with the video twin

By FuouM·Created 2 years ago·Updated about a year ago· 15
UniST
  • src_img
  • style_img
  • out_img
do_cropfalse
size512

UniST ("Two Birds, One Stone", ICCV 2023) is the transformer-based entry in ComfyUI-StyleTransferPlus, and its claim to fame is that the same model handles both images and video - which is why it ships as a pair of nodes in this pack. It's non-diffusion arbitrary style transfer like the rest, but with a genuinely different architecture: a transformer that learns to fuse content and style, trained jointly for image and video with a temporal-consistency loss so frames don't flicker.

The catch, and it's stated plainly in the README: the model only works with square images. Everything gets resized to size×size. do_crop gives you the nicer option - resize the height, then center-crop to a square - instead of squishing non-square content. If you're feeding a landscape shot, crop or letterbox it upstream unless you want distortion.

Speed-wise it's "medium": slower than CAST and EFDM, faster than the optimization-based nodes. Where it shines is quality with structure preservation - transformer-based methods tend to keep content semantics better than pure statistics matching, which is the trade you're making for the square-only constraint.

Inputs and outputs

  • src_img / style_img - content and style.
  • size - square edge length (default 512).
  • do_crop - resize-then-center-crop to square.

Output: out_img (IMAGE) → Preview/Save. Feed it a single content image and a single style image for the plain use case. For actual videos, don't use this node - use its sibling.

Install

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

or ComfyUI Manager → search ComfyUI-StyleTransferPlus → install → restart.

Three model files, all from the UniST repo (the .pt from Testing, the two .pth from Training):

ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/unist/UniST_model.pt
ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/unist/dec_r41.pth
ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/unist/vgg_r41.pth

All three are required - the encoder and decoder weights plus the main checkpoint. Same file set powers both UniST nodes. Dependencies: torch, torchvision, scikit-image, einops.

Common issues

  • Distorted non-square output - expected. do_crop is your friend; better yet, crop upstream.
  • Load error - one of the three files is missing or not in models/unist/. The UniST_model.pt name matters, don't rename it.
  • Trying to use it on video - wrong node. If your src_img is actually a batch of frames, use UniST Video, which handles the temporal batching properly.

Why there's a video twin

The model's video training uses groups of 3 consecutive frames, and the video node replicates that: it slices your frame batch into threes so the temporal-consistency machinery actually engages. You can feed batched frames into this image node and it'll process them one at a time, but each frame is then stylized in isolation - no temporal coherence, and you'll see flicker. If video is the goal, go straight to UniST Video.

CategoryStyleTransferPlus

Inputs (4)

NameTypeDefaultDescription
src_imgIMAGE
style_imgIMAGE
do_cropBOOLEANfalse
sizeINT512

Outputs (1)

NameTypeDescription
out_imgIMAGE