Gemini Detect
Object detection that names what it finds
- image
- client
- regions
Here's the node that does something the rest of the pack can't: open-vocabulary object detection. Tell it "red car" and it finds the red car; tell it nothing and it finds everything prominent. Each detection comes back as a bounding-box region on an ERPK_REGIONS output that plugs straight into the pack's Regional Prompt Builder - which is how you get "put the hat on the man" layouts instead of "add a hat somewhere in the frame."
The mechanism is a vision call: the image goes to Gemini (default gemini-3.5-flash), which returns normalized box coordinates plus labels, and the node packages them into the pack's region format. No YOLO weights, no SAM download - just an API call that understands arbitrary nouns.
Inputs
- image - required tensor to scan.
- objects - the list, one per line (e.g.
red car). Empty = detect all prominent objects. - model - default
gemini-3.5-flash; other Gemini text/vision models available. - temperature - 0.0 default. The tooltip says it all: lower = more deterministic detection. Leave it at zero unless detections are being too rigid.
- max_objects - cap on regions returned, default 20 (1–100). If a scene has clutter and you only care about three things, list them in
objectsinstead of raising this. - seed - reproducibility, -1 randomizes.
- client - optional; key from Settings if unconnected.
Output: one regions value (ERPK_REGIONS) - wire it into the Regional Prompt Builder's regions input. From there each region becomes an editable canvas box with a prompt line.
Install and gotchas
Part of the ERPK Collection:
cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk && pip install -r requirements.txt
Restart (or ComfyUI Manager → search erpk), add a Google AI Studio key in Settings > ERPK > API Keys. Paid per detection call; Flash is cheap.
The recurring confusion is expecting a fixed set of classes like classic detectors - this is the opposite, and that's the feature. It'll happily find "the thing with the stripe" if you ask. The other gotcha is max_objects: at 20 with an empty objects field, a busy image gets 20 regions, and a Regional Prompt Builder canvas that crowded is a mess to read. Be specific in objects first, and treat max_objects as a safety valve, not a target.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image to detect objects in (ComfyUI tensor) | |
| objects | STRING | Objects to detect, one per line (e.g. 'red car'). Leave empty to detect all prominent objects. | |
| seed | INT | -1-1–2147483647 | Seed for reproducible detection. Randomizes by default. |
| clientopt | GEMINI_API_CLIENT | Gemini API client from Gemini API Config node (optional if API key is configured in Settings) | |
| modelopt | COMBO | gemini-3.5-flash | Gemini model to use for detection |
| temperatureopt | FLOAT | 0.000–2 | Lower = more deterministic detection |
| max_objectsopt | INT | 201–100 | Maximum number of regions to return |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| regions | ERPK_REGIONS | Detected regions as JSON for the Regional Prompt Builder's regions input. |