# detect

A RocketRide image node that detects objects in each input frame and emits labeled bounding boxes plus an annotated image. Choose it when downstream work needs object locations; use Segmentation when it needs pixel masks instead.

## About RF-DETR and MM-Grounding-DINO

RF-DETR and MM-Grounding-DINO are the two detection backends exposed by this node. RF-DETR is the default common-object profile, while MM-Grounding-DINO is the prompt-driven open-vocabulary profile; the node supplies the selected backend, threshold, prompt, and optional revision to its detector.

## What it does

The node buffers each completed image stream, runs the selected detector, and can emit the detections as JSON and a JPEG annotated with boxes and labels. RF-DETR detects the configured profile's common-object class set; MM-Grounding-DINO lets the prompt define the desired objects or attributes. Choose it as a per-frame gate or whenever location, confidence, and centroid data matter, rather than choosing Caption for a prose description or Segmentation for masks.

## Lanes

| Lane in | Lane out | Description |
| --- | --- | --- |
| `image` | `image` | JPEG copy of the source image annotated with detection boxes and labels. |
| `image` | `text` | JSON array of detections with `label`, `score`, `box`, and `centroid`. |

## Profiles

Default: **RF-DETR — Common Objects (COCO, 80 classes, default)** (`rfdetr`).

| Profile | Backend | Use |
| --- | --- | --- |
| RF-DETR — Common Objects (COCO, 80 classes, default) **(default)** | `rfdetr` | Closed-set common-object detection. |
| MM-Grounding-DINO — Open-Vocabulary (any prompt) | `mmgdino` | Prompt-driven open-vocabulary detection. |

## Configuration

Start with the RF-DETR profile for the provided common-object detector. Switch to MM-Grounding-DINO when the sought object must be expressed in a prompt, then set a threshold to control which matched regions reach downstream nodes.

### Model

The RF-DETR profile is the default and supplies the `rfdetr` engine. The MM-Grounding-DINO profile supplies the `mmgdino` engine and makes the detection prompt visible in the configuration panel. If the runtime receives an unrecognized engine value, it logs a warning and uses its default backend instead; use one of the supplied profiles to avoid silently falling back.

### Detection prompt

This field is required for the prompt-driven MM-Grounding-DINO backend: startup fails when that backend has no non-empty prompt. It accepts period- or comma-separated terms, such as `person . car . dog`; the runtime splits either separator into the classes it passes to the detector. Use it to name objects or describe attributes such as `red car` or `person in a hat`. The field description explicitly warns that spatial relationships are not supported, so a prompt such as `the car on the left` can return all cars rather than only the left one.

### Confidence threshold

The threshold is a `0.0`–`1.0` minimum confidence for including a detection, with `0.3` as the default in both supplied profiles. Raise it when low-confidence boxes are creating noisy downstream work; lower it when missed candidates matter more than precision. If the runtime receives a non-numeric or out-of-range value, it logs a warning and uses its detector default threshold.

## Requirements

With a model server configured, detection runs there. Otherwise it runs locally on CPU, Apple Silicon (MPS), or CUDA, and a device lock serializes local inference.

## Notes

### Output and failures

The image output draws lime rectangles and labels containing each detection's label and score. If image decoding, detection, or output generation fails for a frame, the node logs a warning, drops that frame, and emits no image or text output for it.

## Upstream docs

- [RT-DETR fallback model page](https://huggingface.co/PekingU/rtdetr_r50vd)
- [Grounding DINO model page](https://huggingface.co/IDEA-Research/grounding-dino-tiny)

<!-- ROCKETRIDE:GENERATED:PARAMS START -->
<!-- Generated by nodes:docs-generate. Do not edit by hand. -->

## Schema

| Field | Type | Description | Default |
|---|---|---|---|
| `detect.profile` | `string` | **Model** | `"rfdetr"` |
| `detect.prompt` | `string` | **Detection prompt**<br/>Example: "person . car . dog" (period or comma-separated list) or "red car" / "person in a hat" (described object). Returns all matching regions. Matches objects and attributes — not spatial relationships, so "the car on the left" returns all cars, not just the left one. |  |
| `detect.threshold` | `number` | **Confidence threshold**<br/>Minimum confidence score (0.0–1.0) to include a detection | `0.3` |

## Source

[<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor" aria-hidden="true" style="vertical-align:-0.15em;margin-right:0.35em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg> View source](https://github.com/rocketride-org/rocketride-server/tree/develop/nodes/src/nodes/detect)
<!-- ROCKETRIDE:GENERATED:PARAMS END -->
