CreateInstanceDiffusionTracking
Per-object prompts via bounding boxes
- tracking
- prompt
- width
- height
- bbox_width
- bbox_height
Regional prompting - giving different areas of an image different prompts - usually means drawing rough masks and hoping the model respects the boundary. InstanceDiffusion is a more surgical version of the same idea: instead of a soft mask, you give it an exact bounding box, a class label, and a prompt for that specific instance. This node is how you build one of those box-and-prompt entries inside ComfyUI, for use with logtd's ComfyUI-InstanceDiffusion - a separate, third-party node pack this one is explicitly built to feed.
The format, straight from the node
The node's own description spells out exactly how InstanceDiffusion expects instance data to look: "class_id.class_name": "prompt", for example "1.head": "((head))". This node builds one of those entries: you're telling it which box on the canvas, what class it belongs to, and what prompt should apply only inside that box.
The inputs that matter
coordinates(STRING, required) - the box/track coordinates, in InstanceDiffusion's own coordinate syntax. This node doesn't validate the format for you - get the syntax wrong and the failure shows up downstream, in the actual InstanceDiffusion sampler node, not here.width/height(default512) - the canvas dimensions this box is defined against.bbox_width/bbox_height(default512) - the size of this specific instance's box.class_name(default"class_name") andclass_id(default0) - together these form the key half of the"class_id.class_name"pair. They need to match exactly what your prompt keys expect downstream.prompt(multiline STRING) - the text that applies only to this instance's box.- Optional
size_multiplier(FLOAT, default[1]- accepts a list, which suggests per-frame scaling for video use) andfit_in_frame(defaulttrue, clamps the box so it can't extend past canvas bounds).
Outputs: tracking (the TRACKING object you wire onward), plus prompt, width, height, bbox_width, bbox_height passed straight through - convenient for feeding the same numbers into other nodes downstream, or keeping multiple Create/Append nodes in a chain agreeing on canvas size without retyping values.
How to install it
The KJNodes half via ComfyUI Manager (search KJNodes for ComfyUI) or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt
But this node alone does nothing useful - the TRACKING output only means something once it reaches an actual InstanceDiffusion sampling node. You need logtd/ComfyUI-InstanceDiffusion installed alongside KJNodes for any of this to render anything.
Common issues & troubleshooting
This is a deep-cut integration, not a mainstream one. A quick check of real community discussion around InstanceDiffusion in ComfyUI shows a short cluster of activity in early 2024 and essentially nothing since - it's a real, working integration, but not one with an active current community you can lean on if something breaks. Expect to read the linked repos directly rather than find a fresh thread with your exact error.
Nothing shows up in the render, no error anywhere. Check that class_id and class_name here match a key your prompt actually references downstream - a mismatched class key is a silent no-op, not a crash, because this node doesn't cross-validate against anything else in your graph.
Multiple instances aren't combining. This node only creates one tracking entry. You need AppendInstanceDiffusionTracking to merge two of them together, chained if you have more than two subjects.
You just want regional prompting, not per-object detection-style control. This is the fiddlier, more surgical tool. If a soft mask per region is enough, this pack's ConditioningSetMaskAndCombine family is the more common, lower-effort path to the same broad goal.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| coordinates | STRING | — | |
| width | INT | 51216–4096 | — |
| height | INT | 51216–4096 | — |
| bbox_width | INT | 51216–4096 | — |
| bbox_height | INT | 51216–4096 | — |
| class_name | STRING | class_name | — |
| class_id | INT | 00–255 | — |
| prompt | STRING | prompt | — |
| size_multiplieropt | FLOAT | 1 | — |
| fit_in_frameopt | BOOLEAN | true | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| tracking | TRACKING | — |
| prompt | STRING | — |
| width | INT | — |
| height | INT | — |
| bbox_width | INT | — |
| bbox_height | INT | — |