Source code
Python
C++
Python
PythonGitHub
1#!/usr/bin/env python3
2
3import time
4import depthai as dai
5
6# Describe the model I want to download - two options: in program or from yaml file
7
8# Option 1: In program
9# modelDescription = dai.NNModelDescription(model="yolov6-nano", platform="RVC2", ...)
10
11# Option 2: From yaml file
12modelDescription = dai.NNModelDescription.fromYamlFile("./mymodel.yaml")
13
14# If you want, you can store the model description in a yaml file
15modelDescription.saveToYamlFile("./mymodel.yaml")
16
17# Return path to downloaded model - yolov6-nano-r2-288x512.tar.xz for this example
18modelPath = dai.getModelFromZoo(modelDescription, useCached=False, progressFormat="pretty")
19print(f"Model path: {modelPath}")
20
21# Load the model (most of the time it's a NNArchive)
22archive = dai.NNArchive(modelPath)
23
24print(f"Input size of the model {archive.getInputSize()}, name is {archive.getConfig().model.metadata.name}")
25# The arhive can then be used with any of the neural network nodes (NeuralNetwork, DetectionNetwork, SpatialDetectionNetwork)Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.