├── DepthAI ├── Nodes │ ├── CustomNeuralNetwork │ │ ├── ClassificationNetworkNode.py │ │ ├── DetectorNetworkNode.py │ │ ├── OCRNetworkNode.py │ │ ├── RawNetworkNode.py │ │ └── __init__.py │ ├── Debug │ │ └── FramePreviewNode.py │ ├── Devices │ │ ├── BW1093.py │ │ ├── BW1097.py │ │ ├── BW1098FFC.py │ │ ├── BW1098OBC.py │ │ └── __init__.py │ ├── Encodings │ │ ├── H264EncodingNode.py │ │ ├── H265EncodingNode.py │ │ └── __init__.py │ ├── FrameOps │ │ ├── BackgroundSubstractionNode.py │ │ ├── DepthLocationNode.py │ │ ├── DigitalZoomNode.py │ │ ├── ObjectTrackerNode.py │ │ ├── ROICropNode.py │ │ └── __init__.py │ ├── Global │ │ ├── GlobalPropertiesNode.py │ │ └── __init__.py │ ├── ModelZoo │ │ ├── AgeGenderDetectionNode.py │ │ ├── EmotionsRecognitionNode.py │ │ ├── FaceDetectionAdas1Node.py │ │ ├── FaceDetectionRetail4Node.py │ │ ├── FacialLandmarksAdas2Node.py │ │ ├── FacialLandmarksRetail9Node.py │ │ ├── MobilenetSSDNode.py │ │ ├── OCRNode.py │ │ ├── PedestrianDetectionAdas2Node.py │ │ ├── PedestrianDetectionRetail13Node.py │ │ ├── PersonVehicleBikeDetectionNode.py │ │ ├── VehicleDetectionAdas2Node.py │ │ └── VehicleLicensePlateDetectionNode.py │ ├── Test │ │ ├── DemoNode.py │ │ ├── MyProducer.properties.schema.json │ │ ├── MyProducer.py │ │ └── __init__.py │ ├── XLink │ │ ├── XLinkIn.properties.schema.json │ │ ├── XLinkIn.py │ │ ├── XLinkOut.properties.schema.json │ │ ├── XLinkOut.py │ │ └── __init__.py │ ├── __init__.py │ └── common.py ├── Pins │ ├── BoundingBoxPin.py │ ├── DepthVectorPin.py │ ├── DetectionLabelPin.py │ ├── FramePin.py │ ├── H264FramePin.py │ ├── H265FramePin.py │ ├── MSenderPin.py │ ├── NeuralTensorPin.py │ ├── SSenderPin.py │ ├── TrackingInfoPin.py │ └── __init__.py ├── Tools │ ├── CustomDeviceTool.py │ ├── ExportTool.py │ ├── __init__.py │ └── res │ │ ├── export.png │ │ └── usb.png ├── UI │ ├── NodeFactory.py │ ├── UIStreamPreviewNode.py │ └── __init__.py └── __init__.py ├── LICENSE ├── README.md ├── docs └── img │ ├── correctconfig.png │ ├── demo.gif │ └── preferences.png └── requirements.txt /DepthAI/Nodes/CustomNeuralNetwork/ClassificationNetworkNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.DetectionLabelPin import DetectionLabel 6 | 7 | 8 | class ClassificationNetworkNode(NodeBase): 9 | def __init__(self, name): 10 | super(ClassificationNetworkNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 13 | self.blob_path = self.createInputPin('blob_path', 'StringPin') 14 | self.config_path = self.createInputPin('config_path', 'StringPin') 15 | self.threshold = self.createInputPin('threshold', 'FloatPin') 16 | self.label = self.createOutputPin('label', 'DetectionLabelPin') 17 | self.label.enableOptions(PinOptions.AllowMultipleConnections) 18 | 19 | @staticmethod 20 | def pinTypeHints(): 21 | helper = NodePinsSuggestionsHelper() 22 | helper.addInputDataType('FramePin') 23 | helper.addInputDataType('FloatPin') 24 | helper.addInputDataType('StringPin') 25 | helper.addInputDataType('NeuralNetworkPin') 26 | helper.addOutputDataType('DetectionLabelPin') 27 | helper.addInputStruct(StructureType.Multi) 28 | helper.addOutputStruct(StructureType.Multi) 29 | return helper 30 | 31 | @staticmethod 32 | def category(): 33 | return 'Custom Neural Network' 34 | 35 | @staticmethod 36 | def keywords(): 37 | return [] 38 | 39 | @staticmethod 40 | def description(): 41 | return "Description in rst format." 42 | 43 | def compute(self, *args, **kwargs): 44 | _ = self.frame.getData() 45 | _ = self.threshold.getData() 46 | self.label.setData(DetectionLabel()) 47 | -------------------------------------------------------------------------------- /DepthAI/Nodes/CustomNeuralNetwork/DetectorNetworkNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.DetectionLabelPin import DetectionLabel 6 | 7 | 8 | class DetectorNetworkNode(NodeBase): 9 | def __init__(self, name): 10 | super(DetectorNetworkNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 13 | self.blob_path = self.createInputPin('blob_path', 'StringPin') 14 | self.config_path = self.createInputPin('config_path', 'StringPin') 15 | self.threshold = self.createInputPin('threshold', 'FloatPin') 16 | self.label = self.createOutputPin('label', 'DetectionLabelPin') 17 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 18 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 19 | self.label.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 21 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 22 | 23 | @staticmethod 24 | def pinTypeHints(): 25 | helper = NodePinsSuggestionsHelper() 26 | helper.addInputDataType('FramePin') 27 | helper.addInputDataType('FloatPin') 28 | helper.addInputDataType('StringPin') 29 | helper.addInputDataType('NeuralNetworkPin') 30 | helper.addOutputDataType('DetectionLabelPin') 31 | helper.addOutputDataType('BoundingBoxPin') 32 | helper.addOutputDataType('DepthVectorPin') 33 | helper.addInputStruct(StructureType.Multi) 34 | helper.addOutputStruct(StructureType.Multi) 35 | return helper 36 | 37 | @staticmethod 38 | def category(): 39 | return 'Custom Neural Network' 40 | 41 | @staticmethod 42 | def keywords(): 43 | return [] 44 | 45 | @staticmethod 46 | def description(): 47 | return "Description in rst format." 48 | 49 | def compute(self, *args, **kwargs): 50 | _ = self.frame.getData() 51 | _ = self.threshold.getData() 52 | self.label.setData(DetectionLabel()) 53 | -------------------------------------------------------------------------------- /DepthAI/Nodes/CustomNeuralNetwork/OCRNetworkNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.DetectionLabelPin import DetectionLabel 6 | 7 | 8 | class OCRNetworkNode(NodeBase): 9 | def __init__(self, name): 10 | super(OCRNetworkNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 13 | self.blob_path = self.createInputPin('blob_path', 'StringPin') 14 | self.config_path = self.createInputPin('config_path', 'StringPin') 15 | self.label = self.createOutputPin('text', 'StringPin') 16 | self.label.enableOptions(PinOptions.AllowMultipleConnections) 17 | 18 | @staticmethod 19 | def pinTypeHints(): 20 | helper = NodePinsSuggestionsHelper() 21 | helper.addInputDataType('FramePin') 22 | helper.addInputDataType('StringPin') 23 | helper.addOutputDataType('StringPin') 24 | helper.addInputStruct(StructureType.Multi) 25 | helper.addOutputStruct(StructureType.Multi) 26 | return helper 27 | 28 | @staticmethod 29 | def category(): 30 | return 'Custom Neural Network' 31 | 32 | @staticmethod 33 | def keywords(): 34 | return [] 35 | 36 | @staticmethod 37 | def description(): 38 | return "Description in rst format." 39 | 40 | def compute(self, *args, **kwargs): 41 | _ = self.frame.getData() 42 | self.label.setData(DetectionLabel()) 43 | -------------------------------------------------------------------------------- /DepthAI/Nodes/CustomNeuralNetwork/RawNetworkNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.DetectionLabelPin import DetectionLabel 6 | 7 | 8 | class RawNetworkNode(NodeBase): 9 | def __init__(self, name): 10 | super(RawNetworkNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 13 | self.blob_path = self.createInputPin('blob_path', 'StringPin') 14 | self.config_path = self.createInputPin('config_path', 'StringPin') 15 | self.label = self.createOutputPin('out_tensor', 'NeuralTensorPin') 16 | self.label.enableOptions(PinOptions.AllowMultipleConnections) 17 | 18 | @staticmethod 19 | def pinTypeHints(): 20 | helper = NodePinsSuggestionsHelper() 21 | helper.addInputDataType('FramePin') 22 | helper.addInputDataType('StringPin') 23 | helper.addOutputDataType('NeuralTensorPin') 24 | helper.addInputStruct(StructureType.Multi) 25 | helper.addOutputStruct(StructureType.Multi) 26 | return helper 27 | 28 | @staticmethod 29 | def category(): 30 | return 'Custom Neural Network' 31 | 32 | @staticmethod 33 | def keywords(): 34 | return [] 35 | 36 | @staticmethod 37 | def description(): 38 | return "Description in rst format." 39 | 40 | def compute(self, *args, **kwargs): 41 | _ = self.frame.getData() 42 | self.label.setData(DetectionLabel()) 43 | -------------------------------------------------------------------------------- /DepthAI/Nodes/CustomNeuralNetwork/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/CustomNeuralNetwork/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/Debug/FramePreviewNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | 6 | class FramePreviewNode(NodeBase): 7 | def __init__(self, name): 8 | super(FramePreviewNode, self).__init__(name) 9 | self.frame = self.createInputPin('frame', 'FramePin') 10 | self.bbox = self.createInputPin('bbox', 'BoundingBoxPin') 11 | self.label = self.createInputPin('label', 'StringPin') 12 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 13 | 14 | @staticmethod 15 | def pinTypeHints(): 16 | helper = NodePinsSuggestionsHelper() 17 | helper.addInputDataType('FramePin') 18 | helper.addInputDataType('BoundingBoxPin') 19 | helper.addInputDataType('StringPin') 20 | helper.addInputStruct(StructureType.Multi) 21 | return helper 22 | 23 | @staticmethod 24 | def category(): 25 | return 'Debug' 26 | 27 | @staticmethod 28 | def keywords(): 29 | return [] 30 | 31 | @staticmethod 32 | def description(): 33 | return "Description in rst format." 34 | 35 | def compute(self, *args, **kwargs): 36 | pass 37 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Devices/BW1093.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class BW1093(NodeBase): 9 | def __init__(self, name): 10 | super(BW1093, self).__init__(name) 11 | self.color = self.createOutputPin('color', 'FramePin') 12 | self.color.enableOptions(PinOptions.AllowMultipleConnections) 13 | 14 | @staticmethod 15 | def pinTypeHints(): 16 | helper = NodePinsSuggestionsHelper() 17 | helper.addOutputDataType('FramePin') 18 | helper.addOutputStruct(StructureType.Multi) 19 | return helper 20 | 21 | @staticmethod 22 | def category(): 23 | return 'Devices' 24 | 25 | @staticmethod 26 | def keywords(): 27 | return [] 28 | 29 | @staticmethod 30 | def description(): 31 | return "Description in rst format." 32 | 33 | def compute(self, *args, **kwargs): 34 | self.color.setData(Frame()) 35 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Devices/BW1097.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class BW1097(NodeBase): 9 | def __init__(self, name): 10 | super(BW1097, self).__init__(name) 11 | self.color = self.createOutputPin('color', 'FramePin') 12 | self.mono_l = self.createOutputPin('mono_l', 'FramePin') 13 | self.mono_r = self.createOutputPin('mono_r', 'FramePin') 14 | self.color.enableOptions(PinOptions.AllowMultipleConnections) 15 | self.mono_l.enableOptions(PinOptions.AllowMultipleConnections) 16 | self.mono_r.enableOptions(PinOptions.AllowMultipleConnections) 17 | 18 | @staticmethod 19 | def pinTypeHints(): 20 | helper = NodePinsSuggestionsHelper() 21 | helper.addOutputDataType('FramePin') 22 | helper.addOutputStruct(StructureType.Multi) 23 | return helper 24 | 25 | @staticmethod 26 | def category(): 27 | return 'Devices' 28 | 29 | @staticmethod 30 | def keywords(): 31 | return [] 32 | 33 | @staticmethod 34 | def description(): 35 | return "Description in rst format." 36 | 37 | def compute(self, *args, **kwargs): 38 | self.color.setData(Frame()) 39 | self.mono_l.setData(Frame()) 40 | self.mono_r.setData(Frame()) 41 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Devices/BW1098FFC.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class BW1098FFC(NodeBase): 9 | def __init__(self, name): 10 | super(BW1098FFC, self).__init__(name) 11 | self.stereo_baseline = self.createInputPin('stereo_baseline', 'FloatPin') 12 | self.color = self.createOutputPin('color', 'FramePin') 13 | self.mono_l = self.createOutputPin('mono_l', 'FramePin') 14 | self.mono_r = self.createOutputPin('mono_r', 'FramePin') 15 | self.color.enableOptions(PinOptions.AllowMultipleConnections) 16 | self.mono_l.enableOptions(PinOptions.AllowMultipleConnections) 17 | self.mono_r.enableOptions(PinOptions.AllowMultipleConnections) 18 | 19 | @staticmethod 20 | def pinTypeHints(): 21 | helper = NodePinsSuggestionsHelper() 22 | helper.addInputDataType('FloatPin') 23 | helper.addOutputDataType('FramePin') 24 | helper.addOutputStruct(StructureType.Multi) 25 | return helper 26 | 27 | @staticmethod 28 | def category(): 29 | return 'Devices' 30 | 31 | @staticmethod 32 | def keywords(): 33 | return [] 34 | 35 | @staticmethod 36 | def description(): 37 | return "Description in rst format." 38 | 39 | def compute(self, *args, **kwargs): 40 | self.color.setData(Frame()) 41 | self.mono_l.setData(Frame()) 42 | self.mono_r.setData(Frame()) 43 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Devices/BW1098OBC.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class BW1098OBC(NodeBase): 9 | def __init__(self, name): 10 | super(BW1098OBC, self).__init__(name) 11 | self.color = self.createOutputPin('color', 'FramePin') 12 | self.mono_l = self.createOutputPin('mono_l', 'FramePin') 13 | self.mono_r = self.createOutputPin('mono_r', 'FramePin') 14 | self.color.enableOptions(PinOptions.AllowMultipleConnections) 15 | self.mono_l.enableOptions(PinOptions.AllowMultipleConnections) 16 | self.mono_r.enableOptions(PinOptions.AllowMultipleConnections) 17 | 18 | @staticmethod 19 | def pinTypeHints(): 20 | helper = NodePinsSuggestionsHelper() 21 | helper.addOutputDataType('FramePin') 22 | helper.addOutputStruct(StructureType.Multi) 23 | return helper 24 | 25 | @staticmethod 26 | def category(): 27 | return 'Devices' 28 | 29 | @staticmethod 30 | def keywords(): 31 | return [] 32 | 33 | @staticmethod 34 | def description(): 35 | return "Description in rst format." 36 | 37 | def compute(self, *args, **kwargs): 38 | self.color.setData(Frame()) 39 | self.mono_l.setData(Frame()) 40 | self.mono_r.setData(Frame()) 41 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Devices/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/Devices/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/Encodings/H264EncodingNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.H264FramePin import H264Frame 6 | 7 | 8 | class H264EncodingNode(NodeBase): 9 | def __init__(self, name): 10 | super(H264EncodingNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.encoded = self.createOutputPin('encoded', 'H264FramePin') 13 | self.encoded.enableOptions(PinOptions.AllowMultipleConnections) 14 | 15 | @staticmethod 16 | def pinTypeHints(): 17 | helper = NodePinsSuggestionsHelper() 18 | helper.addInputDataType('FramePin') 19 | helper.addOutputDataType('H264FramePin') 20 | helper.addOutputStruct(StructureType.Multi) 21 | return helper 22 | 23 | @staticmethod 24 | def category(): 25 | return 'Encodings' 26 | 27 | @staticmethod 28 | def keywords(): 29 | return [] 30 | 31 | @staticmethod 32 | def description(): 33 | return "Description in rst format." 34 | 35 | def compute(self, *args, **kwargs): 36 | _ = self.frame.getData() 37 | self.encoded.setData(H264Frame()) 38 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Encodings/H265EncodingNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.H265FramePin import H265Frame 6 | 7 | 8 | class H265EncodingNode(NodeBase): 9 | def __init__(self, name): 10 | super(H265EncodingNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.encoded = self.createOutputPin('encoded', 'H265FramePin') 13 | self.encoded.enableOptions(PinOptions.AllowMultipleConnections) 14 | 15 | @staticmethod 16 | def pinTypeHints(): 17 | helper = NodePinsSuggestionsHelper() 18 | helper.addInputDataType('FramePin') 19 | helper.addOutputDataType('H265FramePin') 20 | helper.addOutputStruct(StructureType.Multi) 21 | return helper 22 | 23 | @staticmethod 24 | def category(): 25 | return 'Encodings' 26 | 27 | @staticmethod 28 | def keywords(): 29 | return [] 30 | 31 | @staticmethod 32 | def description(): 33 | return "Description in rst format." 34 | 35 | def compute(self, *args, **kwargs): 36 | _ = self.frame.getData() 37 | self.encoded.setData(H265Frame()) 38 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Encodings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/Encodings/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/FrameOps/BackgroundSubstractionNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class BackgroundSubstractionNode(NodeBase): 9 | def __init__(self, name): 10 | super(BackgroundSubstractionNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.out = self.createOutputPin('out', 'FramePin') 13 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 14 | 15 | @staticmethod 16 | def pinTypeHints(): 17 | helper = NodePinsSuggestionsHelper() 18 | helper.addInputDataType('FramePin') 19 | helper.addOutputDataType('FramePin') 20 | helper.addOutputStruct(StructureType.Multi) 21 | return helper 22 | 23 | @staticmethod 24 | def category(): 25 | return 'FrameOps' 26 | 27 | @staticmethod 28 | def keywords(): 29 | return [] 30 | 31 | @staticmethod 32 | def description(): 33 | return "Description in rst format." 34 | 35 | def compute(self, *args, **kwargs): 36 | self.out.setData(Frame()) 37 | -------------------------------------------------------------------------------- /DepthAI/Nodes/FrameOps/DepthLocationNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.DepthVectorPin import DepthVector 6 | from DepthAI.Pins.FramePin import Frame 7 | 8 | 9 | class DepthLocationNode(NodeBase): 10 | def __init__(self, name): 11 | super(DepthLocationNode, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.bbox = self.createInputPin('bbox', 'BoundingBoxPin') 14 | self.out = self.createOutputPin('out', 'DepthVectorPin') 15 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 16 | 17 | @staticmethod 18 | def pinTypeHints(): 19 | helper = NodePinsSuggestionsHelper() 20 | helper.addInputDataType('FramePin') 21 | helper.addInputDataType('BoundingBoxPin') 22 | helper.addOutputDataType('DepthVectorPin') 23 | helper.addOutputStruct(StructureType.Multi) 24 | return helper 25 | 26 | @staticmethod 27 | def category(): 28 | return 'FrameOps' 29 | 30 | @staticmethod 31 | def keywords(): 32 | return [] 33 | 34 | @staticmethod 35 | def description(): 36 | return "Description in rst format." 37 | 38 | def compute(self, *args, **kwargs): 39 | self.out.setData(DepthVector()) 40 | -------------------------------------------------------------------------------- /DepthAI/Nodes/FrameOps/DigitalZoomNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class DigitalZoomNode(NodeBase): 9 | def __init__(self, name): 10 | super(DigitalZoomNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.factor = self.createInputPin('factor', 'FloatPin') 13 | self.out = self.createOutputPin('out', 'FramePin') 14 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 15 | 16 | @staticmethod 17 | def pinTypeHints(): 18 | helper = NodePinsSuggestionsHelper() 19 | helper.addInputDataType('FramePin') 20 | helper.addInputDataType('FloatPin') 21 | helper.addOutputDataType('FramePin') 22 | helper.addOutputStruct(StructureType.Multi) 23 | return helper 24 | 25 | @staticmethod 26 | def category(): 27 | return 'FrameOps' 28 | 29 | @staticmethod 30 | def keywords(): 31 | return [] 32 | 33 | @staticmethod 34 | def description(): 35 | return "Description in rst format." 36 | 37 | def compute(self, *args, **kwargs): 38 | self.out.setData(Frame()) 39 | -------------------------------------------------------------------------------- /DepthAI/Nodes/FrameOps/ObjectTrackerNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.DepthVectorPin import DepthVector 6 | from DepthAI.Pins.FramePin import Frame 7 | 8 | 9 | class ObjectTrackerNode(NodeBase): 10 | def __init__(self, name): 11 | super(ObjectTrackerNode, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.bbox = self.createInputPin('bbox', 'BoundingBoxPin') 14 | self.out = self.createOutputPin('out', 'TrackingInfoPin') 15 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 16 | 17 | @staticmethod 18 | def pinTypeHints(): 19 | helper = NodePinsSuggestionsHelper() 20 | helper.addInputDataType('FramePin') 21 | helper.addInputDataType('BoundingBoxPin') 22 | helper.addOutputDataType('TrackingInfoPin') 23 | helper.addOutputStruct(StructureType.Multi) 24 | return helper 25 | 26 | @staticmethod 27 | def category(): 28 | return 'FrameOps' 29 | 30 | @staticmethod 31 | def keywords(): 32 | return [] 33 | 34 | @staticmethod 35 | def description(): 36 | return "Description in rst format." 37 | 38 | def compute(self, *args, **kwargs): 39 | self.out.setData(DepthVector()) 40 | -------------------------------------------------------------------------------- /DepthAI/Nodes/FrameOps/ROICropNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class ROICropNode(NodeBase): 9 | def __init__(self, name): 10 | super(ROICropNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.bbox = self.createInputPin('bbox', 'BoundingBoxPin') 13 | self.out = self.createOutputPin('out', 'FramePin') 14 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 15 | 16 | @staticmethod 17 | def pinTypeHints(): 18 | helper = NodePinsSuggestionsHelper() 19 | helper.addInputDataType('FramePin') 20 | helper.addInputDataType('BoundingBoxPin') 21 | helper.addOutputDataType('FramePin') 22 | helper.addOutputStruct(StructureType.Multi) 23 | return helper 24 | 25 | @staticmethod 26 | def category(): 27 | return 'FrameOps' 28 | 29 | @staticmethod 30 | def keywords(): 31 | return [] 32 | 33 | @staticmethod 34 | def description(): 35 | return "Description in rst format." 36 | 37 | def compute(self, *args, **kwargs): 38 | self.out.setData(Frame()) 39 | -------------------------------------------------------------------------------- /DepthAI/Nodes/FrameOps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/FrameOps/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/Global/GlobalPropertiesNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.FramePin import Frame 6 | 7 | 8 | class GlobalPropertiesNode(NodeBase): 9 | def __init__(self, name): 10 | super(GlobalPropertiesNode, self).__init__(name) 11 | self.leon_os_freq = self.createInputPin('leon_os_freq', 'IntPin') 12 | 13 | @staticmethod 14 | def pinTypeHints(): 15 | helper = NodePinsSuggestionsHelper() 16 | helper.addInputDataType('IntPin') 17 | helper.addInputStruct(StructureType.Single) 18 | return helper 19 | 20 | @staticmethod 21 | def category(): 22 | return 'Global' 23 | 24 | @staticmethod 25 | def keywords(): 26 | return [] 27 | 28 | @staticmethod 29 | def description(): 30 | return "Description in rst format." 31 | 32 | def compute(self, *args, **kwargs): 33 | pass 34 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Global/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/Global/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/AgeGenderDetectionNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 6 | 7 | 8 | class AgeGenderDetectionNode(NodeBase): 9 | def __init__(self, name): 10 | super(AgeGenderDetectionNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 15 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 16 | 17 | @staticmethod 18 | def pinTypeHints(): 19 | helper = NodePinsSuggestionsHelper() 20 | helper.addInputDataType('FramePin') 21 | helper.addOutputDataType('NeuralTensorPin') 22 | helper.addOutputDataType('FloatPin') 23 | helper.addInputStruct(StructureType.Multi) 24 | helper.addOutputStruct(StructureType.Multi) 25 | return helper 26 | 27 | @staticmethod 28 | def category(): 29 | return 'Model Zoo' 30 | 31 | @staticmethod 32 | def keywords(): 33 | return [] 34 | 35 | @staticmethod 36 | def description(): 37 | return "Description in rst format." 38 | 39 | def compute(self, *args, **kwargs): 40 | _ = self.frame.getData() 41 | self.out_tensor.setData(NeuralTensor()) 42 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/EmotionsRecognitionNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 6 | 7 | 8 | class EmotionsRecognitionNode(NodeBase): 9 | def __init__(self, name): 10 | super(EmotionsRecognitionNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 15 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 16 | 17 | @staticmethod 18 | def pinTypeHints(): 19 | helper = NodePinsSuggestionsHelper() 20 | helper.addInputDataType('FramePin') 21 | helper.addInputDataType('FloatPin') 22 | helper.addOutputDataType('NeuralTensorPin') 23 | helper.addInputStruct(StructureType.Multi) 24 | helper.addOutputStruct(StructureType.Multi) 25 | return helper 26 | 27 | @staticmethod 28 | def category(): 29 | return 'Model Zoo' 30 | 31 | @staticmethod 32 | def keywords(): 33 | return [] 34 | 35 | @staticmethod 36 | def description(): 37 | return "Description in rst format." 38 | 39 | def compute(self, *args, **kwargs): 40 | _ = self.frame.getData() 41 | self.out_tensor.setData(NeuralTensor()) 42 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/FaceDetectionAdas1Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class FaceDetectionAdas1Node(NodeBase): 10 | def __init__(self, name): 11 | super(FaceDetectionAdas1Node, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 18 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('FramePin') 26 | helper.addInputDataType('FloatPin') 27 | helper.addOutputDataType('NeuralTensorPin') 28 | helper.addOutputDataType('DepthVectorPin') 29 | helper.addOutputDataType('BoundingBoxPin') 30 | helper.addInputStruct(StructureType.Multi) 31 | helper.addOutputStruct(StructureType.Multi) 32 | return helper 33 | 34 | @staticmethod 35 | def category(): 36 | return 'Model Zoo' 37 | 38 | @staticmethod 39 | def keywords(): 40 | return [] 41 | 42 | @staticmethod 43 | def description(): 44 | return "Description in rst format." 45 | 46 | def compute(self, *args, **kwargs): 47 | _ = self.frame.getData() 48 | self.bbox.setData(BoundingBox()) 49 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/FaceDetectionRetail4Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class FaceDetectionRetail4Node(NodeBase): 10 | def __init__(self, name): 11 | super(FaceDetectionRetail4Node, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 18 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('FramePin') 26 | helper.addInputDataType('FloatPin') 27 | helper.addOutputDataType('NeuralTensorPin') 28 | helper.addOutputDataType('DepthVectorPin') 29 | helper.addOutputDataType('BoundingBoxPin') 30 | helper.addInputStruct(StructureType.Multi) 31 | helper.addOutputStruct(StructureType.Multi) 32 | return helper 33 | 34 | @staticmethod 35 | def category(): 36 | return 'Model Zoo' 37 | 38 | @staticmethod 39 | def keywords(): 40 | return [] 41 | 42 | @staticmethod 43 | def description(): 44 | return "Description in rst format." 45 | 46 | def compute(self, *args, **kwargs): 47 | _ = self.frame.getData() 48 | self.bbox.setData(BoundingBox()) 49 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/FacialLandmarksAdas2Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 6 | 7 | 8 | class FacialLandmarksAdas2Node(NodeBase): 9 | def __init__(self, name): 10 | super(FacialLandmarksAdas2Node, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.threshold = self.createInputPin('threshold', 'FloatPin') 13 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 14 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 15 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 16 | 17 | @staticmethod 18 | def pinTypeHints(): 19 | helper = NodePinsSuggestionsHelper() 20 | helper.addInputDataType('FramePin') 21 | helper.addInputDataType('FloatPin') 22 | helper.addOutputDataType('NeuralTensorPin') 23 | helper.addInputStruct(StructureType.Multi) 24 | helper.addOutputStruct(StructureType.Multi) 25 | return helper 26 | 27 | @staticmethod 28 | def category(): 29 | return 'Model Zoo' 30 | 31 | @staticmethod 32 | def keywords(): 33 | return [] 34 | 35 | @staticmethod 36 | def description(): 37 | return "Description in rst format." 38 | 39 | def compute(self, *args, **kwargs): 40 | _ = self.frame.getData() 41 | self.out_tensor.setData(NeuralTensor()) 42 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/FacialLandmarksRetail9Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 6 | 7 | 8 | class FacialLandmarksRetail9Node(NodeBase): 9 | def __init__(self, name): 10 | super(FacialLandmarksRetail9Node, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.threshold = self.createInputPin('threshold', 'FloatPin') 13 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 14 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 15 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 16 | 17 | @staticmethod 18 | def pinTypeHints(): 19 | helper = NodePinsSuggestionsHelper() 20 | helper.addInputDataType('FramePin') 21 | helper.addInputDataType('FloatPin') 22 | helper.addOutputDataType('NeuralTensorPin') 23 | helper.addInputStruct(StructureType.Multi) 24 | helper.addOutputStruct(StructureType.Multi) 25 | return helper 26 | 27 | @staticmethod 28 | def category(): 29 | return 'Model Zoo' 30 | 31 | @staticmethod 32 | def keywords(): 33 | return [] 34 | 35 | @staticmethod 36 | def description(): 37 | return "Description in rst format." 38 | 39 | def compute(self, *args, **kwargs): 40 | _ = self.frame.getData() 41 | self.out_tensor.setData(NeuralTensor()) 42 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/MobilenetSSDNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class MobilenetSSDNode(NodeBase): 10 | def __init__(self, name): 11 | super(MobilenetSSDNode, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.label = self.createOutputPin('label', 'DetectionLabelPin') 18 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 21 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 22 | self.label.enableOptions(PinOptions.AllowMultipleConnections) 23 | 24 | @staticmethod 25 | def pinTypeHints(): 26 | helper = NodePinsSuggestionsHelper() 27 | helper.addInputDataType('FramePin') 28 | helper.addInputDataType('FloatPin') 29 | helper.addOutputDataType('NeuralTensorPin') 30 | helper.addOutputDataType('DepthVectorPin') 31 | helper.addOutputDataType('BoundingBoxPin') 32 | helper.addOutputDataType('DetectionLabelPin') 33 | helper.addInputStruct(StructureType.Multi) 34 | helper.addOutputStruct(StructureType.Multi) 35 | return helper 36 | 37 | @staticmethod 38 | def category(): 39 | return 'Model Zoo' 40 | 41 | @staticmethod 42 | def keywords(): 43 | return [] 44 | 45 | @staticmethod 46 | def description(): 47 | return "Description in rst format." 48 | 49 | def compute(self, *args, **kwargs): 50 | _ = self.frame.getData() 51 | self.bbox.setData(BoundingBox()) 52 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/OCRNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 6 | 7 | 8 | class OCRNode(NodeBase): 9 | def __init__(self, name): 10 | super(OCRNode, self).__init__(name) 11 | self.frame = self.createInputPin('frame', 'FramePin') 12 | self.out_tensor = self.createOutputPin('text', 'StringPin') 13 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 14 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 15 | 16 | @staticmethod 17 | def pinTypeHints(): 18 | helper = NodePinsSuggestionsHelper() 19 | helper.addInputDataType('FramePin') 20 | helper.addOutputDataType('StringPin') 21 | helper.addInputStruct(StructureType.Multi) 22 | helper.addOutputStruct(StructureType.Multi) 23 | return helper 24 | 25 | @staticmethod 26 | def category(): 27 | return 'Model Zoo' 28 | 29 | @staticmethod 30 | def keywords(): 31 | return [] 32 | 33 | @staticmethod 34 | def description(): 35 | return "Description in rst format." 36 | 37 | def compute(self, *args, **kwargs): 38 | _ = self.frame.getData() 39 | self.out_tensor.setData(NeuralTensor()) 40 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/PedestrianDetectionAdas2Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class PedestrianDetectionAdas2Node(NodeBase): 10 | def __init__(self, name): 11 | super(PedestrianDetectionAdas2Node, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 18 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('FramePin') 26 | helper.addInputDataType('FloatPin') 27 | helper.addOutputDataType('NeuralTensorPin') 28 | helper.addOutputDataType('DepthVectorPin') 29 | helper.addOutputDataType('BoundingBoxPin') 30 | helper.addInputStruct(StructureType.Multi) 31 | helper.addOutputStruct(StructureType.Multi) 32 | return helper 33 | 34 | @staticmethod 35 | def category(): 36 | return 'Model Zoo' 37 | 38 | @staticmethod 39 | def keywords(): 40 | return [] 41 | 42 | @staticmethod 43 | def description(): 44 | return "Description in rst format." 45 | 46 | def compute(self, *args, **kwargs): 47 | _ = self.frame.getData() 48 | self.bbox.setData(BoundingBox()) 49 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/PedestrianDetectionRetail13Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class PedestrianDetectionRetail13Node(NodeBase): 10 | def __init__(self, name): 11 | super(PedestrianDetectionRetail13Node, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 18 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('FramePin') 26 | helper.addInputDataType('FloatPin') 27 | helper.addOutputDataType('NeuralTensorPin') 28 | helper.addOutputDataType('DepthVectorPin') 29 | helper.addOutputDataType('BoundingBoxPin') 30 | helper.addInputStruct(StructureType.Multi) 31 | helper.addOutputStruct(StructureType.Multi) 32 | return helper 33 | 34 | @staticmethod 35 | def category(): 36 | return 'Model Zoo' 37 | 38 | @staticmethod 39 | def keywords(): 40 | return [] 41 | 42 | @staticmethod 43 | def description(): 44 | return "Description in rst format." 45 | 46 | def compute(self, *args, **kwargs): 47 | _ = self.frame.getData() 48 | self.bbox.setData(BoundingBox()) 49 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/PersonVehicleBikeDetectionNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class PersonVehicleBikeDetectionNode(NodeBase): 10 | def __init__(self, name): 11 | super(PersonVehicleBikeDetectionNode, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.label = self.createOutputPin('label', 'DetectionLabelPin') 18 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 21 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 22 | self.label.enableOptions(PinOptions.AllowMultipleConnections) 23 | 24 | @staticmethod 25 | def pinTypeHints(): 26 | helper = NodePinsSuggestionsHelper() 27 | helper.addInputDataType('FramePin') 28 | helper.addInputDataType('FloatPin') 29 | helper.addOutputDataType('NeuralTensorPin') 30 | helper.addOutputDataType('DepthVectorPin') 31 | helper.addOutputDataType('BoundingBoxPin') 32 | helper.addOutputDataType('DetectionLabelPin') 33 | helper.addInputStruct(StructureType.Multi) 34 | helper.addOutputStruct(StructureType.Multi) 35 | return helper 36 | 37 | @staticmethod 38 | def category(): 39 | return 'Model Zoo' 40 | 41 | @staticmethod 42 | def keywords(): 43 | return [] 44 | 45 | @staticmethod 46 | def description(): 47 | return "Description in rst format." 48 | 49 | def compute(self, *args, **kwargs): 50 | _ = self.frame.getData() 51 | self.bbox.setData(BoundingBox()) 52 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/VehicleDetectionAdas2Node.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class VehicleDetectionAdas2Node(NodeBase): 10 | def __init__(self, name): 11 | super(VehicleDetectionAdas2Node, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 18 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('FramePin') 26 | helper.addInputDataType('FloatPin') 27 | helper.addOutputDataType('NeuralTensorPin') 28 | helper.addOutputDataType('DepthVectorPin') 29 | helper.addOutputDataType('BoundingBoxPin') 30 | helper.addInputStruct(StructureType.Multi) 31 | helper.addOutputStruct(StructureType.Multi) 32 | return helper 33 | 34 | @staticmethod 35 | def category(): 36 | return 'Model Zoo' 37 | 38 | @staticmethod 39 | def keywords(): 40 | return [] 41 | 42 | @staticmethod 43 | def description(): 44 | return "Description in rst format." 45 | 46 | def compute(self, *args, **kwargs): 47 | _ = self.frame.getData() 48 | self.bbox.setData(BoundingBox()) 49 | -------------------------------------------------------------------------------- /DepthAI/Nodes/ModelZoo/VehicleLicensePlateDetectionNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.Common import * 3 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 4 | 5 | from DepthAI.Pins.BoundingBoxPin import BoundingBox 6 | from DepthAI.Pins.NeuralTensorPin import NeuralTensor 7 | 8 | 9 | class VehicleLicensePlateDetectionNode(NodeBase): 10 | def __init__(self, name): 11 | super(VehicleLicensePlateDetectionNode, self).__init__(name) 12 | self.frame = self.createInputPin('frame', 'FramePin') 13 | self.threshold = self.createInputPin('threshold', 'FloatPin') 14 | self.out_tensor = self.createOutputPin('out_tensor', 'NeuralTensorPin') 15 | self.bbox = self.createOutputPin('bbox', 'BoundingBoxPin') 16 | self.depth = self.createOutputPin('depth', 'DepthVectorPin') 17 | self.frame.enableOptions(PinOptions.AllowMultipleConnections) 18 | self.bbox.enableOptions(PinOptions.AllowMultipleConnections) 19 | self.out_tensor.enableOptions(PinOptions.AllowMultipleConnections) 20 | self.depth.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('FramePin') 26 | helper.addInputDataType('FloatPin') 27 | helper.addOutputDataType('NeuralTensorPin') 28 | helper.addOutputDataType('DepthVectorPin') 29 | helper.addOutputDataType('BoundingBoxPin') 30 | helper.addInputStruct(StructureType.Multi) 31 | helper.addOutputStruct(StructureType.Multi) 32 | return helper 33 | 34 | @staticmethod 35 | def category(): 36 | return 'Model Zoo' 37 | 38 | @staticmethod 39 | def keywords(): 40 | return [] 41 | 42 | @staticmethod 43 | def description(): 44 | return "Description in rst format." 45 | 46 | def compute(self, *args, **kwargs): 47 | _ = self.frame.getData() 48 | self.bbox.setData(BoundingBox()) 49 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Test/DemoNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.Core import NodeBase 2 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 3 | from PyFlow.Core.Common import * 4 | 5 | 6 | class DemoNode(NodeBase): 7 | def __init__(self, name): 8 | super(DemoNode, self).__init__(name) 9 | self.inp = self.createInputPin('inp', 'BoolPin') 10 | self.out = self.createOutputPin('out', 'BoolPin') 11 | 12 | @staticmethod 13 | def pinTypeHints(): 14 | helper = NodePinsSuggestionsHelper() 15 | helper.addInputDataType('BoolPin') 16 | helper.addOutputDataType('BoolPin') 17 | helper.addInputStruct(StructureType.Single) 18 | helper.addOutputStruct(StructureType.Single) 19 | return helper 20 | 21 | @staticmethod 22 | def category(): 23 | return 'Test' 24 | 25 | @staticmethod 26 | def keywords(): 27 | return [] 28 | 29 | @staticmethod 30 | def description(): 31 | return "Description in rst format." 32 | 33 | def compute(self, *args, **kwargs): 34 | inputData = self.inp.getData() 35 | self.out.setData(not inputData) 36 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Test/MyProducer.properties.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://lpb.luxonis.com/schema/MyProducer.properties.schema.json", 3 | "$schema": "http://json-schema.org/draft-07/schema#", 4 | "title": "MyProducer Properties", 5 | "description": "Specify message and processor placement of MyProducer node", 6 | "required": [ "processorPlacement" ], 7 | "type": "object", 8 | "properties": { 9 | "message": { 10 | "type": "string", 11 | "minLength": 1, 12 | "default": "Hello World!" 13 | }, 14 | "processorPlacement":{ 15 | "$ref": "ProcessorType.schema.json" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /DepthAI/Nodes/Test/MyProducer.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from PyFlow.Core import NodeBase 4 | from PyFlow.Core.Common import * 5 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 6 | 7 | from DepthAI.Nodes.common import ExportableNode, SchemaPropertiesNode 8 | from DepthAI.Pins.FramePin import Frame 9 | 10 | 11 | class MyProducer(NodeBase, ExportableNode, SchemaPropertiesNode): 12 | def get_properties_file(self): 13 | return str((Path(__file__).parent / Path('MyProducer.properties.schema.json')).resolve().absolute()) 14 | 15 | def __init__(self, name): 16 | super(MyProducer, self).__init__(name) 17 | self.add_properties() 18 | self.processor = self.createInputPin('processor', 'StringPin') 19 | self.out = self.createOutputPin('out', 'MSenderPin') 20 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 21 | 22 | @staticmethod 23 | def pinTypeHints(): 24 | helper = NodePinsSuggestionsHelper() 25 | helper.addInputDataType('StringPin') 26 | helper.addOutputDataType('MSenderPin') 27 | helper.addOutputStruct(StructureType.Multi) 28 | helper.addInputStruct(StructureType.Single) 29 | return helper 30 | 31 | @staticmethod 32 | def category(): 33 | return 'Test' 34 | 35 | @staticmethod 36 | def keywords(): 37 | return [] 38 | 39 | @staticmethod 40 | def description(): 41 | return "Description in rst format." 42 | 43 | def compute(self, *args, **kwargs): 44 | self.out.setData(Frame()) 45 | -------------------------------------------------------------------------------- /DepthAI/Nodes/Test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/Test/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/XLink/XLinkIn.properties.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://lpb.luxonis.com/schema/XLinkIn.properties.schema.json", 3 | "$schema": "http://json-schema.org/draft-07/schema#", 4 | "title": "XLinkIn Node Properties", 5 | "description": "Properties for XLinkIn which define stream name", 6 | "required": [ "streamName" ], 7 | "type": "object", 8 | "properties": { 9 | "streamName": { 10 | "type": "string", 11 | "maxLength": 32 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /DepthAI/Nodes/XLink/XLinkIn.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from PyFlow.Core import NodeBase 4 | from PyFlow.Core.Common import * 5 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 6 | 7 | from DepthAI.Nodes.common import ExportableNode, SchemaPropertiesNode 8 | from DepthAI.Pins.FramePin import Frame 9 | 10 | 11 | class XLinkIn(NodeBase, ExportableNode, SchemaPropertiesNode): 12 | def get_properties_file(self): 13 | return str((Path(__file__).parent / Path('XLinkIn.properties.schema.json')).resolve().absolute()) 14 | 15 | def __init__(self, name): 16 | super(XLinkIn, self).__init__(name) 17 | self.add_properties() 18 | self.out = self.createOutputPin('out', 'MSenderPin') 19 | self.out.enableOptions(PinOptions.AllowMultipleConnections) 20 | 21 | @staticmethod 22 | def pinTypeHints(): 23 | helper = NodePinsSuggestionsHelper() 24 | helper.addInputDataType('StringPin') 25 | helper.addInputStruct(StructureType.Single) 26 | helper.addOutputDataType('MSenderPin') 27 | helper.addOutputStruct(StructureType.Multi) 28 | return helper 29 | 30 | @staticmethod 31 | def category(): 32 | return 'XLink' 33 | 34 | @staticmethod 35 | def keywords(): 36 | return [] 37 | 38 | @staticmethod 39 | def description(): 40 | return "Description in rst format." 41 | 42 | def compute(self, *args, **kwargs): 43 | self.out.setData(Frame()) 44 | -------------------------------------------------------------------------------- /DepthAI/Nodes/XLink/XLinkOut.properties.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://lpb.luxonis.com/schema/XLinkOut.properties.schema.json", 3 | "$schema": "http://json-schema.org/draft-07/schema#", 4 | "title": "XLinkOut Node Properties", 5 | "description": "Properties for XLinkOut which define stream name", 6 | "required": [ "streamName" ], 7 | "type": "object", 8 | "properties": { 9 | "streamName": { 10 | "type": "string", 11 | "maxLength": 32 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /DepthAI/Nodes/XLink/XLinkOut.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from PyFlow.Core import NodeBase 4 | from PyFlow.Core.Common import * 5 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 6 | 7 | from DepthAI.Nodes.common import ExportableNode, SchemaPropertiesNode 8 | 9 | 10 | class XLinkOut(NodeBase, ExportableNode, SchemaPropertiesNode): 11 | def get_properties_file(self): 12 | return str((Path(__file__).parent / Path('XLinkOut.properties.schema.json')).resolve().absolute()) 13 | 14 | def __init__(self, name): 15 | super(XLinkOut, self).__init__(name) 16 | self.add_properties() 17 | self.inp = self.createInputPin('inp', 'AnyPin') 18 | self.inp.enableOptions(PinOptions.AllowMultipleConnections) 19 | 20 | @staticmethod 21 | def pinTypeHints(): 22 | helper = NodePinsSuggestionsHelper() 23 | helper.addInputDataType('StringPin') 24 | helper.addInputDataType('AnyPin') 25 | helper.addInputStruct(StructureType.Multi) 26 | return helper 27 | 28 | @staticmethod 29 | def category(): 30 | return 'XLink' 31 | 32 | @staticmethod 33 | def keywords(): 34 | return [] 35 | 36 | @staticmethod 37 | def description(): 38 | return "Description in rst format." 39 | 40 | def compute(self, *args, **kwargs): 41 | _ = self.inp.getData() 42 | -------------------------------------------------------------------------------- /DepthAI/Nodes/XLink/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/XLink/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Nodes/__init__.py -------------------------------------------------------------------------------- /DepthAI/Nodes/common.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import NodeBase 4 | from jsonschema import RefResolver 5 | 6 | 7 | def node_id(node: NodeBase): 8 | return node.uid.int >> 64 9 | 10 | 11 | def get_node_by_uid(nodes, uid): 12 | for node in nodes: 13 | if str(node.uid) == str(uid): 14 | return node 15 | 16 | 17 | def get_pin_by_index(pins, index): 18 | for pin in pins: 19 | if pin.pinIndex == index: 20 | return pin 21 | 22 | 23 | class ExportableNode: 24 | def export(self): 25 | if not isinstance(self, NodeBase): 26 | raise ValueError("Cannot export node if not an instance of NodeBase") 27 | 28 | nodes = self.getWrapper().canvasRef().graphManager.findRootGraph().getNodesList() 29 | node_data = { 30 | "id": node_id(self), 31 | "name": self.name, 32 | "properties": { 33 | prop.name: prop.currentData() 34 | for prop in self.inputs.values() 35 | if not prop.hasConnections() 36 | }, 37 | } 38 | connections = [ 39 | { 40 | "node1Id": node_id(self), 41 | "node2Id": node_id(get_node_by_uid(nodes, link['rhsNodeUid'])), 42 | "node1Output": out.name, 43 | "node2Input": get_pin_by_index(get_node_by_uid(nodes, link['rhsNodeUid']).pins, link['inPinId']).name 44 | } 45 | for out in self.outputs.values() 46 | for link in out.linkedTo 47 | ] 48 | return node_data, connections 49 | 50 | 51 | class SchemaPropertiesNode: 52 | def get_properties_file(self): 53 | raise NotImplementedError() 54 | 55 | def add_properties(self): 56 | if not isinstance(self, NodeBase): 57 | raise ValueError("Cannot export node if not an instance of NodeBase") 58 | 59 | with open(self.get_properties_file(), 'r') as f: 60 | data = json.load(f) 61 | 62 | for key, value in data['properties'].items(): 63 | if 'type' not in value: 64 | continue 65 | pin = self._resolve_pin(key, value['type']) 66 | if pin is None: 67 | continue 68 | if 'default' in value: 69 | pin.setData(value['default']) 70 | setattr(self, key, pin) 71 | 72 | def _resolve_pin(self, value_name, value_type): 73 | if value_type == "string": 74 | return self.createInputPin(value_name, 'StringPin') 75 | elif value_type == "number": 76 | return self.createInputPin(value_name, 'FloatPin') 77 | elif value_type == "integer": 78 | return self.createInputPin(value_name, 'IntPin') 79 | elif value_type == "boolean": 80 | return self.createInputPin(value_name, 'BoolPin') 81 | else: 82 | return None 83 | -------------------------------------------------------------------------------- /DepthAI/Pins/BoundingBoxPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class BoundingBox: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return BoundingBox() 22 | 23 | 24 | class BoundingBoxPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(BoundingBoxPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(BoundingBox()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('BoundingBoxPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'BoundingBoxPin', BoundingBox() 51 | 52 | @staticmethod 53 | def color(): 54 | return (150, 200, 150, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return BoundingBox 59 | 60 | @staticmethod 61 | def processData(data): 62 | return BoundingBoxPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/DepthVectorPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class DepthVector: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return DepthVector() 22 | 23 | 24 | class DepthVectorPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(DepthVectorPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(DepthVector()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('DepthVectorPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'DepthVectorPin', DepthVector() 51 | 52 | @staticmethod 53 | def color(): 54 | return (200, 150, 50, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return DepthVector 59 | 60 | @staticmethod 61 | def processData(data): 62 | return DepthVectorPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/DetectionLabelPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class DetectionLabel: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return DetectionLabel() 22 | 23 | 24 | class DetectionLabelPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(DetectionLabelPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(DetectionLabel()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('DetectionLabelPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'DetectionLabelPin', DetectionLabel() 51 | 52 | @staticmethod 53 | def color(): 54 | return (100, 200, 50, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return DetectionLabel 59 | 60 | @staticmethod 61 | def processData(data): 62 | return DetectionLabelPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/FramePin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class Frame: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return Frame() 22 | 23 | 24 | class FramePin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(FramePin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(Frame()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('FramePin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'FramePin', Frame() 51 | 52 | @staticmethod 53 | def color(): 54 | return (255, 255, 255, 255) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return Frame 59 | 60 | @staticmethod 61 | def processData(data): 62 | return FramePin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/H264FramePin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class H264Frame: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return H264Frame() 22 | 23 | 24 | class H264FramePin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(H264FramePin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(H264Frame()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('H264FramePin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'H264FramePin', H264Frame() 51 | 52 | @staticmethod 53 | def color(): 54 | return (200, 100, 50, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return H264Frame 59 | 60 | @staticmethod 61 | def processData(data): 62 | return H264FramePin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/H265FramePin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class H265Frame: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return H265Frame() 22 | 23 | 24 | class H265FramePin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(H265FramePin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(H265Frame()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('H265FramePin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'H265FramePin', H265Frame() 51 | 52 | @staticmethod 53 | def color(): 54 | return (100, 150, 50, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return H265Frame 59 | 60 | @staticmethod 61 | def processData(data): 62 | return H265FramePin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/MSenderPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class MSenderPacket: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return MSenderPacket() 22 | 23 | 24 | class MSenderPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(MSenderPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(MSenderPacket()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('MSenderPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'MSenderPin', MSenderPacket() 51 | 52 | @staticmethod 53 | def color(): 54 | return (150, 100, 50, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return MSenderPacket 59 | 60 | @staticmethod 61 | def processData(data): 62 | return MSenderPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/NeuralTensorPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class NeuralTensor: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return NeuralTensor() 22 | 23 | 24 | class NeuralTensorPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(NeuralTensorPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(NeuralTensor()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('NeuralTensorPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'NeuralTensorPin', NeuralTensor() 51 | 52 | @staticmethod 53 | def color(): 54 | return (150, 100, 50, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return NeuralTensor 59 | 60 | @staticmethod 61 | def processData(data): 62 | return NeuralTensorPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/SSenderPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class SSenderPacket: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return SSenderPacket() 22 | 23 | 24 | class SSenderPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(SSenderPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(SSenderPacket()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('SSenderPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'SSenderPin', SSenderPacket() 51 | 52 | @staticmethod 53 | def color(): 54 | return (100, 150, 100, 127) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return SSenderPacket 59 | 60 | @staticmethod 61 | def processData(data): 62 | return SSenderPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/TrackingInfoPin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from PyFlow.Core import PinBase 4 | from PyFlow.Core.Common import * 5 | 6 | 7 | class TrackingInfo: 8 | pass 9 | 10 | 11 | class NoneEncoder(json.JSONEncoder): 12 | def default(self, vec3): 13 | return None 14 | 15 | 16 | class NoneDecoder(json.JSONDecoder): 17 | def __init__(self, *args, **kwargs): 18 | super(NoneDecoder, self).__init__(object_hook=self.object_hook, *args, **kwargs) 19 | 20 | def object_hook(self, vec3Dict): 21 | return TrackingInfo() 22 | 23 | 24 | class TrackingInfoPin(PinBase): 25 | """doc string for ImagePin""" 26 | 27 | def __init__(self, name, parent, direction, **kwargs): 28 | super(TrackingInfoPin, self).__init__(name, parent, direction, **kwargs) 29 | self.setDefaultValue(TrackingInfo()) 30 | self.disableOptions(PinOptions.Storable) 31 | 32 | @staticmethod 33 | def jsonEncoderClass(): 34 | return NoneEncoder 35 | 36 | @staticmethod 37 | def jsonDecoderClass(): 38 | return NoneDecoder 39 | 40 | @staticmethod 41 | def IsValuePin(): 42 | return True 43 | 44 | @staticmethod 45 | def supportedDataTypes(): 46 | return ('TrackingInfoPin',) 47 | 48 | @staticmethod 49 | def pinDataTypeHint(): 50 | return 'TrackingInfoPin', TrackingInfo() 51 | 52 | @staticmethod 53 | def color(): 54 | return (200, 200, 200, 255) 55 | 56 | @staticmethod 57 | def internalDataStructure(): 58 | return TrackingInfo 59 | 60 | @staticmethod 61 | def processData(data): 62 | return TrackingInfoPin.internalDataStructure()() 63 | -------------------------------------------------------------------------------- /DepthAI/Pins/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Pins/__init__.py -------------------------------------------------------------------------------- /DepthAI/Tools/CustomDeviceTool.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pathlib import Path 3 | 4 | from PyFlow import INITIALIZE 5 | from PyFlow.Core.Common import * 6 | from PyFlow.UI.Tool.Tool import ShelfTool 7 | from Qt import QtGui 8 | from Qt.QtWidgets import QMainWindow, QLineEdit, QLabel, QApplication, QCheckBox, QPushButton, QMessageBox 9 | 10 | 11 | # https://stackoverflow.com/a/44599922/5494277 12 | def append_to_json(_dict, path): 13 | with open(path, 'ab+') as f: 14 | f.seek(0, 2) # Go to the end of file 15 | if f.tell() == 0: # Check if file is empty 16 | f.write(json.dumps([_dict]).encode()) # If empty, write an array 17 | else: 18 | f.seek(-1, 2) 19 | f.truncate() # Remove the last character, open the array 20 | f.write(' , '.encode()) # Write the separator 21 | f.write(json.dumps(_dict).encode()) # Dump the dictionary 22 | f.write(']'.encode()) 23 | 24 | 25 | class Second(QMainWindow): 26 | def __init__(self): 27 | super(Second, self).__init__() 28 | self.setWindowTitle("Add new device") 29 | 30 | self.nameLabel = QLabel(self) 31 | self.nameLabel.move(10, 10) 32 | self.nameLabel.setText("Device name") 33 | self.nameEntry = QLineEdit(self) 34 | self.nameEntry.move(10, 40) 35 | self.nameEntry.resize(100, 30) 36 | 37 | self.colorLabel = QLabel(self) 38 | self.colorLabel.move(120, 10) 39 | self.colorLabel.setText("Color cameras") 40 | self.colorEntry = QLineEdit(self) 41 | self.colorEntry.move(140, 40) 42 | self.colorEntry.resize(70, 30) 43 | self.colorEntry.setValidator(QtGui.QIntValidator()) 44 | 45 | self.monoLabel = QLabel(self) 46 | self.monoLabel.move(230, 10) 47 | self.monoLabel.setText("Mono cameras") 48 | self.monoEntry = QLineEdit(self) 49 | self.monoEntry.move(250, 40) 50 | self.monoEntry.resize(70, 30) 51 | self.monoEntry.setValidator(QtGui.QIntValidator()) 52 | 53 | self.depthPresent = QCheckBox("Include depth", self) 54 | self.depthPresent.move(10, 80) 55 | self.depthPresent.resize(150, 30) 56 | self.depthPresent.stateChanged.connect(self.toggle_depth) 57 | 58 | self.leftfovLabel = QLabel(self) 59 | self.leftfovLabel.move(10, 120) 60 | self.leftfovLabel.setText("Left FOV deg.") 61 | self.leftfovEntry = QLineEdit(self) 62 | self.leftfovEntry.move(180, 120) 63 | self.leftfovEntry.resize(140, 30) 64 | self.leftfovEntry.setValidator(QtGui.QDoubleValidator()) 65 | 66 | self.rightfovLabel = QLabel(self) 67 | self.rightfovLabel.move(10, 160) 68 | self.rightfovLabel.setText("Right FOV deg.") 69 | self.rightfovEntry = QLineEdit(self) 70 | self.rightfovEntry.move(180, 160) 71 | self.rightfovEntry.resize(140, 30) 72 | self.rightfovEntry.setValidator(QtGui.QDoubleValidator()) 73 | 74 | self.rgbfovLabel = QLabel(self) 75 | self.rgbfovLabel.move(10, 200) 76 | self.rgbfovLabel.setText("RGB FOV deg.") 77 | self.rgbfovEntry = QLineEdit(self) 78 | self.rgbfovEntry.move(180, 200) 79 | self.rgbfovEntry.resize(140, 30) 80 | self.rgbfovEntry.setValidator(QtGui.QDoubleValidator()) 81 | 82 | self.lrdistanceLabel = QLabel(self) 83 | self.lrdistanceLabel.move(10, 240) 84 | self.lrdistanceLabel.resize(200, 30) 85 | self.lrdistanceLabel.setText("Left - Right distance cm.") 86 | self.lrdistanceEntry = QLineEdit(self) 87 | self.lrdistanceEntry.move(180, 240) 88 | self.lrdistanceEntry.resize(140, 30) 89 | self.lrdistanceEntry.setValidator(QtGui.QDoubleValidator()) 90 | 91 | self.lrgbdistanceLabel = QLabel(self) 92 | self.lrgbdistanceLabel.move(10, 280) 93 | self.lrgbdistanceLabel.resize(200, 30) 94 | self.lrgbdistanceLabel.setText("Left - RGB distance cm.") 95 | self.lrgbdistanceEntry = QLineEdit(self) 96 | self.lrgbdistanceEntry.move(180, 280) 97 | self.lrgbdistanceEntry.resize(140, 30) 98 | self.lrgbdistanceEntry.setValidator(QtGui.QDoubleValidator()) 99 | 100 | self.saveButton = QPushButton("Save", self) 101 | self.saveButton.resize(100, 30) 102 | self.saveButton.clicked.connect(self.save) 103 | 104 | self.cancelButton = QPushButton("Cancel", self) 105 | self.cancelButton.resize(100, 30) 106 | self.cancelButton.clicked.connect(self.cancel) 107 | 108 | self.toggle_depth(False) 109 | 110 | def toggle_depth(self, checked): 111 | if checked: 112 | self.leftfovLabel.setVisible(True) 113 | self.leftfovEntry.setVisible(True) 114 | self.rightfovLabel.setVisible(True) 115 | self.rightfovEntry.setVisible(True) 116 | self.rgbfovLabel.setVisible(True) 117 | self.rgbfovEntry.setVisible(True) 118 | self.lrdistanceLabel.setVisible(True) 119 | self.lrdistanceEntry.setVisible(True) 120 | self.lrgbdistanceLabel.setVisible(True) 121 | self.lrgbdistanceEntry.setVisible(True) 122 | self.saveButton.move(200, 330) 123 | self.cancelButton.move(30, 330) 124 | self.resize(330, 380) 125 | else: 126 | self.leftfovLabel.setVisible(False) 127 | self.leftfovEntry.setVisible(False) 128 | self.rightfovLabel.setVisible(False) 129 | self.rightfovEntry.setVisible(False) 130 | self.rgbfovLabel.setVisible(False) 131 | self.rgbfovEntry.setVisible(False) 132 | self.lrdistanceLabel.setVisible(False) 133 | self.lrdistanceEntry.setVisible(False) 134 | self.lrgbdistanceLabel.setVisible(False) 135 | self.lrgbdistanceEntry.setVisible(False) 136 | self.saveButton.move(200, 120) 137 | self.cancelButton.move(30, 120) 138 | self.resize(330, 170) 139 | 140 | def save(self, *args, **kwargs): 141 | try: 142 | data = { 143 | "name": self.nameEntry.text(), 144 | "color_count": int(self.colorEntry.text()), 145 | "mono_count": int(self.monoEntry.text()), 146 | } 147 | if self.depthPresent.isChecked(): 148 | data.update({ 149 | "depth": True, 150 | "left_fov_deg": float(self.leftfovEntry.text()), 151 | "right_fov_deg": float(self.rightfovEntry.text()), 152 | "rgb_fov_deg": float(self.rgbfovEntry.text()), 153 | "left_to_right_distance_cm": float(self.lrdistanceEntry.text()), 154 | "left_to_rgb_distance_cm": float(self.lrgbdistanceEntry.text()), 155 | }) 156 | append_to_json(data, Path(__file__).parent.parent / Path('custom_devices.json')) 157 | self.close() 158 | INITIALIZE() 159 | self.instance.getRegisteredTools(['NodeBoxTool'])[0].refresh() 160 | except Exception as e: 161 | QMessageBox.warning(self, "Warning", str(e)) 162 | 163 | def cancel(self): 164 | self.close() 165 | 166 | 167 | class CustomDeviceTool(ShelfTool): 168 | """docstring for AlignBottomTool.""" 169 | 170 | def __init__(self): 171 | super(CustomDeviceTool, self).__init__() 172 | self.dialog = Second() 173 | 174 | @staticmethod 175 | def toolTip(): 176 | return "Add custom DepthAI device" 177 | 178 | @staticmethod 179 | def getIcon(): 180 | return QtGui.QIcon(str((Path(__file__).parent / Path('res/usb.png')).resolve().absolute())) 181 | 182 | @staticmethod 183 | def name(): 184 | return "CustomDeviceTool" 185 | 186 | def do(self): 187 | setattr(self.dialog, 'instance', self.pyFlowInstance) 188 | self.dialog.show() 189 | 190 | 191 | if __name__ == '__main__': 192 | app = QApplication(sys.argv) 193 | ex = Second() 194 | ex.show() 195 | sys.exit(app.exec_()) 196 | -------------------------------------------------------------------------------- /DepthAI/Tools/ExportTool.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pathlib import Path 3 | 4 | from PyFlow.Core.Common import * 5 | from PyFlow.UI.Tool.Tool import ShelfTool 6 | from Qt import QtGui 7 | from Qt.QtWidgets import QFileDialog, QMessageBox 8 | 9 | from DepthAI.Nodes.Global.GlobalPropertiesNode import GlobalPropertiesNode 10 | from DepthAI.Nodes.common import ExportableNode 11 | 12 | 13 | def get_pin_value(pins, name): 14 | for pin in pins: 15 | if pin.name == name: 16 | return pin.currentData() 17 | 18 | 19 | class ExportTool(ShelfTool): 20 | """docstring for AlignBottomTool.""" 21 | 22 | def __init__(self): 23 | super(ExportTool, self).__init__() 24 | 25 | @staticmethod 26 | def toolTip(): 27 | return "Export Pipeline Configuration as JSON" 28 | 29 | @staticmethod 30 | def getIcon(): 31 | return QtGui.QIcon(str((Path(__file__).parent / Path('res/export.png')).resolve().absolute())) 32 | 33 | @staticmethod 34 | def name(): 35 | return "ExportPipeline" 36 | 37 | def do(self): 38 | try: 39 | rootGraph = self.pyFlowInstance.graphManager.get().findRootGraph() 40 | nodes = [] 41 | connections = [] 42 | global_config = {} 43 | for node in rootGraph.getNodesList(): 44 | if node.name == GlobalPropertiesNode.__name__: 45 | global_config["pipeline_version"] = "test" 46 | global_config["Leon OS frequency [kHz]"] = get_pin_value(node.inputs.values(), 'leon_os_freq') 47 | elif not isinstance(node, ExportableNode): 48 | continue 49 | node, node_connections = node.export() 50 | nodes.append(node) 51 | connections += node_connections 52 | 53 | export = json.dumps({ 54 | "globalProperties": global_config, 55 | "nodes": nodes, 56 | "connections": connections 57 | }) 58 | 59 | outFilePath, filterString = QFileDialog.getSaveFileName(filter="Pipeline config (*.json)") 60 | if outFilePath != "": 61 | with open(outFilePath, 'w') as f: 62 | f.write(export) 63 | print("saved!") 64 | except Exception as e: 65 | QMessageBox.warning(self.pyFlowInstance, "Warning", str(e)) 66 | 67 | -------------------------------------------------------------------------------- /DepthAI/Tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Tools/__init__.py -------------------------------------------------------------------------------- /DepthAI/Tools/res/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Tools/res/export.png -------------------------------------------------------------------------------- /DepthAI/Tools/res/usb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/Tools/res/usb.png -------------------------------------------------------------------------------- /DepthAI/UI/NodeFactory.py: -------------------------------------------------------------------------------- 1 | from PyFlow.UI.Canvas.UINodeBase import UINodeBase 2 | 3 | from DepthAI.Nodes.Debug.FramePreviewNode import FramePreviewNode 4 | from DepthAI.UI.UIStreamPreviewNode import UIStreamPreviewNode 5 | 6 | 7 | def createNodeDepthAI(raw_instance): 8 | if isinstance(raw_instance, FramePreviewNode): 9 | return UIStreamPreviewNode(raw_instance) 10 | return UINodeBase(raw_instance) 11 | -------------------------------------------------------------------------------- /DepthAI/UI/UIStreamPreviewNode.py: -------------------------------------------------------------------------------- 1 | from PyFlow.UI.Canvas.UINodeBase import UINodeBase 2 | from Qt import QtGui 3 | from Qt.QtWidgets import QLabel 4 | 5 | 6 | class UIStreamPreviewNode(UINodeBase): 7 | def __init__(self, raw_node): 8 | super(UIStreamPreviewNode, self).__init__(raw_node) 9 | self.resizable = True 10 | self.Imagelabel = QLabel("test3") 11 | self.pixmap = QtGui.QPixmap(None) 12 | self.addWidget(self.Imagelabel) 13 | self.updateSize() 14 | 15 | def paint(self, painter, option, widget): 16 | self.updateSize() 17 | super(UIStreamPreviewNode, self).paint(painter, option, widget) 18 | 19 | def updateSize(self): 20 | self.pixmap = QtGui.QPixmap(self._rawNode.label.getData()) 21 | scaledPixmap = self.pixmap.scaledToWidth(self.customLayout.geometry().width()) 22 | self.Imagelabel.setPixmap(scaledPixmap) 23 | -------------------------------------------------------------------------------- /DepthAI/UI/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/DepthAI/UI/__init__.py -------------------------------------------------------------------------------- /DepthAI/__init__.py: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME = 'DepthAI' 2 | 3 | from collections import OrderedDict 4 | from PyFlow.UI.UIInterfaces import IPackage 5 | import json 6 | from pathlib import Path 7 | from PyFlow.Core.Common import PinOptions 8 | from PyFlow.Core import NodeBase 9 | from PyFlow.Core.NodeBase import NodePinsSuggestionsHelper 10 | 11 | # Class based nodes 12 | from DepthAI.Nodes.Test.DemoNode import DemoNode 13 | from DepthAI.Nodes.Test.MyProducer import MyProducer 14 | from DepthAI.Nodes.Devices.BW1093 import BW1093 15 | from DepthAI.Nodes.Devices.BW1097 import BW1097 16 | from DepthAI.Nodes.Devices.BW1098OBC import BW1098OBC 17 | from DepthAI.Nodes.Devices.BW1098FFC import BW1098FFC 18 | from DepthAI.Nodes.Debug.FramePreviewNode import FramePreviewNode 19 | from DepthAI.Nodes.CustomNeuralNetwork.ClassificationNetworkNode import ClassificationNetworkNode 20 | from DepthAI.Nodes.CustomNeuralNetwork.DetectorNetworkNode import DetectorNetworkNode 21 | from DepthAI.Nodes.CustomNeuralNetwork.OCRNetworkNode import OCRNetworkNode 22 | from DepthAI.Nodes.CustomNeuralNetwork.RawNetworkNode import RawNetworkNode 23 | from DepthAI.Nodes.XLink.XLinkIn import XLinkIn 24 | from DepthAI.Nodes.XLink.XLinkOut import XLinkOut 25 | from DepthAI.Nodes.Global.GlobalPropertiesNode import GlobalPropertiesNode 26 | from DepthAI.Nodes.Encodings.H264EncodingNode import H264EncodingNode 27 | from DepthAI.Nodes.Encodings.H265EncodingNode import H265EncodingNode 28 | from DepthAI.Nodes.FrameOps.ROICropNode import ROICropNode 29 | from DepthAI.Nodes.FrameOps.DepthLocationNode import DepthLocationNode 30 | from DepthAI.Nodes.FrameOps.ObjectTrackerNode import ObjectTrackerNode 31 | from DepthAI.Nodes.FrameOps.DigitalZoomNode import DigitalZoomNode 32 | from DepthAI.Nodes.FrameOps.BackgroundSubstractionNode import BackgroundSubstractionNode 33 | from DepthAI.Nodes.ModelZoo.AgeGenderDetectionNode import AgeGenderDetectionNode 34 | from DepthAI.Nodes.ModelZoo.EmotionsRecognitionNode import EmotionsRecognitionNode 35 | from DepthAI.Nodes.ModelZoo.FaceDetectionAdas1Node import FaceDetectionAdas1Node 36 | from DepthAI.Nodes.ModelZoo.FaceDetectionRetail4Node import FaceDetectionRetail4Node 37 | from DepthAI.Nodes.ModelZoo.FacialLandmarksAdas2Node import FacialLandmarksAdas2Node 38 | from DepthAI.Nodes.ModelZoo.FacialLandmarksRetail9Node import FacialLandmarksRetail9Node 39 | from DepthAI.Nodes.ModelZoo.MobilenetSSDNode import MobilenetSSDNode 40 | from DepthAI.Nodes.ModelZoo.OCRNode import OCRNode 41 | from DepthAI.Nodes.ModelZoo.PedestrianDetectionAdas2Node import PedestrianDetectionAdas2Node 42 | from DepthAI.Nodes.ModelZoo.PedestrianDetectionRetail13Node import PedestrianDetectionRetail13Node 43 | from DepthAI.Nodes.ModelZoo.PersonVehicleBikeDetectionNode import PersonVehicleBikeDetectionNode 44 | from DepthAI.Nodes.ModelZoo.VehicleDetectionAdas2Node import VehicleDetectionAdas2Node 45 | from DepthAI.Nodes.ModelZoo.VehicleLicensePlateDetectionNode import VehicleLicensePlateDetectionNode 46 | 47 | # Pins 48 | from DepthAI.Pins.FramePin import FramePin 49 | from DepthAI.Pins.BoundingBoxPin import BoundingBoxPin 50 | from DepthAI.Pins.DetectionLabelPin import DetectionLabelPin 51 | from DepthAI.Pins.NeuralTensorPin import NeuralTensorPin 52 | from DepthAI.Pins.DepthVectorPin import DepthVectorPin 53 | from DepthAI.Pins.MSenderPin import MSenderPin 54 | from DepthAI.Pins.SSenderPin import SSenderPin 55 | from DepthAI.Pins.H264FramePin import H264FramePin 56 | from DepthAI.Pins.H265FramePin import H265FramePin 57 | from DepthAI.Pins.TrackingInfoPin import TrackingInfoPin 58 | 59 | # Tools 60 | from DepthAI.Tools.ExportTool import ExportTool 61 | from DepthAI.Tools.CustomDeviceTool import CustomDeviceTool 62 | 63 | # Factories 64 | from DepthAI.UI.NodeFactory import createNodeDepthAI 65 | 66 | _FOO_LIBS = {} 67 | _NODES = {} 68 | _PINS = {} 69 | _TOOLS = OrderedDict() 70 | _PREFS_WIDGETS = OrderedDict() 71 | _EXPORTERS = OrderedDict() 72 | 73 | NODES_TO_ADD = [ 74 | DemoNode, MyProducer, BW1093, BW1097, BW1098OBC, VehicleLicensePlateDetectionNode, VehicleDetectionAdas2Node, 75 | XLinkOut, GlobalPropertiesNode, ClassificationNetworkNode, H264EncodingNode, H265EncodingNode, ROICropNode, XLinkIn, 76 | DetectorNetworkNode, DepthLocationNode, ObjectTrackerNode, DigitalZoomNode, BackgroundSubstractionNode, BW1098FFC, 77 | AgeGenderDetectionNode, EmotionsRecognitionNode, FaceDetectionAdas1Node, FaceDetectionRetail4Node, OCRNetworkNode, 78 | FacialLandmarksAdas2Node, FacialLandmarksRetail9Node, MobilenetSSDNode, OCRNode, PedestrianDetectionAdas2Node, 79 | PedestrianDetectionRetail13Node, PersonVehicleBikeDetectionNode, RawNetworkNode, FramePreviewNode, 80 | ] 81 | 82 | for node in NODES_TO_ADD: 83 | _NODES[node.__name__] = node 84 | 85 | PINS_TO_ADD = [ 86 | FramePin, NeuralTensorPin, BoundingBoxPin, DetectionLabelPin, DepthVectorPin, MSenderPin, SSenderPin, H264FramePin, 87 | H265FramePin, TrackingInfoPin 88 | ] 89 | 90 | for pin in PINS_TO_ADD: 91 | _PINS[pin.__name__] = pin 92 | 93 | TOOLS_TO_ADD = [ExportTool, CustomDeviceTool] 94 | 95 | for tool in TOOLS_TO_ADD: 96 | _TOOLS[tool.__name__] = tool 97 | 98 | 99 | class DepthAI(IPackage): 100 | def __init__(self): 101 | super(DepthAI, self).__init__() 102 | 103 | @staticmethod 104 | def GetExporters(): 105 | return _EXPORTERS 106 | 107 | @staticmethod 108 | def GetFunctionLibraries(): 109 | return _FOO_LIBS 110 | 111 | @staticmethod 112 | def GetNodeClasses(): 113 | nodes = DepthAI.addDynamicNodes(_NODES.copy()) 114 | return nodes 115 | 116 | @staticmethod 117 | def UINodesFactory(): 118 | return createNodeDepthAI 119 | 120 | @staticmethod 121 | def GetPinClasses(): 122 | return _PINS 123 | 124 | @staticmethod 125 | def GetToolClasses(): 126 | return _TOOLS 127 | 128 | @staticmethod 129 | def addDynamicNodes(nodes): 130 | path = Path(__file__).parent / Path('custom_devices.json') 131 | if not path.exists(): 132 | return nodes 133 | with open(path, 'r') as f: 134 | data = json.load(f) 135 | for item in data: 136 | def node_init(self, name): 137 | NodeBase.__init__(self, name) 138 | for i in range(item['color_count']): 139 | node_pin = NodeBase.createOutputPin(self, f'color_{i}', 'FramePin') 140 | node_pin.enableOptions(PinOptions.AllowMultipleConnections) 141 | setattr(self, f'color_{i}', node_pin) 142 | for i in range(item['mono_count']): 143 | node_pin = NodeBase.createOutputPin(self, f'mono_{i}', 'FramePin') 144 | node_pin.enableOptions(PinOptions.AllowMultipleConnections) 145 | setattr(self, f'mono_{i}', node_pin) 146 | 147 | def node_category(): 148 | return 'Custom Devices' 149 | 150 | def node_compute(self, *args, **kwargs): 151 | pass 152 | 153 | def node_pin_type_hints(): 154 | helper = NodePinsSuggestionsHelper() 155 | return helper 156 | 157 | def node_keywords(): 158 | return [] 159 | 160 | def node_description(*args, **kwargs): 161 | return "Description in rst format." 162 | 163 | nodes[item['name']] = type( 164 | item['name'], 165 | (NodeBase,), 166 | { 167 | "__init__": node_init, 168 | "compute": node_compute 169 | } 170 | ) 171 | setattr(nodes[item['name']], 'category', node_category) 172 | setattr(nodes[item['name']], 'pinTypeHints', node_pin_type_hints) 173 | setattr(nodes[item['name']], 'keywords', node_keywords) 174 | setattr(nodes[item['name']], 'description', node_description) 175 | return nodes 176 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Luxonis Holding Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DepthAI-PyFlow 2 | **DepthAI-PyFlow** is a easy to use rapid prototyping GUI tool for creating custom AI pipelines on **DepthAI** hardware. 3 | **DepthAI-PyFlow** enables you to drag and drop building blocks and compose a desired pipeline, that when exported, will be able to run and produce 4 | desired results - with no coding needed! 5 | 6 | ![quickdemo](docs/img/demo.gif) 7 | 8 | **PyFlow** is a general-purpose Visual Dataflow Programming library. Nodes represent algorithms with certain inputs and outputs. Connections transfer data from the output (source) of the first node to the input (sink) of the second one. **DepthAI-PyFlow** is a visual scripting extension for PyFlow for DepthAI. 9 | 10 | # Installation 11 | **DepthAI-PyFlow is not a standalone software, it is an extension package of PyFlow. PyFlow has to be installed first.** You can refer to [PyFlow Project](https://github.com/wonderworks-software/PyFlow) to install PyFlow. 12 | 13 | The easy way to install PyFlow is:: 14 | ```bash 15 | pip install git+https://github.com/wonderworks-software/PyFlow.git@master 16 | ``` 17 | 18 | After PyFlow installed through pip or setup.py. 19 | 20 | Clone or download DepthAI-PyFlow repository 21 | ```bash 22 | git clone https://github.com/luxonis/DepthAI-PyFlow.git 23 | ``` 24 | Install requirements for your use case:: 25 | 26 | ```bash 27 | pip install -r requirements.txt 28 | ``` 29 | 30 | To run the program in standalone mode, you can invoke pyflow.exe on windows or pyflow on unix OS. Program is located inside PATH/TO/PYTHON/Scripts. You can also 31 | run pyflow.py in the root folder of PyFlow(not DepthAI-PyFlow) project. 32 | 33 | You can enable the DepthAI-PyFlow package by one of the following ways ( Just pick one, not all). 34 | 35 | - put the addition package path to 'Additional package locations' on preferences dialog.Make sure you add path of PyFlow/Packages under DepthAI-PyFlow project to the 'additional package location' edit. 36 | ![addpackage](docs/img/preferences.png) 37 | - Copy the DepthAI-PyFlow package to .PyFlow/Packages 38 | - User can add location of package to env variable for PYTHONPATH 39 | - Paths listed in PYFLOW_PACKAGES_PATHS env variable (; separated string) 40 | 41 | If everything works out, you should able to see 'DepthAI' in your NodeBox dialog of the GUI. 42 | 43 | ![gui](docs/img/correctconfig.png) 44 | 45 | 46 | ## Getting Started 47 | 48 | To allow you to start smoothly: 49 | - [PyFlow documentation](https://pyflow.readthedocs.io/en/latest/) will allow you to understand how to use GUI 50 | - [Here's an issue](https://github.com/luxonis/depthai/issues/136) describing the overall concept of this tool 51 | - [DepthAI documentation](https://docs.luxonis.com/) describing what the DepthAI is and how to use it 52 | - [DepthAI store](https://shop.luxonis.com/) for you to grab one of the DepthAI device and deploy built pipeline to it 53 | 54 | 55 | ## Discussion / Support 56 | 57 | Join us to our [discuss](https://discuss.luxonis.com/) / [slack](https://join.slack.com/t/luxonis-community/shared_invite/zt-emg3tas3-C_Q38TI5nZbKUazZdxwvXw) or [write us and email](mailto:support@luxonis.com) or [post comment under original issue](https://github.com/luxonis/depthai/issues/136) 58 | and ask anything related to project! 59 | Please also let us know what features you'd need to achieve your goal with DepthAI - we'll be happy to help! 60 | 61 | ## Attributions 62 | 63 | Icons made by [Smartline](https://www.flaticon.com/authors/smartline) from [www.flaticon.com](https://www.flaticon.com/) -------------------------------------------------------------------------------- /docs/img/correctconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/docs/img/correctconfig.png -------------------------------------------------------------------------------- /docs/img/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/docs/img/demo.gif -------------------------------------------------------------------------------- /docs/img/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luxonis/DepthAI-PyFlow/500308bc976f07d114305d7fecb50fe2039f54fe/docs/img/preferences.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | -r https://raw.githubusercontent.com/wonderworks-software/PyFlow/master/requirements/requirements-standalone.txt 2 | jsonschema==3.2.0 --------------------------------------------------------------------------------