-
Notifications
You must be signed in to change notification settings - Fork 159
Feature/vpp node #1528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JakubFara
wants to merge
9
commits into
develop
Choose a base branch
from
feature/vpp_node
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/vpp node #1528
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c78c2d3
Vpp node added
43d464f
Change depthai-device commit
JakubFara 3b9e14a
Add missing bindings
JakubFara fd79ed3
Add setters and docstrings for VppConfig
JakubFara 59d7650
Remove redundant includes
JakubFara d4e85db
Add docstirngs to python bindings.
JakubFara 4ee081e
Formating change
JakubFara 361c95f
Add RVC4 check
JakubFara 9f14311
Change depthai-device commit
JakubFara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
bindings/python/src/pipeline/datatype/VppConfigBindings.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #include <memory> | ||
| #include <unordered_map> | ||
|
|
||
| #include "DatatypeBindings.hpp" | ||
| #include "pipeline/CommonBindings.hpp" | ||
|
|
||
| // depthai | ||
| #include "depthai/pipeline/datatype/VppConfig.hpp" | ||
|
|
||
| // pybind | ||
| #include <pybind11/chrono.h> | ||
| #include <pybind11/numpy.h> | ||
|
|
||
| void bind_vppconfig(pybind11::module& m, void* pCallstack) { | ||
| using namespace dai; | ||
| using namespace pybind11::literals; | ||
|
|
||
| // --------------------------------------------------------------------- | ||
| // ENUM: PatchColoringType | ||
| // --------------------------------------------------------------------- | ||
| py::enum_<VppConfig::PatchColoringType>(m, "VppPatchColoringType", DOC(dai, VppConfig, PatchColoringType)) | ||
| .value("RANDOM", VppConfig::PatchColoringType::RANDOM, "Random patch coloring") | ||
| .value("MAXDIST", VppConfig::PatchColoringType::MAXDIST, "Color with most distant color"); | ||
|
|
||
| // --------------------------------------------------------------------- | ||
| // STRUCT: InjectionParameters | ||
| // --------------------------------------------------------------------- | ||
| py::class_<VppConfig::InjectionParameters>(m, "VppInjectionParameters", DOC(dai, VppConfig, InjectionParameters)) | ||
| .def(py::init<>()) | ||
| .def_readwrite("useInjection", &VppConfig::InjectionParameters::useInjection, DOC(dai, VppConfig, InjectionParameters, useInjection)) | ||
| .def_readwrite("kernelSize", &VppConfig::InjectionParameters::kernelSize, DOC(dai, VppConfig, InjectionParameters, kernelSize)) | ||
| .def_readwrite("textureThreshold", &VppConfig::InjectionParameters::textureThreshold, DOC(dai, VppConfig, InjectionParameters, textureThreshold)) | ||
| .def_readwrite( | ||
| "confidenceThreshold", &VppConfig::InjectionParameters::confidenceThreshold, DOC(dai, VppConfig, InjectionParameters, confidenceThreshold)) | ||
| .def_readwrite( | ||
| "morphologyIterations", &VppConfig::InjectionParameters::morphologyIterations, DOC(dai, VppConfig, InjectionParameters, morphologyIterations)) | ||
| .def_readwrite("useMorphology", &VppConfig::InjectionParameters::useMorphology, DOC(dai, VppConfig, InjectionParameters, useMorphology)) | ||
| .def("__repr__", [](const VppConfig::InjectionParameters& p) { | ||
| return "<VppInjectionParameters useInjection=" + std::to_string(p.useInjection) + ", kernelSize=" + std::to_string(p.kernelSize) | ||
| + ", textureThreshold=" + std::to_string(p.textureThreshold) + ", confidenceThreshold=" + std::to_string(p.confidenceThreshold) | ||
| + ", morphologyIterations=" + std::to_string(p.morphologyIterations) + ", useMorphology=" + std::to_string(p.useMorphology) + ">"; | ||
| }); | ||
|
|
||
| // --------------------------------------------------------------------- | ||
| // CLASS: VppConfig | ||
| // --------------------------------------------------------------------- | ||
| py::class_<VppConfig, Py<VppConfig>, Buffer, std::shared_ptr<VppConfig>> vppConfig(m, "VppConfig", DOC(dai, VppConfig)); | ||
|
|
||
| // Bindings setup continuation (DepthAI callstack pattern) | ||
| Callstack* callstack = (Callstack*)pCallstack; | ||
| auto cb = callstack->top(); | ||
| callstack->pop(); | ||
| cb(m, pCallstack); | ||
|
|
||
| // --------------------------------------------------------------------- | ||
| // Actual bindings | ||
| // --------------------------------------------------------------------- | ||
| vppConfig.def(py::init<>()) | ||
| .def("__repr__", &VppConfig::str) | ||
| .def_readwrite("blending", &VppConfig::blending, DOC(dai, VppConfig, blending)) | ||
| .def_readwrite("distanceGamma", &VppConfig::distanceGamma, DOC(dai, VppConfig, distanceGamma)) | ||
| .def_readwrite("maxPatchSize", &VppConfig::maxPatchSize, DOC(dai, VppConfig, maxPatchSize)) | ||
| .def_readwrite("patchColoringType", &VppConfig::patchColoringType, DOC(dai, VppConfig, patchColoringType)) | ||
| .def_readwrite("uniformPatch", &VppConfig::uniformPatch, DOC(dai, VppConfig, uniformPatch)) | ||
| .def_readwrite("injectionParameters", &VppConfig::injectionParameters, DOC(dai, VppConfig, injectionParameters)) | ||
| .def_readwrite("maxNumThreads", &VppConfig::maxNumThreads, DOC(dai, VppConfig, maxNumThreads)) | ||
| .def_readwrite("maxFPS", &VppConfig::maxFPS, DOC(dai, VppConfig, maxFPS)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #include "Common.hpp" | ||
| #include "NodeBindings.hpp" | ||
| #include "depthai/pipeline/Node.hpp" | ||
| #include "depthai/pipeline/Pipeline.hpp" | ||
| #include "depthai/pipeline/node/Vpp.hpp" | ||
|
|
||
| void bind_vpp(pybind11::module& m, void* pCallstack) { | ||
| using namespace dai; | ||
| using namespace dai::node; | ||
| using namespace pybind11::literals; | ||
|
|
||
| // Node and Properties declare upfront (no duplicate VppConfig or VppMethod bindings) | ||
| py::class_<VppProperties> vppProperties(m, "VppProperties", DOC(dai, VppProperties)); | ||
| auto vpp = ADD_NODE(Vpp); | ||
|
|
||
| /////////////////////////////////////////////////////////////////////// | ||
| /////////////////////////////////////////////////////////////////////// | ||
| /////////////////////////////////////////////////////////////////////// | ||
| // Call the rest of the type defines, then perform the actual bindings | ||
| Callstack* callstack = (Callstack*)pCallstack; | ||
| auto cb = callstack->top(); | ||
| callstack->pop(); | ||
| cb(m, pCallstack); | ||
| // Actual bindings | ||
| /////////////////////////////////////////////////////////////////////// | ||
| /////////////////////////////////////////////////////////////////////// | ||
| /////////////////////////////////////////////////////////////////////// | ||
|
|
||
| // Properties | ||
| vppProperties.def_readwrite("initialConfig", &VppProperties::initialConfig, DOC(dai, VppProperties, initialConfig)) | ||
| .def_readwrite("numFramesPool", &VppProperties::numFramesPool, DOC(dai, VppProperties, numFramesPool)); | ||
|
|
||
| // Node | ||
| vpp.def_readonly("inputConfig", &Vpp::inputConfig, DOC(dai, node, Vpp, inputConfig)) | ||
| .def_property_readonly( | ||
| "left", [](Vpp& node) { return node.left; }, py::return_value_policy::reference_internal, "Rectified left input in full resolution.") | ||
| .def_property_readonly( | ||
| "right", [](Vpp& node) { return node.right; }, py::return_value_policy::reference_internal, "Rectified right input in full resolution.") | ||
| .def_property_readonly( | ||
| "disparity", | ||
| [](Vpp& node) { return node.disparity; }, | ||
| py::return_value_policy::reference_internal, | ||
| "Low resolution disparity input in pixels (in integers - 16 times bigger).") | ||
| .def_property_readonly( | ||
| "confidence", | ||
| [](Vpp& node) { return node.confidence; }, | ||
| py::return_value_policy::reference_internal, | ||
| "Confidence of the dispatiry (in integers - 16 times bigger).") | ||
| .def_readonly("syncedInputs", &Vpp::syncedInputs, DOC(dai, node, Vpp, syncedInputs), "Synchronised Left Img, Right Img, Dispatiy and confidence input.") | ||
| .def_readonly("leftOut", &Vpp::leftOut, DOC(dai, node, Vpp, leftOut), "Left output with same resolution as input.") | ||
| .def_readonly("rightOut", &Vpp::rightOut, DOC(dai, node, Vpp, rightOut), "Right output with same resolution as input.") | ||
| .def_readonly("initialConfig", &Vpp::initialConfig, DOC(dai, node, Vpp, initialConfig), "Input config of the node."); | ||
|
|
||
| // ALIAS | ||
| daiNodeModule.attr("Vpp").attr("Properties") = vppProperties; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this compile with bindings enabled?
DOC(dai, node, Vpp, syncedInputs)pulls the docstrings from the functiondai::node::Vpp::syncedInputsSo you can just update the docstrings there.