mlsd
最后更新
depthai_nodes.node.parsers.utils.mlsd函数
compute_mlsd_lines
Python
1def compute_mlsd_lines(tpMap: np.ndarray, heat: np.ndarray, *, topk_n: int, score_thr: float, dist_thr: float) -> tuple[np.ndarray, np.ndarray]:tpMap(np.ndarray): NCHW 布局的四维线位移张量。heat(np.ndarray): 用于对线中心候选进行排名的热张量。topk_n(int): 要检查的线中心候选的最大数量。score_thr(float): 最小候选分数。dist_thr(float): 输出图像素中的最小线长。
tuple[np.ndarray, np.ndarray]: 形状为(N, 4)的归一化端点坐标和 float32 线分数。
ValueError: 如果tpMap不是四维的。
decode_scores_and_points
Python
1def decode_scores_and_points(tpMap: np.ndarray, heat: np.ndarray, topk_n: int) -> tuple[np.ndarray, np.ndarray, np.ndarray]:tpMap(np.ndarray): 包含矢量图的张量。heat(np.ndarray): 包含热图的张量。topk_n(int): 要保留的顶部候选数量。
tuple[np.ndarray, np.ndarray, np.ndarray]: 检测到的点、检测到的点的置信度分数和矢量图。
get_lines
Python
1def get_lines(pts: np.ndarray, pts_score: np.ndarray, vmap: np.ndarray, score_thr: float, dist_thr: float, input_size: int = 512) -> tuple[np.ndarray, list[float]]:pts(np.ndarray): 检测到的点。pts_score(np.ndarray): 检测到的点的置信度分数。vmap(np.ndarray): 矢量图。score_thr(float): 检测到的线的置信度分数阈值。dist_thr(float): 输出图像素中的最小线长。input_size(int): 模型的输入大小。
tuple[np.ndarray, list[float]]: 检测到的线及其置信度分数。