# box_detection_assembler

Python API: `depthai_nodes.node.box_detector.box_detection_assembler`

Pair tracklets with segmented detections into one BoxDetections per frame.

## Classes

| Name | Description |
| --- | --- |
| [`BoxDetectionAssembler`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_detector/box_detection_assembler.md#box_detection_assembler-Classes-BoxDetectionAssembler) | Emit one box detection per new or tracked box with a non-empty segmentation. |

### class `BoxDetectionAssembler`

```python
class BoxDetectionAssembler(dai.node.HostNode)
```

Emit one box detection per new or tracked box with a non-empty segmentation.

Attributes

| Name | Description |
| --- | --- |
| `out` | Output stream of `BoxDetections` carrying the timestamps and sequence number of the input detections. |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_detector/box_detection_assembler.md#box_detection_assembler-Classes-BoxDetectionAssembler-__init__) | Initialize the assembler with a placeholder mask size. |
| [`build`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_detector/box_detection_assembler.md#box_detection_assembler-Classes-BoxDetectionAssembler-build) | Link the tracker and detection streams. |
| [`process`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_detector/box_detection_assembler.md#box_detection_assembler-Classes-BoxDetectionAssembler-process) | Assemble and emit the box detections of one frame. |

#### method `__init__`

```python
def __init__()
```

Initialize the assembler with a placeholder mask size.

#### method `build`

```python
def build(
    tracklets: dai.Node.Output,
    detections: dai.Node.Output,
    maskSize: tuple[int, int],
) -> BoxDetectionAssembler
```

Link the tracker and detection streams.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `tracklets` | `dai.Node.Output` | Output producing `dai.Tracklets`. | required |
| `detections` | `dai.Node.Output` | Output producing `dai.ImgDetections` with an instance mask. | required |
| `maskSize` | `tuple[int, int]` | `(width, height)` of the network input, used for the mask of frames that carry none. | required |

Returns

| Type | Description |
| --- | --- |
| `BoxDetectionAssembler` | This node. |

#### method `process`

```python
def process(tracklets: dai.Buffer, detections: dai.Buffer)
```

Assemble and emit the box detections of one frame.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `tracklets` | `dai.Buffer` | Tracker output for the frame. | required |
| `detections` | `dai.Buffer` | Detections of the frame with their instance mask. | required |

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If the inputs are not `dai.Tracklets` and `dai.ImgDetections`. |

## Module Attributes

| Name | Description |
| --- | --- |
| [`CURRENT_STATUSES`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_detector/box_detection_assembler.md#box_detection_assembler-Module-Attributes-CURRENT_STATUSES) |  |

### constant `CURRENT_STATUSES`

```python
CURRENT_STATUSES = (
    dai.Tracklet.TrackingStatus.NEW,
    dai.Tracklet.TrackingStatus.TRACKED,
)
```
