Nodes/ComfyUI Batch BBox Detector/BBox Detector (Batch Chunked)
ComfyUI Node

BBox Detector (Batch Chunked)

The bbox node you actually want for 300+ frames

By rslosh·Created 11 months ago·Updated 5 months ago· 1
BBox Detector (Batch Chunked)
  • bbox_detector
  • images
  • images
  • masks
threshold0.50
dilation4
chunk_size32

BBox Detector (Batch Chunked) is the node the README points a star at, and for once the README is right. It does everything BboxDetectorBatch does, but it slices the work into chunks and clears the CUDA cache between them, so a 600-frame video that would have died in a torch.cuda.OutOfMemoryError mid-batch actually finishes. If your input is a long frame sequence, this is the one to reach for - the pack is explicitly built around "300+ frames" being the normal case.

The mechanism is simple and effective: split the batch into chunks of chunk_size frames, detect each frame within the chunk (same detect_combined(threshold, dilation) call the ImpactPack combined node uses), collect the results, then call torch.cuda.empty_cache() before the next chunk. It also prints progress as it goes, so you get "Processing chunk 3/20 (frames 64–96)…" in the console instead of an hour of silence. Per-frame error handling is the same as the standard batch node: a bad frame yields an empty mask and the original image, and processing continues instead of killing the run.

Inputs are the batch node's plus one:

  • bbox_detector - the ImpactPack BBOX_DETECTOR object from UltralyticsDetectorProvider.
  • images - the [B, H, W, C] batch.
  • threshold (default 0.5) and dilation (default 4) - same semantics as the standard node.
  • chunk_size (1–128, default 32) - frames processed before the cache clears. This is your VRAM dial.

Outputs: images and masks ([B, H, W]), stacked back into full-batch tensors in the original frame order.

The chunk_size tradeoff is the whole game, and the README's guidance maps cleanly onto VRAM tiers: 8–16 for an 8GB card, 16–32 for 12GB, 32–64 for 24GB+. Smaller chunks = safer but slower; bigger chunks = faster but memory-hungry. It's the single knob you'll tune when things break.

Installation is the full pipeline: ComfyUI Manager → search "Batch BBox Detector" for the pack, Impact Pack for the BBOX_DETECTOR type, Impact Subpack (separate, since Impact Pack v8.0) for UltralyticsDetectorProvider, and a YOLO model - the shared Bingsu/adetailer weights work. Or clone manually:

cd ComfyUI/custom_nodes && git clone https://github.com/rslosch/comfyui-nodesweet

If you hit CUDA out of memory, the README's fix list is genuinely useful: drop chunk_size to 8 or 16, lower input resolution, close other GPU apps, and - the perennial ComfyUI truth - remember that shuffling between VRAM and system RAM is brutally slow, so fitting the work into VRAM beats offloading it. And if all your masks come out black, that's a threshold problem (try 0.3–0.4) or a missing/broken detector model, not a chunking problem.

One fair complaint: this node clears the cache but doesn't free your intermediate tensors aggressively, so on very long videos the mask list still grows in RAM. For a 1000-frame 1080p job, budget system RAM too - that's a known edge, not a hidden feature.

Categorynodesweet-hellorob

Inputs (5)

NameTypeDefaultDescription
bbox_detectorBBOX_DETECTOR
imagesIMAGE
thresholdFLOAT0.500–1
dilationINT4-512–512
chunk_sizeINT321–128

Outputs (2)

NameTypeDescription
imagesIMAGE
masksMASK