Nodes/ComfyUI_RopeWrapper/RopeWrapper_DetectNode
ComfyUI Node

RopeWrapper_DetectNode

Find the faces first — everything else depends on this pass

By fssorc·Created 2 years ago·Updated 2 years ago· 26
RopeWrapper_DetectNode
  • models
  • input_image
  • humanCount
  • DETECTRESULT
  • foundFaces
SimilarityThreshold70
detection_threshold0.50

Every RopeWrapper swap starts with this node, and the README says so bluntly: execute the FindFace section first. RopeWrapper_DetectNode runs RetinaFace over every frame of your video, then uses ArcFace embeddings to figure out which of those detections are the same person across frames. The output is the map the SwapNode lives on - it tells the swapper where each face is, in every frame, and which identity each one belongs to.

Detection is also the slow, fiddly part of the whole pipeline. It's the reason this pack ships a save/load pair: run this once, save the result, and stop paying for it.

The inputs

Only three, which is nice:

  • models - the ROPE_MODEL output from LoadModels. Notably it does not need the vm, unlike the swap nodes.
  • SimilarityThreshold (default 70) - how strict the identity matching is, on a 0–100 scale. The node compares ArcFace embeddings using a cosine-distance-derived similarity score. Raise it and similar-looking faces get treated as different people; lower it and minor variations merge into one identity. This is the knob the README tells you to adjust to "differentiate between different identities."
  • detection_threshold (default 0.5) - how confident the detector must be before a region counts as a face. Lower it to catch more faces (smaller ones, side angles, partial occlusion); raise it to cut false positives.

What comes out

Three outputs:

  • DETECTRESULT - the goods: a per-frame list of detections, each tagged with the identity index it matched, plus the total face count. This wires into the SwapNode's detectResult input, and into SaveSwapInfo if you want to cache it.
  • humanCount (INT) - the number of unique identities found across the whole video. Wire it to a Display Int node to sanity-check that detection found who you expected.
  • foundFaces (IMAGE) - one crop per unique identity, in discovery order. Preview this to confirm the detector caught the right people. The order matters: identity index 0, 1, 2… is exactly the numbering you use in the SwapNode's source_target_matching field.

How the mechanism works

Frame by frame, the node detects up to 50 faces, computes an ArcFace embedding for each, and compares against a running list of identities it has built up. Match → the frame's detection is tagged with that identity's index. No match → a new identity is created. Since the identity list persists across the whole video, a face that shows up in frame 5 and again in frame 300 gets the same index - that persistence is what makes the swap stable over time.

The catch, and it's a real one: a new face that appears mid-video gets a new index, which shifts the meaning of every number after it in source_target_matching. And the node doesn't carry settings between runs - change any threshold and you re-run it, by design.

Install

Same as the whole pack - ComfyUI Manager → search "ComfyUI_RopeWrapper", or:

cd ComfyUI/custom_nodes
git clone https://github.com/fssorc/ComfyUI_RopeWrapper

Restart, install ComfyUI-VideoHelperSuite and ComfyUI-KJNodes, and make sure det_10g.onnx and w600k_r50.onnx are in the plugin's models/ folder before you queue. Detection runs on CUDA with CPU fallback, so on a GPU-less box this is the pass you'll feel.

CategoryRopeWrapper

Inputs (4)

NameTypeDefaultDescription
modelsROPE_MODEL
input_imageIMAGE
SimilarityThresholdFLOAT700–100
detection_thresholdFLOAT0.500–1

Outputs (3)

NameTypeDescription
humanCountINT
DETECTRESULTDETECTRESULT
foundFacesIMAGE