11#include " CommonBindings.hpp"
22
3+ #include < pybind11/pybind11.h>
4+
35// Libraries
46#include " hedley/hedley.h"
57
1921#include " depthai/common/EepromData.hpp"
2022#include " depthai/common/FrameEvent.hpp"
2123#include " depthai/common/Interpolation.hpp"
24+ #include " depthai/common/Keypoint.hpp"
2225#include " depthai/common/MemoryInfo.hpp"
2326#include " depthai/common/Point2f.hpp"
2427#include " depthai/common/Point3d.hpp"
3235#include " depthai/common/StereoPair.hpp"
3336#include " depthai/common/Timestamp.hpp"
3437#include " depthai/common/UsbSpeed.hpp"
38+ #include " depthai/common/YoloDecodingFamily.hpp"
3539
3640// depthai
3741#include " depthai/common/CameraExposureOffset.hpp"
@@ -67,6 +71,7 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack) {
6771 py::enum_<UsbSpeed> usbSpeed (m, " UsbSpeed" , DOC (dai, UsbSpeed));
6872 py::enum_<ProcessorType> processorType (m, " ProcessorType" );
6973 py::enum_<DetectionNetworkType> detectionNetworkType (m, " DetectionNetworkType" );
74+ py::enum_<YoloDecodingFamily> yoloDecodingFamily (m, " YoloDecodingFamily" );
7075 py::enum_<SerializationType> serializationType (m, " SerializationType" );
7176 py::class_<DetectionParserOptions> detectionParserOptions (m, " DetectionParserOptions" , DOC (dai, DetectionParserOptions));
7277 py::class_<RotatedRect> rotatedRect (m, " RotatedRect" , DOC (dai, RotatedRect));
@@ -78,6 +83,8 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack) {
7883 py::enum_<FrameEvent> frameEvent (m, " FrameEvent" , DOC (dai, FrameEvent));
7984 py::class_<ProfilingData> profilingData (m, " ProfilingData" , DOC (dai, ProfilingData));
8085 py::enum_<Interpolation> interpolation (m, " Interpolation" , DOC (dai, Interpolation));
86+ py::class_<Keypoint> keypoint (m, " Keypoint" , DOC (dai, Keypoint));
87+ py::class_<KeypointsList> keypointsList (m, " KeypointsList" , DOC (dai, KeypointsList));
8188
8289 // /////////////////////////////////////////////////////////////////////
8390 // /////////////////////////////////////////////////////////////////////
@@ -92,6 +99,51 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack) {
9299 // /////////////////////////////////////////////////////////////////////
93100 // /////////////////////////////////////////////////////////////////////
94101
102+ keypoint.def (py::init<>())
103+ .def (py::init<Point3f, float , uint32_t >(), py::arg (" coordinates" ), py::arg (" confidence" ) = 0 .f , py::arg (" label" ) = 0 , DOC (dai, Keypoint, Keypoint))
104+ .def (py::init<Point2f, float , uint32_t >(), py::arg (" coordinates" ), py::arg (" confidence" ) = 0 .f , py::arg (" label" ) = 0 , DOC (dai, Keypoint, Keypoint))
105+ .def (py::init<float , float , float , float , uint32_t >(),
106+ py::arg (" x" ),
107+ py::arg (" y" ),
108+ py::arg (" z" ),
109+ py::arg (" confidence" ) = 0 .f ,
110+ py::arg (" label" ) = 0 ,
111+ DOC (dai, Keypoint, Keypoint))
112+ .def_readwrite (" imageCoordinates" , &Keypoint::imageCoordinates, DOC (dai, Keypoint, imageCoordinates))
113+ .def_readwrite (" confidence" , &Keypoint::confidence, DOC (dai, Keypoint, confidence))
114+ .def_readwrite (" label" , &Keypoint::label, DOC (dai, Keypoint, label));
115+
116+ keypointsList.def (py::init<>())
117+ .def (py::init<std::vector<Keypoint>, std::vector<Edge>>(), py::arg (" keypoints" ), py::arg (" edges" ), DOC (dai, KeypointsListT, KeypointsListT))
118+ .def (py::init<std::vector<Keypoint>>(), py::arg (" keypoints" ), DOC (dai, KeypointsListT, KeypointsListT))
119+ .def (
120+ " setKeypoints" ,
121+ [](KeypointsList& self, const std::vector<Keypoint>& kps) { self.Base ::setKeypoints (kps); },
122+ py::arg (" keypoints" ),
123+ DOC (dai, KeypointsListT, setKeypoints))
124+ .def (" setKeypoints" ,
125+ py::overload_cast<const std::vector<Point3f>>(&KeypointsList::setKeypoints),
126+ py::arg (" keypoints" ),
127+ DOC (dai, KeypointsListT, setKeypoints))
128+ .def (" setKeypoints" ,
129+ py::overload_cast<const std::vector<Point2f>>(&KeypointsList::setKeypoints),
130+ py::arg (" keypoints" ),
131+ DOC (dai, KeypointsListT, setKeypoints))
132+ .def (
133+ " setKeypoints" ,
134+ [](KeypointsList& self, std::vector<Keypoint> keypoints, std::vector<Edge> edges) {
135+ self.Base ::setKeypoints (std::move (keypoints), std::move (edges));
136+ },
137+ py::arg (" keypoints" ),
138+ py::arg (" edges" ),
139+ DOC (dai, KeypointsListT, setKeypoints))
140+ .def (
141+ " setEdges" , [](KeypointsList& self, const std::vector<Edge>& edges) { self.Base ::setEdges (edges); }, py::arg (" edges" ))
142+ .def (" getKeypoints" , &KeypointsList::getKeypoints, DOC (dai, KeypointsListT, getKeypoints))
143+ .def (" getEdges" , &KeypointsList::getEdges, DOC (dai, KeypointsListT, getEdges))
144+ .def (" getPoints3f" , &KeypointsList::getPoints3f, DOC (dai, KeypointsListT, getPoints3f))
145+ .def (" getPoints2f" , &KeypointsList::getPoints2f, DOC (dai, KeypointsListT, getPoints2f));
146+
95147 rotatedRect.def (py::init<>())
96148 .def (py::init<Point2f, Size2f, float >())
97149 .def (py::init<Rect, float >())
@@ -102,7 +154,9 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack) {
102154 .def (" normalize" , &RotatedRect::normalize, py::arg (" width" ), py::arg (" height" ), DOC (dai, RotatedRect, normalize))
103155 .def (" denormalize" , &RotatedRect::denormalize, py::arg (" width" ), py::arg (" height" ), py::arg (" force" ) = false , DOC (dai, RotatedRect, denormalize))
104156 .def (" getPoints" , &RotatedRect::getPoints, DOC (dai, RotatedRect, getPoints))
105- .def (" getOuterRect" , &RotatedRect::getOuterRect, DOC (dai, RotatedRect, getOuterRect));
157+ .def (" getOuterRect" , &RotatedRect::getOuterRect, DOC (dai, RotatedRect, getOuterRect))
158+ .def (" getOuterXYWH" , &RotatedRect::getOuterXYWH, DOC (dai, RotatedRect, getOuterXYWH))
159+ .def (" getOuterCXCYWH" , &RotatedRect::getOuterCXCYWH, DOC (dai, RotatedRect, getOuterCXCYWH));
106160
107161 rect.def (py::init<>())
108162 .def (py::init<float , float , float , float >())
@@ -360,6 +414,11 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack) {
360414
361415 detectionNetworkType.value (" YOLO" , DetectionNetworkType::YOLO).value (" MOBILENET" , DetectionNetworkType::MOBILENET);
362416
417+ yoloDecodingFamily.value (" TLBR" , YoloDecodingFamily::TLBR)
418+ .value (" v5AB" , YoloDecodingFamily::v5AB)
419+ .value (" v3AB" , YoloDecodingFamily::v3AB)
420+ .value (" R1AF" , YoloDecodingFamily::R1AF);
421+
363422 serializationType.value (" LIBNOP" , SerializationType::LIBNOP).value (" JSON" , SerializationType::JSON).value (" JSON_MSGPACK" , SerializationType::JSON_MSGPACK);
364423
365424 detectionParserOptions.def_readwrite (" nnFamily" , &DetectionParserOptions::nnFamily)
@@ -368,7 +427,13 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack) {
368427 .def_readwrite (" coordinates" , &DetectionParserOptions::coordinates)
369428 .def_readwrite (" anchors" , &DetectionParserOptions::anchors)
370429 .def_readwrite (" anchorMasks" , &DetectionParserOptions::anchorMasks)
371- .def_readwrite (" iouThreshold" , &DetectionParserOptions::iouThreshold);
430+ .def_readwrite (" iouThreshold" , &DetectionParserOptions::iouThreshold)
431+ .def_readwrite (" decodingFamily" , &DetectionParserOptions::decodingFamily)
432+ .def_readwrite (" keypointEdges" , &DetectionParserOptions::keypointEdges)
433+ .def_readwrite (" anchorsV2" , &DetectionParserOptions::anchorsV2)
434+ .def_readwrite (" decodeKeypoints" , &DetectionParserOptions::decodeKeypoints)
435+ .def_readwrite (" numKeypoints" , &DetectionParserOptions::nKeypoints)
436+ .def_readwrite (" outputNames" , &DetectionParserOptions::outputNamesToUse);
372437
373438 cameraExposureOffset.value (" START" , CameraExposureOffset::START).value (" MIDDLE" , CameraExposureOffset::MIDDLE).value (" END" , CameraExposureOffset::END);
374439
0 commit comments