MobileNetSpatialDetectionNetwork¶
Spatial detection for the MobileNet NN. It is similar to a combination of the MobileNetDetectionNetwork and SpatialLocationCalculator.
How to place it¶
pipeline = dai.Pipeline()
mobilenetSpatial = pipeline.create(dai.node.MobileNetSpatialDetectionNetwork)
dai::Pipeline pipeline;
auto mobilenetSpatial = pipeline.create<dai::node::MobileNetSpatialDetectionNetwork>();
Inputs and Outputs¶
┌───────────────────┐
input │ │ passthrough
──────────────►│-------------------├─────────────────►
│ MobileNet │ out
│ Spatial ├─────────────────►
│ Detection │boundingBoxMapping
│ Network ├─────────────────►
inputDepth │ │ passthroughDepth
──────────────►│-------------------├─────────────────►
└───────────────────┘
Message types
input- ImgFrameinputDepth- ImgFramepassthrough- ImgFrameout- SpatialImgDetectionsboundingBoxMapping- SpatialLocationCalculatorConfigpassthroughDepth- ImgFrame
Usage¶
pipeline = dai.Pipeline()
mobilenetSpatial = pipeline.create(dai.node.MobileNetSpatialDetectionNetwork)
mobilenetSpatial.setBlobPath(nnBlobPath)
# Will ingore all detections whose confidence is below 50%
mobilenetSpatial.setConfidenceThreshold(0.5)
mobilenetSpatial.input.setBlocking(False)
# How big the ROI will be (smaller value can provide a more stable reading)
mobilenetSpatial.setBoundingBoxScaleFactor(0.5)
# Min/Max threshold. Values out of range will be set to 0 (invalid)
mobilenetSpatial.setDepthLowerThreshold(100)
mobilenetSpatial.setDepthUpperThreshold(5000)
# Link depth from the StereoDepth node
stereo.depth.link(mobilenetSpatial.inputDepth)
dai::Pipeline pipeline;
auto mobilenetSpatial = pipeline.create<dai::node::MobileNetSpatialDetectionNetwork>();
mobilenetSpatial->setBlobPath(nnBlobPath);
// Will ingore all detections whose confidence is below 50%
mobilenetSpatial->setConfidenceThreshold(0.5f);
mobilenetSpatial->input.setBlocking(false);
// How big the ROI will be (smaller value can provide a more stable reading)
mobilenetSpatial->setBoundingBoxScaleFactor(0.5f);
// Min/Max threshold. Values out of range will be set to 0 (invalid)
mobilenetSpatial->setDepthLowerThreshold(100);
mobilenetSpatial->setDepthUpperThreshold(5000);
// Link depth from the StereoDepth node
stereo->depth.link(mobilenetSpatial->inputDepth);
Examples of functionality¶
Spatial coordinate system¶
OAK camera uses left-handed (Cartesian) coordinate system for all spatial coordiantes.
Middle of the frame is 0,0 in terms of X,Y coordinates. If you go up, Y will increase, and if you go right, X will increase.
Reference¶
-
class
depthai.node.MobileNetSpatialDetectionNetwork -
class
Id Node identificator. Unique for every node on a single Pipeline
-
getAssetManager(*args, **kwargs) Overloaded function.
getAssetManager(self: depthai.Node) -> depthai.AssetManager
getAssetManager(self: depthai.Node) -> depthai.AssetManager
-
getConfidenceThreshold(self: depthai.node.DetectionNetwork) → float
-
getInputRefs(*args, **kwargs) Overloaded function.
getInputRefs(self: depthai.Node) -> list[depthai.Node.Input]
getInputRefs(self: depthai.Node) -> list[depthai.Node.Input]
-
getInputs(self: depthai.Node) → list[depthai.Node.Input]
-
getName(self: depthai.Node) → str
-
getNumInferenceThreads(self: depthai.node.NeuralNetwork) → int
-
getOutputRefs(*args, **kwargs) Overloaded function.
getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]
getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]
-
getOutputs(self: depthai.Node) → list[depthai.Node.Output]
-
getParentPipeline(*args, **kwargs) Overloaded function.
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
-
setBlob(*args, **kwargs) Overloaded function.
setBlob(self: depthai.node.NeuralNetwork, blob: depthai.OpenVINO.Blob) -> None
setBlob(self: depthai.node.NeuralNetwork, path: Path) -> None
-
setBlobPath(self: depthai.node.NeuralNetwork, path: Path) → None
-
setBoundingBoxScaleFactor(self: depthai.node.SpatialDetectionNetwork, scaleFactor: float) → None
-
setConfidenceThreshold(self: depthai.node.DetectionNetwork, thresh: float) → None
-
setDepthLowerThreshold(self: depthai.node.SpatialDetectionNetwork, lowerThreshold: int) → None
-
setDepthUpperThreshold(self: depthai.node.SpatialDetectionNetwork, upperThreshold: int) → None
-
setNumInferenceThreads(self: depthai.node.NeuralNetwork, numThreads: int) → None
-
setNumNCEPerInferenceThread(self: depthai.node.NeuralNetwork, numNCEPerThread: int) → None
-
setNumPoolFrames(self: depthai.node.NeuralNetwork, numFrames: int) → None
-
setSpatialCalculationAlgorithm(self: depthai.node.SpatialDetectionNetwork, calculationAlgorithm: depthai.SpatialLocationCalculatorAlgorithm) → None
-
setSpatialCalculationStepSize(self: depthai.node.SpatialDetectionNetwork, stepSize: int) → None
-
class
-
class
dai::node::MobileNetSpatialDetectionNetwork: public dai::NodeCRTP<SpatialDetectionNetwork, MobileNetSpatialDetectionNetwork, SpatialDetectionNetworkProperties>¶ MobileNetSpatialDetectionNetwork node. Mobilenet-SSD based network with spatial location data.
Public Functions