HF Image Object Detection
DETR boxes and labels from the HF cloud
- image
- STRING
If you want to know where things are in an image - not just "there's a person" but "the person is in this box at this confidence" - that's object detection, and this node gets it done without a single local weight. HF Image Object Detection is the bitaffinity/ComfyUI_HF_Inference pack's wrapper around Hugging Face's hosted DETR models: you type a model ID, feed it an image, and get back a list of detected objects with bounding boxes.
How it works
The node has two inputs:
endpoint(STRING) - the model ID, likefacebook/detr-resnet-50(the README's pick), or a full URL.image(IMAGE) - the image you want inspected.
It POSTs the image to https://api-inference.huggingface.co/models/{endpoint}, and Hugging Face's server responds with JSON - a list of detections, each with a label, a score, and a box of {xmin, ymin, xmax, ymax} pixel coordinates. The result is dumped into a text panel on the node, and there's a STRING output socket you can route to a text display node if you want it somewhere else.
That's the whole node, and it's worth being blunt about what that means: you get text, not geometry you can act on. There's no mask, no overlay, no crop. If you want to do something with those boxes - crop to the detected person, count people across a batch - you'll need a JSON-parse node and some plumbing downstream to turn the coordinates into crops. Fine for inspection and counting, work for automation.
The catch you need to know about
This is the sibling of the Classification node, and it shares the same flaw: the image tensor is passed straight to the HTTP client as the request body. The Segmentation node in this pack carefully converts its tensor to PNG bytes first; this one doesn't. A normal batched IMAGE tensor makes requests throw RuntimeError: Boolean value of Tensor with more than one element is ambiguous. So as shipped, expect to patch the serialization (copy the PNG-encode approach from Segmentation) before detections come back. Zero impressions on comfy.icu suggests almost nobody has bothered.
Installing it
The whole pack installs the same way, and it's about as light as ComfyUI custom nodes get - the only dependency is requests:
git clone https://github.com/bitaffinity/ComfyUI_HF_Inference custom_nodes/ComfyUI_HF_Inference
cd custom_nodes/ComfyUI_HF_Inference
pip install -r requirements.txt
Restart ComfyUI (or search "ComfyUI_HF_Inference" in ComfyUI Manager). Then set a Hugging Face token - free is fine - as an environment variable:
HF_AUTH_TOKEN=hf_yourtokenhere python main.py
What to expect
You're on Hugging Face's serverless tier, which the README openly says only supports models 10GB and under and "fails for random reasons on different models." Cold starts mean the first request can hang for a minute or two while HF boots the container; the pack reads the reported estimated_time, waits, and retries once, so it usually recovers on its own. DETR at this size is a solid, well-trodden detector - once the serialization is fixed, the results are the reliable part. Getting them out of a text string and into your graph is the part nobody's built for you.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| endpoint | STRING | — | |
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |