Nodes/ComfyUI-YOLO/Ultralytics Inference
ComfyUI Node

Ultralytics Inference

The node that actually runs the detector

By kadirnar·Created 2 years ago·Updated 7 months ago· 121
Ultralytics Inference
  • model
  • image
  • ULTRALYTICS_RESULTS
  • IMAGE
  • BOXES
  • MASKS
  • PROBABILITIES
  • KEYPOINTS
  • OBB
  • LABELS
  • MASK
conf0.25
iou0.70
height640
width640
device
halffalse
augmentfalse
agnostic_nmsfalse
classesNone

The whole pack revolves around this one. Feed it a model from either loader plus an image, and it runs Ultralytics' predict() and dumps out nine outputs - detections, masks, keypoints, labels, the works. Everything else in the pack is either loading a model, drawing on the result, or converting it to some other format. This is the engine.

Two required inputs: model (the ULTRALYTICS_MODEL from a loader) and image. The optional inputs are where the real control lives, and only three matter on day one:

  • conf (0.25): the confidence threshold. Lower it to catch more objects at the cost of false positives; raise it if you're drowning in garbage detections.
  • iou (0.7): how much overlap boxes may have before non-max suppression merges them. Leave it alone unless boxes are duplicating.
  • height / width (640 each): inference resolution. The image gets resized to this square before detection. 640 is the YOLO sweet spot.

device (cuda:0 or cpu) picks the compute target, half runs fp16 (can crash on GPUs that don't support it), augment enables test-time augmentation (slower, slightly better recall), agnostic_nms suppresses boxes across classes, and classes is a comma-separated list of class indices - not names, which is where CocoToNumber comes in handy.

The nine outputs, and the honest version of what each is:

  • ULTRALYTICS_RESULTS - the raw Ultralytics result object. Feed it to UltralyticsVisualization or BBoxToCoco.
  • IMAGE - the original image, passed through untouched. Handy passthrough so you don't need a separate copy.
  • BOXES - YOLO-format boxes: x, y, width, height, where x/y is the center of the box. That trips people up later; BBoxToXYWH exists to fix it.
  • LABELS - the class index for each detection, not the name.
  • MASK - a ComfyUI-ready tensor of rectangle masks built from the boxes. This is what you feed to a mask node or an inpaint.
  • MASKS - the raw Ultralytics segmentation masks object; mostly useful for visualization, and None for a plain detector.
  • PROBABILITIES, KEYPOINTS, OBB - classification probs, pose keypoints and oriented boxes, populated only when your model produces them.

Install is the pack's shared story: ComfyUI Manager, search "ComfyUI-YOLO", or git clone https://github.com/kadirnar/ComfyUI-YOLO into custom_nodes, restart, and let Manager install ultralytics>=8.2.27. (The README's custom/nodes path is a typo.) First inference on a fresh model pays a one-time download.

Where people get burned: forgetting the 640×640 resize means small images get upscaled into the detector, which is fine but eats VRAM; feeding class names into classes instead of indices (the field wants "0", not "person"); and expecting MASKS to be a tensor you can plug into a Comfy mask node - that's MASK. Start with a plain yolov8s at conf 0.25 and it's remarkably hard to get wrong.

CategoryUltralytics/Inference

Inputs (11)

NameTypeDefaultDescription
modelULTRALYTICS_MODEL
imageIMAGE
confoptFLOAT0.250–1
iouoptFLOAT0.700–1
heightoptINT64064–1280
widthoptINT64064–1280
deviceoptCOMBO2 options: cuda:0, cpu
halfoptBOOLEANfalse
augmentoptBOOLEANfalse
agnostic_nmsoptBOOLEANfalse
classesoptSTRINGNone

Outputs (9)

NameTypeDescription
ULTRALYTICS_RESULTSULTRALYTICS_RESULTS
IMAGEIMAGE
BOXESBOXES
MASKSMASKS
PROBABILITIESPROBABILITIES
KEYPOINTSKEYPOINTS
OBBOBB
LABELSLABELS
MASKMASK