Merge pull request #15753 from dmatveev:dm/ng-5000-security_barrier-interactive_face

G-API: Introduced Security Barrier & Interactive Face Detection samples

* G-API-NG/Samples: Added samples & relevant changes

- Security barrier camera sample
- Age/Gender/Emotions recognition sample
- GIEBackend now loads CPU extension libraries
- A couple of API-level workarounds added to deal with cv::Mat/Blob conversions

* G-API-NG/Samples: removed HAVE_INF_ENGINE remnants
This commit is contained in:
Dmitry Matveev
2019-11-27 17:54:17 +03:00
committed by Alexander Alekhin
parent d9efb55d29
commit fb5e7964b3
4 changed files with 809 additions and 18 deletions
+21 -3
View File
@@ -25,6 +25,22 @@ namespace ie {
GAPI_EXPORTS cv::gapi::GBackend backend();
/**
* Specify how G-API and IE should trait input data
*
* In OpenCV, the same cv::Mat is used to represent both
* image and tensor data. Sometimes those are hardly distinguishable,
* so this extra parameter is used to give G-API a hint.
*
* This hint controls how G-API reinterprets the data when converting
* it to IE Blob format (and which layout/etc is assigned to this data).
*/
enum class TraitAs: int
{
TENSOR, //!< G-API traits an associated cv::Mat as a raw tensor and passes dimensions as-is
IMAGE //!< G-API traits an associated cv::Mat as an image so creates an "image" blob (NCHW/NHWC, etc)
};
namespace detail {
struct ParamDesc {
std::string model_path;
@@ -35,7 +51,8 @@ namespace detail {
std::vector<std::string> input_names;
std::vector<std::string> output_names;
std::unordered_map<std::string, cv::Mat> const_inputs;
using ConstInput = std::pair<cv::Mat, TraitAs>;
std::unordered_map<std::string, ConstInput> const_inputs;
// NB: nun_* may differ from topology's real input/output port numbers
// (e.g. topology's partial execution)
@@ -83,8 +100,9 @@ public:
}
Params<Net>& constInput(const std::string &layer_name,
const cv::Mat &data) {
desc.const_inputs[layer_name] = data;
const cv::Mat &data,
TraitAs hint = TraitAs::TENSOR) {
desc.const_inputs[layer_name] = {data, hint};
return *this;
}