lane_detection
最后更新
depthai_nodes.node.parsers.lane_detection类
LaneDetectionParser
ValueError:如果未指定行锚点。ValueError:如果未指定网格编号。ValueError:如果未指定每条车道的点数。
方法
init
Python
1def __init__(output_layer_name: str = '', row_anchors: list[int] = None, griding_num: int = None, cls_num_per_lane: int = None, input_size: tuple[int, int] = None):output_layer_name(str):与解析器相关的输出层名称。row_anchors(list[int]):行锚点列表。griding_num(int):网格编号。cls_num_per_lane(int):每条车道的点数。input_size(tuple[int, int]):输入大小(宽度,高度)。
build
Python
1def build(head_config: dict[str, Any]) -> LaneDetectionParser:head_config(dict[str, Any]):解析器的头部配置。
LaneDetectionParser:设置了头部配置的解析器对象。
compute
Python
1def compute(tensor: np.ndarray, *, row_anchors: list[int], griding_num: int, cls_num_per_lane: int, input_size: tuple[int, int]) -> list[list[tuple[int, int]]]:注意
使用 depthai_nodes.node.parsers.utils.lane_detection.compute_lane_detection_points;有关张量布局和验证详细信息,请参阅该帮助程序。
tensor(np.ndarray):带有网格类、采样行和车道的批处理 logits 作为剩余轴;仅使用第一个批处理项。row_anchors(list[int]):车道采样网格的图像行位置(像素)。griding_num(int):水平网格单元格的数量,不包括无车道类。cls_num_per_lane(int):每条车道的采样行位置数量。input_size(tuple[int, int]):模型输入大小,格式为(宽度, 高度)。
list[list[tuple[int, int]]]:每条车道一个列表,包含归一化的 XY 点元组。有效样本少于三个的车道具有空列表。
emit
Python
1def emit(output: dai.NNData, points):dai.beta.Clusters 消息并将其发送到 out。复制源时间戳和序列号,并在存在时携带源图像转换。参数output(dai.NNData):携带张量和源时间戳、序列号以及可选图像转换的神经网络输出。points:归一化 XY 点列表,每条车道一个列表。
extract
Python
1def extract(output: dai.NNData) -> np.ndarray:output(dai.NNData):携带张量和源时间戳、序列号以及可选图像转换的神经网络输出。
np.ndarray:反量化的 float32 批处理 UFLD 网格张量。
ValueError:如果未配置输出名称且消息不包含恰好一个层,或者未满足配置的类要求。
run
Python
1def run(self):setClsNumPerLane
Python
1def setClsNumPerLane(cls_num_per_lane: int):cls_num_per_lane(int):每条车道的类数。
setGridingNum
Python
1def setGridingNum(griding_num: int):griding_num(int):网格编号。
setInputSize
Python
1def setInputSize(input_size: tuple[int, int]):input_size(tuple[int, int]):输入大小(宽度,高度)。
setOutputLayerName
Python
1def setOutputLayerName(output_layer_name: str):output_layer_name(str):输出层名称。
setRowAnchors
Python
1def setRowAnchors(row_anchors: list[int]):row_anchors(list[int]):行锚点列表。