# rf_detr

Python API: `depthai_nodes.node.parsers.utils.rf_detr`

## Functions

| Name | Description |
| --- | --- |
| [`compute_rfdetr_detections`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/parsers/utils/rf_detr.md#rf_detr-Functions-compute_rfdetr_detections) | Decode RF-DETR detections and optional instance masks. |

### function `compute_rfdetr_detections`

```python
def compute_rfdetr_detections(
    boxes_tensor: np.ndarray,
    logits_tensor: np.ndarray,
    *,
    conf_threshold: float,
    max_det: int,
    label_names: list[str] | None,
    mask_conf: float,
    input_shape: tuple[int, int] | None,
    masks_tensor: np.ndarray | None = None,
    logger=None,
) -> tuple[np.ndarray, np.ndarray, np.ndarray, list[str] | None, np.ndarray | None]
```

Decode RF-DETR detections and optional instance masks.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `boxes_tensor` | `np.ndarray` | Batched normalized center-XY/width/height predictions. | required |
| `logits_tensor` | `np.ndarray` | Class logits of shape `(1, queries, classes)`. | required |
| `conf_threshold` | `float` | Minimum detection confidence used to filter candidates. | required |
| `max_det` | `int` | Maximum number of detection candidates to retain or consider during suppression. | required |
| `label_names` | `list[str] | None` | Optional class-name lookup indexed by predicted class ID. | required |
| `mask_conf` | `float` | Probability threshold used to binarize mask logits. | required |
| `input_shape` | `tuple[int, int] | None` | Model input image shape as `(height, width)`. | required |
| `masks_tensor` | `np.ndarray | None` | Optional per-query mask logits, ordered like the box predictions. | `None` |
| `logger` |  | Optional logger used to report discarded segmentation instances. | `None` |

Returns

| Type | Description |
| --- | --- |
| `tuple[np.ndarray, np.ndarray, np.ndarray, list[str] | None, np.ndarray | None]` | Boxes in normalized center-XY/width/height format, scores, integer class IDs, optional class names, and an optional HW uint8 instance mask. Mask values index returned detections; 255 is background. Segmentation retains at most 255 instances, and higher-confidence masks win overlaps. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If mask decoding is requested without `input_shape`. |
