MobileNetDetectionNetwork¶
MobileNet detection network node is very similar to NeuralNetwork (in fact it extends it). The only difference is that this node
is specifically for the MobileNet NN and it decodes the result of the NN on device. This means that out
of this node is not a byte array
but a ImgDetections that can easily be used in your code.
How to place it¶
pipeline = dai.Pipeline()
mobilenetDet = pipeline.create(dai.node.MobileNetDetectionNetwork)
dai::Pipeline pipeline;
auto mobilenetDet = pipeline.create<dai::node::MobileNetDetectionNetwork>();
Inputs and Outputs¶
┌───────────────────┐
│ │ out
│ ├───────────►
│ MobileNet │
│ Detection │
input │ Network │ passthrough
───────────►│-------------------├───────────►
│ │
└───────────────────┘
Message types
input
- ImgFrameout
- ImgDetectionspassthrough
- ImgFrame
Usage¶
pipeline = dai.Pipeline()
mobilenetDet = pipeline.create(dai.node.MobileNetDetectionNetwork)
mobilenetDet.setConfidenceThreshold(0.5)
mobilenetDet.setBlobPath(nnBlobPath)
mobilenetDet.setNumInferenceThreads(2)
mobilenetDet.input.setBlocking(False)
dai::Pipeline pipeline;
auto mobilenetDet = pipeline.create<dai::node::MobileNetDetectionNetwork>();
mobilenetDet->setConfidenceThreshold(0.5f);
mobilenetDet->setBlobPath(nnBlobPath);
mobilenetDet->setNumInferenceThreads(2);
mobilenetDet->input.setBlocking(false);
Examples of functionality¶
Reference¶
-
class
depthai.node.
MobileNetDetectionNetwork
MobileNetDetectionNetwork node. Parses MobileNet results
-
class
Connection
Connection between an Input and Output
-
class
Id
Node identificator. Unique for every node on a single Pipeline
-
Properties
alias of
depthai.DetectionNetworkProperties
-
getAssetManager
(*args, **kwargs) Overloaded function.
getAssetManager(self: depthai.Node) -> depthai.AssetManager
Get node AssetManager as a const reference
getAssetManager(self: depthai.Node) -> depthai.AssetManager
Get node AssetManager as a const reference
-
getConfidenceThreshold
(self: depthai.node.DetectionNetwork) → float Retrieves threshold at which to filter the rest of the detections.
- Returns
Detection confidence
-
getInputRefs
(*args, **kwargs) Overloaded function.
getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]
Retrieves reference to node inputs
getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]
Retrieves reference to node inputs
-
getInputs
(self: depthai.Node) → List[depthai.Node.Input] Retrieves all nodes inputs
-
getName
(self: depthai.Node) → str Retrieves nodes name
-
getNumInferenceThreads
(self: depthai.node.NeuralNetwork) → int How many inference threads will be used to run the network
- Returns
Number of threads, 0, 1 or 2. Zero means AUTO
-
getOutputRefs
(*args, **kwargs) Overloaded function.
getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]
Retrieves reference to node outputs
getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]
Retrieves reference to node outputs
-
getOutputs
(self: depthai.Node) → List[depthai.Node.Output] Retrieves all nodes outputs
-
getParentPipeline
(*args, **kwargs) Overloaded function.
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
-
property
id
Id of node
-
property
input
Input message with data to be inferred upon Default queue is blocking with size 5
-
property
inputs
Inputs mapped to network inputs. Useful for inferring from separate data sources Default input is non-blocking with queue size 1 and waits for messages
-
property
out
Outputs ImgDetections message that carries parsed detection results. Overrides NeuralNetwork ‘out’ with ImgDetections output message type.
-
property
outNetwork
Outputs unparsed inference results.
-
property
passthrough
Passthrough message on which the inference was performed.
Suitable for when input queue is set to non-blocking behavior.
-
property
passthroughs
Passthroughs which correspond to specified input
-
setBlob
(*args, **kwargs) Overloaded function.
setBlob(self: depthai.node.NeuralNetwork, blob: depthai.OpenVINO.Blob) -> None
Load network blob into assets and use once pipeline is started.
- Parameter
blob
: Network blob
setBlob(self: depthai.node.NeuralNetwork, path: Path) -> None
Same functionality as the setBlobPath(). Load network blob into assets and use once pipeline is started.
- Throws:
Error if file doesn’t exist or isn’t a valid network blob.
- Parameter
path
: Path to network blob
-
setBlobPath
(self: depthai.node.NeuralNetwork, path: Path) → None Load network blob into assets and use once pipeline is started.
- Throws:
Error if file doesn’t exist or isn’t a valid network blob.
- Parameter
path
: Path to network blob
-
setConfidenceThreshold
(self: depthai.node.DetectionNetwork, thresh: float) → None Specifies confidence threshold at which to filter the rest of the detections.
- Parameter
thresh
: Detection confidence must be greater than specified threshold to be added to the list
- Parameter
-
setNumInferenceThreads
(self: depthai.node.NeuralNetwork, numThreads: int) → None How many threads should the node use to run the network.
- Parameter
numThreads
: Number of threads to dedicate to this node
- Parameter
-
setNumNCEPerInferenceThread
(self: depthai.node.NeuralNetwork, numNCEPerThread: int) → None How many Neural Compute Engines should a single thread use for inference
- Parameter
numNCEPerThread
: Number of NCE per thread
- Parameter
-
setNumPoolFrames
(self: depthai.node.NeuralNetwork, numFrames: int) → None Specifies how many frames will be available in the pool
- Parameter
numFrames
: How many frames will pool have
- Parameter
-
class
-
class
dai::node
::
MobileNetDetectionNetwork
: public dai::NodeCRTP<DetectionNetwork, MobileNetDetectionNetwork, DetectionNetworkProperties>¶ MobileNetDetectionNetwork node. Parses MobileNet results.
Public Functions
Got questions?
We’re always happy to help with code or other questions you might have.