ppdet
最后更新
depthai_nodes.node.parsers.ppdet类
PPTextDetectionParser
方法
init
Python
1def __init__(output_layer_name: str = '', conf_threshold: float = 0.5, mask_threshold: float = 0.25, max_det: int = 100):output_layer_name(str):与解析器相关的输出层的名称。conf_threshold(float):边界框的阈值。mask_threshold(float):掩码的阈值。max_det(int):候选边界框的最大数量。
build
Python
1def build(head_config: dict[str, Any]) -> PPTextDetectionParser:head_config(dict[str, Any]):解析器的头部配置。
PPTextDetectionParser:设置了头部配置的解析器对象。
compute
Python
1def compute(predictions: np.ndarray, *, mask_threshold: float, conf_threshold: float, max_det: int) -> tuple[np.ndarray, np.ndarray, np.ndarray]:注意
使用 depthai_nodes.node.parsers.utils.ppdet.compute_pp_text_detections;有关张量布局和验证详细信息,请参阅该帮助程序。
predictions(np.ndarray):parse_paddle_detection_outputs接受的文本概率张量。mask_threshold(float):用于将文本概率图二值化的阈值。conf_threshold(float):用于过滤候选的最小检测置信度。max_det(int):在抑制期间保留或考虑的最大检测候选数量。
tuple[np.ndarray, np.ndarray, np.ndarray]:归一化的中心 XY/宽度/高度框、旋转角度(以度为单位)和置信度分数。
emit
Python
1def emit(output: dai.NNData, bboxes: np.ndarray, angles: np.ndarray, scores: np.ndarray):dai.ImgDetections 消息并将其发送到 out。复制源时间戳和序列号,并在存在时携带源图像变换。参数output(dai.NNData):携带张量和源时间戳、序列号以及可选图像变换的神经网络输出。bboxes(np.ndarray):compute()返回的归一化中心 XY/宽度/高度框。angles(np.ndarray):与框对应的旋转角度(以度为单位)。scores(np.ndarray):与计算负载对应的置信度分数。
extract
Python
1def extract(output: dai.NNData) -> np.ndarray:output(dai.NNData):携带张量和源时间戳、序列号以及可选图像变换的神经网络输出。
np.ndarray:以 NCHW 存储顺序请求的反量化文本概率张量。
ValueError:如果未配置输出名称且消息不包含恰好一个层,或者未满足配置的类要求。
run
Python
1def run(self):setMaskThreshold
Python
1def setMaskThreshold(mask_threshold: float = 0.25):mask_threshold(float):掩码的阈值。
setOutputLayerName
Python
1def setOutputLayerName(output_layer_name: str):output_layer_name(str):输出层的名称。