# ppdet

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

## Functions

| Name | Description |
| --- | --- |
| [`compute_pp_text_detections`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/parsers/utils/ppdet.md#ppdet-Functions-compute_pp_text_detections) | Decode PaddleOCR text regions into rotated boxes. |
| [`parse_paddle_detection_outputs`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/parsers/utils/ppdet.md#ppdet-Functions-parse_paddle_detection_outputs) | Parse the output of a PaddlePaddle Text Detection model from a mask of text probabilities into rotated bounding boxes with additional corners saved as keypoints. |

### function `compute_pp_text_detections`

```python
def compute_pp_text_detections(
    predictions: np.ndarray,
    *,
    mask_threshold: float,
    conf_threshold: float,
    max_det: int,
) -> tuple[np.ndarray, np.ndarray, np.ndarray]
```

Decode PaddleOCR text regions into rotated boxes.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `predictions` | `np.ndarray` | Text probability tensor accepted by `parse_paddle_detection_outputs`. | required |
| `mask_threshold` | `float` | Threshold used to binarize the text probability map. | 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 |

Returns

| Type | Description |
| --- | --- |
| `tuple[np.ndarray, np.ndarray, np.ndarray]` | Normalized center-XY/width/height boxes, rotation angles in degrees, and confidence scores. |

### function `parse_paddle_detection_outputs`

```python
def parse_paddle_detection_outputs(
    predictions: np.ndarray,
    mask_threshold: float = 0.25,
    bbox_threshold: float = 0.5,
    max_detections: int = 100,
    width: int | None = None,
    height: int | None = None,
) -> tuple[np.ndarray, np.ndarray, np.ndarray]
```

Parse the output of a PaddlePaddle Text Detection model from a mask of text probabilities into rotated bounding boxes with
additional corners saved as keypoints.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `predictions` | `np.ndarray` | The output of a PaddlePaddle Text Detection model. | required |
| `mask_threshold` | `float` | The threshold for the mask. | `0.25` |
| `bbox_threshold` | `float` | The threshold for bounding boxes. | `0.5` |
| `max_detections` | `int` | The maximum number of candidate bounding boxes. | `100` |
| `width` | `int | None` | The width of the image. | `None` |
| `height` | `int | None` | The height of the image. | `None` |

Returns

| Type | Description |
| --- | --- |
| `tuple[np.ndarray, np.ndarray, np.ndarray]` | A touple containing the rotated bounding boxes, corners and scores. |
