From eeab378e1ca27041f6bb1c083bddcfc1d47ddcb9 Mon Sep 17 00:00:00 2001 From: szabi-luxonis Date: Tue, 5 May 2020 16:39:19 +0300 Subject: [PATCH] add configurable depth confidence threshold; remove limit for padding --- host/core/pipeline/host_pipeline_config.cpp | 15 +++++++++++++-- host/core/pipeline/host_pipeline_config.hpp | 1 + host/py_module/py_bindings.cpp | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/host/core/pipeline/host_pipeline_config.cpp b/host/core/pipeline/host_pipeline_config.cpp index 4a837c1f9..490aa832e 100644 --- a/host/core/pipeline/host_pipeline_config.cpp +++ b/host/core/pipeline/host_pipeline_config.cpp @@ -67,9 +67,9 @@ bool HostPipelineConfig::initWithJSON(const json &json_obj) { depth.padding_factor = depth_obj.at("padding_factor").get(); - if (depth.padding_factor < 0.f || depth.padding_factor >= 0.5) + if (depth.padding_factor < 0.f || depth.padding_factor > 1.f) { - std::cout << "padding_factor should be in the range [0 .. 0.5)\n"; + std::cout << "padding_factor should be in the range [0 .. 1]\n"; break; } } @@ -78,6 +78,17 @@ bool HostPipelineConfig::initWithJSON(const json &json_obj) { depth.depth_limit_m = depth_obj.at("depth_limit_m").get(); } + + if (depth_obj.contains("confidence_threshold")) + { + depth.confidence_threshold = depth_obj.at("confidence_threshold").get(); + + if (depth.confidence_threshold < 0.f || depth.confidence_threshold > 1.f) + { + std::cout << "confidence_threshold should be in the range [0 .. 1]\n"; + break; + } + } } // "ai" diff --git a/host/core/pipeline/host_pipeline_config.hpp b/host/core/pipeline/host_pipeline_config.hpp index 751368e1e..1acd6db30 100644 --- a/host/core/pipeline/host_pipeline_config.hpp +++ b/host/core/pipeline/host_pipeline_config.hpp @@ -24,6 +24,7 @@ struct HostPipelineConfig std::string type; float padding_factor = 0.3f; float depth_limit_m = 10.0f; + float confidence_threshold = 0.5f; } depth; struct AI diff --git a/host/py_module/py_bindings.cpp b/host/py_module/py_bindings.cpp index 39095097a..f83638e78 100644 --- a/host/py_module/py_bindings.cpp +++ b/host/py_module/py_bindings.cpp @@ -441,6 +441,7 @@ std::shared_ptr create_pipeline( }; json_config_obj["depth"]["padding_factor"] = config.depth.padding_factor; json_config_obj["depth"]["depth_limit_mm"] = (int)(config.depth.depth_limit_m * 1000); + json_config_obj["depth"]["confidence_threshold"] = config.depth.confidence_threshold; json_config_obj["_load_inBlob"] = true; json_config_obj["_pipeline"] =