Skip to content

Commit 29873fa

Browse files
Wovchenaivikhrevvladimir-dudnik
authored
OV2.0 c++ interactive_face_detection_demo (#3103)
* OV2.0 c++ interactive_face_detection_demo * demos/interactive_face_detection_demo/cpp/detectors.cpp: remove + 0 Co-authored-by: Ivan Vikhrev <[email protected]> * demos/interactive_face_detection: fix code style * tests: interactive_face_detection supress anti-spoof-mn3 * demos/common/cpp/utils/include/utils/ocv_common.hpp: swap height and width Co-authored-by: Vladimir Dudnik <[email protected]> * Change out names for head-pose-estimation-adas-0001, simplyfy tests * Fix interactive_face_detection_demo tests * Supress head-pose-estimation-adas-0001 Co-authored-by: Ivan Vikhrev <[email protected]> Co-authored-by: Vladimir Dudnik <[email protected]>
1 parent d6b9b4a commit 29873fa

File tree

7 files changed

+326
-836
lines changed

7 files changed

+326
-836
lines changed

demos/common/cpp/utils/include/utils/ocv_common.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "utils/shared_blob_allocator.h"
1818

1919

20-
2120
/**
2221
* @brief Get cv::Mat value in the correct format.
2322
*/
@@ -183,6 +182,17 @@ static UNUSED ov::Tensor wrapMat2Tensor(const cv::Mat& mat) {
183182
return ov::Tensor(ov::element::u8, ov::Shape{ 1, height, width, channels }, mat.data);
184183
}
185184

185+
static inline void resize2tensor(const cv::Mat& mat, const ov::Tensor& tensor) {
186+
static const ov::Layout layout{"NHWC"};
187+
const ov::Shape& shape = tensor.get_shape();
188+
cv::Size size{int(shape[ov::layout::width_idx(layout)]), int(shape[ov::layout::height_idx(layout)])};
189+
assert(tensor.get_element_type() == ov::element::u8);
190+
assert(shape.size() == 4);
191+
assert(shape[ov::layout::batch_idx(layout)] == 1);
192+
assert(shape[ov::layout::channels_idx(layout)] == 3);
193+
cv::resize(mat, cv::Mat{size, CV_8UC3, tensor.data()}, size);
194+
}
195+
186196
/**
187197
* @brief Puts text message on the frame, highlights the text with a white border to make it distinguishable from
188198
* the background.

demos/interactive_face_detection_demo/cpp/README.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ omz_converter --list models.lst
7272
Running the application with the `-h` option yields the following usage message:
7373

7474
```
75-
InferenceEngine:
76-
API version ............ <version>
77-
Build .................. <number>
78-
7975
interactive_face_detection_demo [OPTION]
8076
Options:
8177
@@ -90,26 +86,7 @@ Options:
9086
-m_em "<path>" Optional. Path to an .xml file with a trained Emotions Recognition model.
9187
-m_lm "<path>" Optional. Path to an .xml file with a trained Facial Landmarks Estimation model.
9288
-m_am "<path>" Optional. Path to an .xml file with a trained Antispoofing Classification model.
93-
-l "<absolute_path>" Required for CPU custom layers. Absolute path to a shared library with the kernels implementation.
94-
Or
95-
-c "<absolute_path>" Required for GPU custom kernels. Absolute path to an .xml file with the kernels description.
96-
-d "<device>" Optional. Target device for Face Detection network (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
97-
-d_ag "<device>" Optional. Target device for Age/Gender Recognition network (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
98-
-d_hp "<device>" Optional. Target device for Head Pose Estimation network (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
99-
-d_em "<device>" Optional. Target device for Emotions Recognition network (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
100-
-d_lm "<device>" Optional. Target device for Facial Landmarks Estimation network (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
101-
-d_am "<device>" Optional. Target device for Antispoofing Classification network (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
102-
-n_ag "<num>" Optional. Number of maximum simultaneously processed faces for Age/Gender Recognition network (by default, it is 16)
103-
-n_hp "<num>" Optional. Number of maximum simultaneously processed faces for Head Pose Estimation network (by default, it is 16)
104-
-n_em "<num>" Optional. Number of maximum simultaneously processed faces for Emotions Recognition network (by default, it is 16)
105-
-n_lm "<num>" Optional. Number of maximum simultaneously processed faces for Facial Landmarks Estimation network (by default, it is 16)
106-
-n_am "<num>" Optional. Number of maximum simultaneously processed faces for Antispoofing Classification network (by default, it is 16)
107-
-dyn_ag Optional. Enable dynamic batch size for Age/Gender Recognition network
108-
-dyn_hp Optional. Enable dynamic batch size for Head Pose Estimation network
109-
-dyn_em Optional. Enable dynamic batch size for Emotions Recognition network
110-
-dyn_lm Optional. Enable dynamic batch size for Facial Landmarks Estimation network
111-
-dyn_am Optional. Enable dynamic batch size for Antispoofing Classification network
112-
-async Optional. Enable asynchronous mode
89+
-d <device> Specify a target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. Use "-d MULTI:<comma-separated_devices_list>" format to specify MULTI plugin. The application looks for a suitable plugin for the specified device.
11390
-no_show Optional. Don't show output.
11491
-r Optional. Output inference results as raw values
11592
-t Optional. Probability threshold for detections

0 commit comments

Comments
 (0)