parsing_neural_network
最后更新
depthai_nodes.node.parsing_neural_network类
ParsingNeuralNetwork
build() 接受 NN Archive、模型描述或 Model Zoo slug。解析器输出保留其原生消息类型。当需要 Python 解析器实现时,请使用 HostParsingNeuralNetwork。方法
init
Python
1def __init__(*args, **kwargs):build
Python
1def build(input: dai.Node.Output | dai.node.Camera, nnSource: dai.NNModelDescription | dai.NNArchive | str, fps: float | None = None) -> ParsingNeuralNetwork:input(dai.Node.Output | dai.node.Camera): 上游输出或将帧馈送到神经网络节点的相机。nnSource(dai.NNModelDescription | dai.NNArchive | str): dai.NNModelDescription、dai.NNArchive 或 HubAI 模型 slug。fps(float | None): 神经网络节点的可选运行时 FPS 限制。
ParsingNeuralNetwork: 配置好的节点实例。
ValueError: 如果nnSource不是存档、模型描述或 Model Zoo slug,或者其解析器配置无效。
cleanup
Python
1def cleanup(self):getNumInferenceThreads
Python
1def getNumInferenceThreads(self) -> int:getOutput
Python
1def getOutput(head: int) -> dai.Node.Output:head(int): 存档中基于零的头索引。
dai.Node.Output: 所选头的解析器输出。
KeyError: 如果头不可用。
getParser
Python
1def getParser(*args, **kwargs) -> BaseParser | dai.DeviceNode:*args: 头索引、解析器类型或解析器类型和头索引。parserType: 用于运行时类型检查的可选预期解析器类型。index: 模型头索引。默认为 0。**kwargs: 可选的parserType和index关键字参数。
BaseParser | dai.DeviceNode: 与请求的头匹配的解析器节点。
KeyError: 如果模型头索引不可用。TypeError: 如果解析器与请求的解析器类型不匹配。
run
Python
1def run(self):setBackend
Python
1def setBackend(setBackend: str):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
setBackend(str): DepthAI 接受的后端标识符。
setBackendProperties
Python
1def setBackendProperties(setBackendProperties: dict[str, str]):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
setBackendProperties(dict[str, str]): 特定于后端的字符串属性。
setBlob
Python
1def setBlob(blob: Path | dai.OpenVINO.Blob):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
blob(Path | dai.OpenVINO.Blob): DepthAI 接受的 OpenVINO blob 或路径。
setBlobPath
Python
1def setBlobPath(path: Path):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
path(Path): 本地 OpenVINO blob 路径。
setFromModelZoo
Python
1def setFromModelZoo(description: dai.NNModelDescription, useCached: bool):description(dai.NNModelDescription): 传递给 DepthAI 的 Model Zoo 描述。useCached(bool): DepthAI 是否可以重用缓存模型。
setModelPath
Python
1def setModelPath(modelPath: Path):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
modelPath(Path): 原生节点接受的本地模型路径。
setNNArchive
Python
1def setNNArchive(nnArchive: dai.NNArchive, numShaves: int | None = None):nnArchive(dai.NNArchive): 包含模型和解析器配置的神经网络存档。numShaves(int | None): 分配给神经网络节点的可选 shave 数量。
setNumInferenceThreads
Python
1def setNumInferenceThreads(numThreads: int):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
numThreads(int): 请求的并行推理线程数。
setNumNCEPerInferenceThread
Python
1def setNumNCEPerInferenceThread(numNCEPerThread: int):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
numNCEPerThread(int): 每个推理线程分配的神经计算引擎数量。
setNumPoolFrames
Python
1def setNumPoolFrames(numFrames: int):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
numFrames(int): 网络输出池中的帧数。
setNumShavesPerInferenceThread
Python
1def setNumShavesPerInferenceThread(numShavesPerInferenceThread: int):注意
后端和平台验证由 DepthAI 执行。此转发方法不会重建解析器节点。
numShavesPerInferenceThread(int): 每个推理线程分配的 SHAVE 核心数量。