# ppdet

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

## 函数

### 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]:
```

将 PaddleOCR 文本区域解码为旋转框。

参数

 * `predictions` (`np.ndarray`): `parse_paddle_detection_outputs` 接受的文本概率张量。
 * `mask_threshold` (`float`): 用于二值化文本概率图的阈值。
 * `conf_threshold` (`float`): 用于过滤候选的最小检测置信度。
 * `max_det` (`int`): 在抑制期间保留或考虑的最大检测候选数。

返回

 * `tuple[np.ndarray, np.ndarray, np.ndarray]`: 归一化的中心-XY/宽度/高度框、旋转角度（度）和置信度分数。

### 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]:
```

将 PaddlePaddle 文本检测模型的输出从文本概率掩码解析为带有额外角点（保存为关键点）的旋转边界框。

参数

 * `predictions` (`np.ndarray`): PaddlePaddle 文本检测模型的输出。
 * `mask_threshold` (`float`): 掩码的阈值。
 * `bbox_threshold` (`float`): 边界框的阈值。
 * `max_detections` (`int`): 候选边界框的最大数量。
 * `width` (`int | None`): 图像的宽度。
 * `height` (`int | None`): 图像的高度。

返回

 * `tuple[np.ndarray, np.ndarray, np.ndarray]`: 包含旋转边界框、角点和分数的元组。
