Nodes/KJNodes for ComfyUI/DrawInstanceDiffusionTracking
ComfyUI Node Runs on cloud

DrawInstanceDiffusionTracking

Check your tracking data before you trust it

By kijai·Created 3 years ago·Updated about 18 hours ago· 2,930
DrawInstanceDiffusionTracking
  • image
  • tracking
  • image
box_line_width2
draw_texttrue
font
font_size20

KJNodes is Kijai's junk drawer - a hundred-plus nodes covering whatever problem he ran into that week, with no unifying theme and dependencies kept deliberately light. Tucked inside it is a small, self-contained corner for InstanceDiffusion: a 2024-era technique for object-level control where instead of one prompt describing everything, you give the model per-object bounding boxes (or masks) and a track of how each one moves across frames. It's GLIGEN's box-based idea extended into video. DrawInstanceDiffusionTracking is the sanity-check node in that chain - it doesn't touch your generation at all, it just draws the tracking boxes onto your frames so you can see what CreateInstanceDiffusionTracking actually produced before you spend a full sampling run trusting it blindly.

That matters more than it sounds like. Tracking data is easy to get subtly wrong - an off-by-one frame offset, a box that never updates, coordinates in the wrong space - and none of that throws an error. It just quietly makes your instance conditioning useless. This node turns an invisible data structure into something you can eyeball.

How it works

Feed it your image batch and the tracking object from CreateInstanceDiffusionTracking, and it draws a rectangle (plus an optional label) on every frame for every tracked instance, using the box coordinates and any text associated with that track. You get back the same image batch, now burned-in with visible boxes - a preview, not a conditioning signal.

The inputs and outputs that matter

  • image and tracking - your frames and the tracking data you're auditing. This is the whole point of the node; get these two right and everything else is cosmetic.
  • box_line_width (default 2, 1–10) - how thick the drawn rectangles are.
  • draw_text (default true) - whether track labels get rendered alongside the boxes; turn it off if the text is cluttering a busy frame.
  • font and font_size (default 20) - three bundled fonts (FreeMono.ttf, FreeMonoBoldOblique.otf, TTNorms-Black.otf) for the labels.

Output is a single image - wire it straight into a Preview Image or Save Image node, nothing downstream needs it.

How to install it

Easiest path is ComfyUI Manager: search "KJNodes for ComfyUI" and install. Manually:

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

then restart. The author keeps the dependency list minimal on purpose, so this doesn't fight you the way a wrapper pack full of custom CUDA kernels can.

Common issues & troubleshooting

Nothing draws, or boxes are all in the wrong place. The bug is almost never in this node - it's in the tracking data feeding it. Trace back to CreateInstanceDiffusionTracking and check the coordinate space and frame count line up with your actual image batch.

You can't find good documentation for any of this. That's honest, not a knock - Kijai's own README says documentation lives "mostly in the node descriptions and tooltips," and InstanceDiffusion is one of the older, more niche corners of the pack. It predates the video-control approaches (VACE for Wan, IC-LoRA control adapters for LTX) that most workflows lean on today, so don't expect a wave of fresh tutorials; expect to read the tooltip and the upstream node's output shape carefully.

Treat it as disposable. Once your tracking data checks out, this node has done its job - you don't need it in the final graph, it's a debugging step you can bypass or delete once you trust what's upstream of it.

CategoryKJNodes/InstanceDiffusion

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
trackingTRACKING
box_line_widthINT21–10
draw_textBOOLEANtrue
fontCOMBO3 options: FreeMono.ttf, FreeMonoBoldOblique.otf, TTNorms-Black.otf
font_sizeINT20

Outputs (1)

NameTypeDescription
imageIMAGE