DepthAI V3

安装
Linux / MacOS
1. 安装 DepthAI v3
Command Line
1git clone https://github.com/luxonis/depthai-core.git && cd depthai-core
2python3 -m venv venv
3source venv/bin/activate
4# Installs library and requirements
5python3 examples/python/install_requirements.pyCommand Line
1pip install depthai --force-reinstall组件

部署 AI 模型
预训练模型
自定义模型
- (推荐)通过 HubAI 在线转换
- 通过 ModelConverter 离线转换 (
nn_archive.tar.xz) - HubAI 使用此工具,但它更用户友好 - 直接使用 SNPE 工具 (
.dlc) - ModelConverter 在 RVC4 平台下使用 SNPE
.dlc 文件,可以通过编辑 NeuralNetwork 示例 并使用以下代码片段将其部署到 OAK4:Python
1nn = pipeline.create(dai.node.NeuralNetwork)
2nn.setModelPath('my_model.dlc')
3nn.setBackend("snpe") # 指定 SNPE NN 后端。这通常会在底层设置
4# 指定 SNPE (RVC4) 特定设置,例如 DSP 运行时和 NN 性能配置文件
5nn.setBackendProperties({"runtime": "dsp", "performance_profile": "default"})archive.tar.xz 文件,可以使用以下代码片段编辑该示例:Python
1cam = pipeline.create(dai.node.Camera).build(socket)
2# 如果您的 nn 模型需要 640x640 的输入大小 (BGR):
3cam_out = cam.requestOutput((640, 640), dai.ImgFrame.Type.BGR888p)
4
5nn_archive = dai.NNArchive('./my_nn_archive.tar.xz')
6nn = pipeline.create(dai.node.NeuralNetwork).build(cam_out, nn_archive)