BBox Filter
The boring filter that keeps detector output usable
- bboxes
- filtered_bboxes
The drain strainer for bounding boxes
Detectors are indiscriminate. Run Imgutils Generic Detector over a busy image and you'll get boxes you don't want: a hand detection at 0.4 confidence, a face the size of a pinhead, or a "censor" hit on a red cloth. BBox Filter is the strainer between the detector and whatever you're feeding - it drops boxes by area, confidence, and label, and passes the survivors through. It's a glue node, not a headline one, but it's the difference between a pipeline that sometimes does something dumb and one that does what you told it.
How it works
Nothing clever, which is a compliment. Every box in the incoming BBOX list gets three checks:
min_area- area is(x1 - x0) * (y1 - y0)in pixels. Boxes smaller than this are dropped. This is your "ignore specks" dial.min_confidence- boxes below the confidence floor are dropped.labels- a comma-separated list. Withinclude_labels = trueonly the listed labels survive; flip it to false and the listed labels are the ones excluded.
Where do you get the labels? The pack's README is explicit: read them off the image_with_boxes output of Imgutils Generic Detector, where every drawn box is tagged with its label. That's the reliable source, because the label strings come from the model and you don't want to guess their spelling.
The two inputs that matter
labels- leave empty to keep everything, comma-separate to filter. Most people live here.min_confidence- the one you'll actually tune. Detector confidence defaults are optimistic; a floor of 0.5–0.6 fixes most "why is it detecting garbage" complaints.
bboxes is the only required input (the BBOX output of a detector or Mask to BBox), and the output is filtered_bboxes, same type, ready to wire into SAM Predictor or whatever consumes boxes.
Install
Part of LK-168/comfyui_imgutils. ComfyUI Manager → search "comfyui_imgutils", or:
cd ComfyUI/custom_nodes
git clone https://github.com/LK-168/comfyui_imgutils
Restart ComfyUI. No models involved - it only rearranges box metadata. The detector feeding it handles the model downloads (into $HF_HOME, set the env var per the README).
Common issues
- Empty result and you expected boxes. Either
min_areais too high,min_confidencetoo strict, or your labels don't match what the detector actually draws. Print the annotated image and check the exact labels first - that's the documented way and it ends most debugging sessions. - "Skipping non-BBOX object" warnings in the console. This filter expects this pack's own box format. Feeding it raw values from a different pack's detector may produce warnings as it silently drops entries.
It's not exciting, but once you've got a detector in a workflow, this is the node that stops you from trusting it blindly. Cheap insurance, one wire.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| bboxes | BBOX | — | |
| labels | STRING | Comma-separated list of labels to filter by. Leave empty to keep all labels. | |
| include_labels | BOOLEAN | true | If True, only keep bounding boxes with specified labels. If False, exclude these labels. |
| min_area | FLOAT | 00–1000000 | Minimum area of bounding boxes to keep |
| min_confidence | FLOAT | 0.000–1 | Minimum confidence of bounding boxes to keep |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filtered_bboxes | BBOX | — |