mlsd
最后更新
depthai_nodes.node.parsers.mlsd类
MLSDParser
Note
发出
dai.beta.Lines 消息。包含检测到的线条和置信度分数的原生消息。方法
init
Python
1def __init__(output_layer_tpmap: str = '', output_layer_heat: str = '', topk_n: int = 200, score_thr: float = 0.1, dist_thr: float = 20.0):output_layer_tpmap(str): 包含线条位移的输出张量名称。output_layer_heat(str): 包含热图的输出张量名称。topk_n(int): 要保留的顶部候选数量。score_thr(float): 检测到的线条的置信度分数阈值。dist_thr(float): 输出图中的最小线长(像素)。
build
Python
1def build(head_config: dict[str, Any]) -> MLSDParser:head_config(dict[str, Any]): 解析器的头部配置。
MLSDParser: 设置了头部配置的解析器对象。
compute
Python
1def compute(tpMap: np.ndarray, heat_np: np.ndarray, *, topk_n: int, score_thr: float, dist_thr: float) -> tuple[np.ndarray, np.ndarray]:Note
使用 depthai_nodes.node.parsers.utils.mlsd.compute_mlsd_lines;有关张量布局和验证详细信息,请参阅该帮助程序。
tpMap(np.ndarray): NCHW 布局的四维线位移张量。heat_np(np.ndarray): 用于对线中心候选进行排名的热张量。topk_n(int): 要检查的线中心候选的最大数量。score_thr(float): 最小候选分数。dist_thr(float): 输出图中的最小线长(像素)。
tuple[np.ndarray, np.ndarray]: 形状为(N, 4)的归一化端点坐标和 float32 线条分数。
emit
Python
1def emit(output: dai.NNData, lines: np.ndarray, scores: np.ndarray):dai.beta.Lines 消息并将其发送到 out。复制源时间戳和序列号,并在存在时携带源图像转换。参数output(dai.NNData): 携带张量和源时间戳、序列号以及可选图像转换的神经网络输出。lines(np.ndarray): 归一化的[x1, y1, x2, y2]线端点。scores(np.ndarray): 与计算负载对应的置信度分数。
extract
Python
1def extract(output: dai.NNData) -> tuple[np.ndarray, np.ndarray]:output(dai.NNData): 携带张量和源时间戳、序列号以及可选图像转换的神经网络输出。
tuple[np.ndarray, np.ndarray]: Float32 位移和热张量。位移按 NCHW 顺序请求。
run
Python
1def run(self):setDistanceThreshold
Python
1def setDistanceThreshold(dist_thr: float):dist_thr(float): 输出图中的最小线长(像素)。
setOutputLayerHeat
Python
1def setOutputLayerHeat(output_layer_heat: str):output_layer_heat(str): 包含热张量的输出层的名称。
setOutputLayerTPMap
Python
1def setOutputLayerTPMap(output_layer_tpmap: str):output_layer_tpmap(str): 包含 tpMap 张量的输出层的名称。
setScoreThreshold
Python
1def setScoreThreshold(score_thr: float):score_thr(float): 检测到的线条的置信度分数阈值。
setTopK
Python
1def setTopK(topk_n: int):topk_n(int): 要保留的顶部候选数量。