Skip to content

Commit 0717041

Browse files
authored
Merge pull request #3172 from ieliz/ei/improving_parsers
Improving parsers in 'interactive_face_detection_demo'
2 parents 903f900 + 44f4eca commit 0717041

File tree

9 files changed

+749
-733
lines changed

9 files changed

+749
-733
lines changed

demos/common/cpp/monitors/src/presenter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ const std::map<int, MonitorType> keyToMonitorType{
1919

2020
std::set<MonitorType> strKeysToMonitorSet(const std::string& keys) {
2121
std::set<MonitorType> enabledMonitors;
22+
if (keys == "h") {
23+
return enabledMonitors;
24+
}
2225
for (unsigned char key: keys) {
26+
if (key == 'h') {
27+
throw std::runtime_error("Unacceptable combination of monitor types-can't show and hide info at the same time");
28+
}
2329
auto iter = keyToMonitorType.find(std::toupper(key));
2430
if (keyToMonitorType.end() == iter) {
2531
throw std::runtime_error("Unknown monitor type");

demos/interactive_face_detection_demo/cpp/README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -69,42 +69,42 @@ omz_converter --list models.lst
6969
7070
## Running
7171

72-
Running the application with the `-h` option yields the following usage message:
72+
Running the demo with `-h` shows this help message:
7373

7474
```
75-
interactive_face_detection_demo [OPTION]
76-
Options:
77-
78-
-h Print a usage message
79-
-i Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
80-
-loop Optional. Enable reading the input in a loop.
81-
-o "<path>" Optional. Name of the output file(s) to save.
82-
-limit "<num>" Optional. Number of frames to store in output. If 0 is set, all frames are stored.
83-
-m "<path>" Required. Path to an .xml file with a trained Face Detection model.
84-
-m_ag "<path>" Optional. Path to an .xml file with a trained Age/Gender Recognition model.
85-
-m_hp "<path>" Optional. Path to an .xml file with a trained Head Pose Estimation model.
86-
-m_em "<path>" Optional. Path to an .xml file with a trained Emotions Recognition model.
87-
-m_lm "<path>" Optional. Path to an .xml file with a trained Facial Landmarks Estimation model.
88-
-m_am "<path>" Optional. Path to an .xml file with a trained Antispoofing Classification model.
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.
90-
-no_show Optional. Don't show output.
91-
-r Optional. Output inference results as raw values
92-
-t Optional. Probability threshold for detections
93-
-bb_enlarge_coef Optional. Coefficient to enlarge/reduce the size of the bounding box around the detected face
94-
-dx_coef Optional. Coefficient to shift the bounding box around the detected face along the Ox axis
95-
-dy_coef Optional. Coefficient to shift the bounding box around the detected face along the Oy axis
96-
-fps Optional. Maximum FPS for playing video
97-
-no_smooth Optional. Do not smooth person attributes
98-
-no_show_emotion_bar Optional. Do not show emotion bar
99-
-u Optional. List of monitors to show initially.
75+
[ -h] show the help message and exit
76+
[--help] print help on all arguments
77+
-m <MODEL FILE> path to an .xml file with a trained Face Detection model
78+
[ -i <INPUT>] an input to process. The input must be a single image, a folder of images, video file or camera id. Default is 0
79+
[--bb_enlarge_coef <NUMBER>] coefficient to enlarge/reduce the size of the bounding box around the detected face. Default is 1.2
80+
[ -d <DEVICE>] specify a device to infer on (the list of available devices is shown below). Use '-d HETERO:<comma-separated_devices_list>' format to specify HETERO plugin. Use '-d MULTI:<comma-separated_devices_list>' format to specify MULTI plugin. Default is CPU
81+
[--dx_coef <NUMBER>] coefficient to shift the bounding box around the detected face along the Ox axis
82+
[--dy_coef <NUMBER>] coefficient to shift the bounding box around the detected face along the Oy axis
83+
[--fps <NUMBER>] maximum FPS for playing video
84+
[--lim <NUMBER>] number of frames to store in output. If 0 is set, all frames are stored. Default is 1000
85+
[--loop] enable reading the input in a loop
86+
[--mag <MODEL FILE>] path to an .xml file with a trained Age/Gender Recognition model
87+
[--mam <MODEL FILE>] path to an .xml file with a trained Antispoofing Classification model
88+
[--mem <MODEL FILE>] path to an .xml file with a trained Emotions Recognition model
89+
[--mhp <MODEL FILE>] path to an .xml file with a trained Head Pose Estimation model
90+
[--mlm <MODEL FILE>] path to an .xml file with a trained Facial Landmarks Estimation model
91+
[ -o <OUTPUT>] name of the output file(s) to save
92+
[ -r] output inference results as raw values
93+
[--show] ([--noshow]) (don't) show output
94+
[--show_emotion_bar] ([--noshow_emotion_bar]) (don't) show emotion bar
95+
[--smooth] ([--nosmooth]) (don't) smooth person attributes
96+
[ -t <NUMBER>] probability threshold for detections. Default is 0.5
97+
[ -u <DEVICE>] resource utilization graphs. Default is cdm. c - average CPU load, d - load distribution over cores, m - memory usage, h - hide
98+
Key bindings:
99+
Q, q, Esc - Quit
100+
P, p, 0, spacebar - Pause
101+
C - average CPU load, D - load distribution over cores, M - memory usage, H - hide
100102
```
101103

102-
Running the application with an empty list of options yields the usage message given above and an error message.
103-
104104
For example, to do inference on a GPU with the OpenVINO&trade; toolkit pre-trained models, run the following command:
105105

106106
```sh
107-
./interactive_face_detection_demo -i <path_to_video>/<input_video>.mp4 -m <path_to_model>/face-detection-adas-0001.xml -m_ag <path_to_model>/age-gender-recognition-retail-0013.xml -m_hp <path_to_model>/head-pose-estimation-adas-0001.xml -m_em <path_to_model>/emotions-recognition-retail-0003.xml -m_lm <path_to_model>/facial-landmarks-35-adas-0002.xml -m_am <path_to_model>/anti-spoof-mn3.xml -d GPU
107+
./interactive_face_detection_demo -i <path_to_video>/<input_video>.mp4 -m <path_to_model>/face-detection-adas-0001.xml --mag <path_to_model>/age-gender-recognition-retail-0013.xml --mhp <path_to_model>/head-pose-estimation-adas-0001.xml --mem <path_to_model>/emotions-recognition-retail-0003.xml --mlm <path_to_model>/facial-landmarks-35-adas-0002.xml --mam <path_to_model>/anti-spoof-mn3.xml -d GPU
108108
```
109109

110110
>**NOTE**: If you provide a single image as an input, the demo processes and renders it quickly, then exits. To continuously visualize inference results on the screen, apply the `loop` option, which enforces processing a single image in a loop.
@@ -113,7 +113,7 @@ You can save processed results to a Motion JPEG AVI file or separate JPEG or PNG
113113

114114
* To save processed results in an AVI file, specify the name of the output file with `avi` extension, for example: `-o output.avi`.
115115
* To save processed results as images, specify the template name of the output image file with `jpg` or `png` extension, for example: `-o output_%03d.jpg`. The actual file names are constructed from the template at runtime by replacing regular expression `%03d` with the frame number, resulting in the following: `output_000.jpg`, `output_001.jpg`, and so on.
116-
To avoid disk space overrun in case of continuous input stream, like camera, you can limit the amount of data stored in the output file(s) with the `limit` option. The default value is 1000. To change it, you can apply the `-limit N` option, where `N` is the number of frames to store.
116+
To avoid disk space overrun in case of continuous input stream, like camera, you can limit the amount of data stored in the output file(s) with the `--lim` option. The default value is 1000. To change it, you can apply the `--lim N` option, where `N` is the number of frames to store.
117117

118118
>**NOTE**: Windows\* systems may not have the Motion JPEG codec installed by default. If this is the case, you can download OpenCV FFMPEG back end using the PowerShell script provided with the OpenVINO &trade; install package and located at `<INSTALL_DIR>/opencv/ffmpeg-download.ps1`. The script should be run with administrative privileges if OpenVINO &trade; is installed in a system protected folder (this is a typical case). Alternatively, you can save results as images.
119119

demos/interactive_face_detection_demo/cpp/interactive_face_detection.hpp

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)