Skip to content

Commit 440da01

Browse files
authored
Merge branch 'openvinotoolkit:master' into master
2 parents 8899b41 + 8e2aaa9 commit 440da01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2300
-228
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "demos/thirdparty/gflags"]
22
path = demos/thirdparty/gflags
3-
url = https://github.com/gflags/gflags/
3+
url = https://github.com/gflags/gflags.git

demos/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ The Open Model Zoo includes the following demos:
2424
- [Face Recognition Python\* Demo](./face_recognition_demo/python/README.md) - The interactive face recognition demo.
2525
- [Formula Recognition Python\* Demo](./formula_recognition_demo/python/README.md) - The demo demonstrates how to run Im2latex formula recognition models and recognize latex formulas.
2626
- [Gaze Estimation C++ Demo](./gaze_estimation_demo/cpp/README.md) - Face detection followed by gaze estimation, head pose estimation and facial landmarks regression.
27-
- [Gaze Estimation C++ G-API Demo](./gaze_estimation_demo/cpp_gapi/README.md) - Face detection followed by gaze estimation, head pose estimation and facial landmarks regression. G-API version.
27+
- [Gaze Estimation C++ G-API\* Demo](./gaze_estimation_demo/cpp_gapi/README.md) - Face detection followed by gaze estimation, head pose estimation and facial landmarks regression. G-API version.
2828
- [Gesture Recognition Python\* Demo](./gesture_recognition_demo/python/README.md) - Demo application for Gesture Recognition algorithm (e.g. American Sign Language gestures), which classifies gesture actions that are being performed on input video.
29+
- [Gesture Recognition C++ G-API\* Demo](./gesture_recognition_demo/cpp_gapi/README.md) - Demo application for Gesture Recognition algorithm (e.g. American Sign Language gestures), which classifies gesture actions that are being performed on input video. G-API version.
2930
- [GPT-2 Text Prediction Python\* Demo](./gpt2_text_prediction_demo/python/README.md) - GPT-2 text prediction demo.
3031
- [Handwritten Text Recognition Python\* Demo](./handwritten_text_recognition_demo/python/README.md) - The demo demonstrates how to run Handwritten Text Recognition models for Japanese, Simplified Chinese and English.
3132
- [Human Pose Estimation C++ Demo](./human_pose_estimation_demo/cpp/README.md) - Human pose estimation demo.
@@ -38,7 +39,7 @@ The Open Model Zoo includes the following demos:
3839
- [Image Translation Python\* Demo](./image_translation_demo/python/README.md) - Demo application to synthesize a photo-realistic image based on exemplar image.
3940
- [Instance Segmentation Python\* Demo](./instance_segmentation_demo/python/README.md) - Inference of instance segmentation networks trained in `Detectron` or `maskrcnn-benchmark`.
4041
- [Interactive Face Detection C++ Demo](./interactive_face_detection_demo/cpp/README.md) - Face Detection coupled with Age/Gender, Head-Pose, Emotion, and Facial Landmarks detectors. Supports video and camera inputs.
41-
- [Interactive Face Detection G-API Demo](./interactive_face_detection_demo/cpp_gapi/README.md) - G-API based Face Detection coupled with Age/Gender, Head-Pose, Emotion, and Facial Landmarks detectors. Supports video and camera inputs.
42+
- [Interactive Face Detection G-API\* Demo](./interactive_face_detection_demo/cpp_gapi/README.md) - G-API based Face Detection coupled with Age/Gender, Head-Pose, Emotion, and Facial Landmarks detectors. Supports video and camera inputs.
4243
- [Machine Translation Python\* Demo](./machine_translation_demo/python/README.md) - The demo demonstrates how to run non-autoregressive machine translation models.
4344
- [Mask R-CNN C++ Demo for TensorFlow\* Object Detection API](./mask_rcnn_demo/cpp/README.md) - Inference of instance segmentation networks created with TensorFlow\* Object Detection API.
4445
- [Monodepth Python\* Demo](./monodepth_demo/python/README.md) - The demo demonstrates how to run monocular depth estimation models.

demos/gaze_estimation_demo/cpp/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The demo also relies on the following auxiliary networks:
88

99
* `face-detection-retail-0004` or `face-detection-adas-0001` detection networks for finding faces
1010
* `head-pose-estimation-adas-0001`, which estimates head pose in Tait-Bryan angles, serving as an input for gaze estimation model
11-
* `facial-landmarks-35-adas-0002`, which estimates coordinates of facial landmarks for detected faces. The keypoints at the corners of eyes are used to locate eyes regions required for the gaze estimation model
11+
* `facial-landmarks-35-adas-0002` or `facial-landmarks-98-detection-0001`, which estimates coordinates of facial landmarks for detected faces. The keypoints at the corners of eyes are used to locate eyes regions required for the gaze estimation model
1212
* `open-closed-eye-0001`, which estimates eyes state of detected faces.
1313

1414
Other demo objectives are:
@@ -47,6 +47,7 @@ omz_converter --list models.lst
4747
### Supported Models
4848

4949
* facial-landmarks-35-adas-0002
50+
* facial-landmarks-98-detection-0001
5051
* face-detection-adas-0001
5152
* face-detection-retail-0004
5253
* face-detection-retail-0005

demos/gaze_estimation_demo/cpp/gaze_estimation_demo.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
#include <string>
99
#include <vector>
10-
#include <gflags/gflags.h>
1110
#include <iostream>
1211

13-
#include <utils/default_flags.hpp>
12+
#include "gflags/gflags.h"
13+
#include "utils/default_flags.hpp"
1414

1515
DEFINE_INPUT_FLAGS
1616
DEFINE_OUTPUT_FLAGS

demos/gaze_estimation_demo/cpp/include/face_inference_results.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <vector>
88
#include <opencv2/core/core.hpp>
9-
#include <utils/slog.hpp>
9+
#include "utils/slog.hpp"
1010

1111
namespace gaze_estimation {
1212
struct FaceInferenceResults {
@@ -25,6 +25,8 @@ struct FaceInferenceResults {
2525

2626
cv::Point3f gazeVector;
2727

28+
std::vector<cv::Point2f> getEyeLandmarks();
29+
2830
friend slog::LogStream& operator<<(slog::LogStream& os, const FaceInferenceResults& faceInferenceResults);
2931
};
3032

demos/gaze_estimation_demo/cpp/include/ie_wrapper.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
#include <cstdio>
88
#include <string>
9-
109
#include <map>
1110
#include <vector>
1211

13-
#include <utils/common.hpp>
14-
#include <utils/ocv_common.hpp>
15-
#include <utils/slog.hpp>
12+
#include "utils/common.hpp"
13+
#include "utils/ocv_common.hpp"
14+
#include "utils/slog.hpp"
1615

1716
namespace gaze_estimation {
1817
class IEWrapper {

demos/gaze_estimation_demo/cpp/include/landmarks_estimator.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,15 @@ class LandmarksEstimator: public BaseEstimator {
2727
private:
2828
IEWrapper ieWrapper;
2929
std::string inputBlobName, outputBlobName;
30+
size_t numberLandmarks;
31+
std::vector<cv::Point2i> simplePostprocess(cv::Rect faceBoundingBox, cv::Mat faceCrop);
32+
std::vector<cv::Point2i> heatMapPostprocess(cv::Rect faceBoundingBox, cv::Mat faceCrop);
33+
std::vector<cv::Mat> split(std::vector<float>& data, const std::vector<unsigned long>& shape);
34+
std::vector<cv::Point2f> getMaxPreds(std::vector<cv::Mat> heatMaps);
35+
int sign(float number);
36+
cv::Mat affineTransform(cv::Point2f center, cv::Point2f scale,
37+
float rot, size_t dst_w, size_t dst_h, cv::Point2f shift, bool inv);
38+
cv::Point2f rotatePoint(cv::Point2f pt, float angle_rad);
39+
cv::Point2f get3rdPoint(cv::Point2f a, cv::Point2f b);
3040
};
3141
} // namespace gaze_estimation

demos/gaze_estimation_demo/cpp/include/utils.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
#include <cstdio>
88
#include <string>
9-
109
#include <utility>
1110
#include <map>
1211
#include <vector>
1312

1413
#include <inference_engine.hpp>
1514

16-
#include <utils/ocv_common.hpp>
17-
#include <utils/slog.hpp>
15+
#include "utils/ocv_common.hpp"
16+
#include "utils/slog.hpp"
1817

1918
namespace gaze_estimation {
2019
void gazeVectorToGazeAngles(const cv::Point3f& gazeVector, cv::Point2f& gazeAngles);

demos/gaze_estimation_demo/cpp/main.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018 Intel Corporation
1+
// Copyright (C) 2018-2021 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

@@ -7,7 +7,6 @@
77
* \file gaze_estimation_demo/main.cpp
88
* \example gaze_estimation_demo/main.cpp
99
*/
10-
#include <gflags/gflags.h>
1110
#include <functional>
1211
#include <iostream>
1312
#include <fstream>
@@ -27,33 +26,30 @@
2726

2827
#include <inference_engine.hpp>
2928

29+
#include <gflags/gflags.h>
3030
#include <monitors/presenter.h>
3131
#include <utils/args_helper.hpp>
3232
#include <utils/images_capture.h>
3333
#include <utils/ocv_common.hpp>
3434
#include <utils/performance_metrics.hpp>
3535
#include <utils/slog.hpp>
3636

37-
#include "gaze_estimation_demo.hpp"
38-
3937
#include "face_inference_results.hpp"
40-
4138
#include "face_detector.hpp"
42-
4339
#include "base_estimator.hpp"
4440
#include "head_pose_estimator.hpp"
4541
#include "landmarks_estimator.hpp"
4642
#include "eye_state_estimator.hpp"
4743
#include "gaze_estimator.hpp"
48-
4944
#include "results_marker.hpp"
50-
5145
#include "utils.hpp"
5246

47+
#include "gaze_estimation_demo.hpp"
48+
5349
using namespace gaze_estimation;
5450

55-
bool ParseAndCheckCommandLine(int argc, char *argv[]) {
56-
// ---------------------------Parsing and validating input arguments--------------------------------------
51+
bool ParseAndCheckCommandLine(int argc, char* argv[]) {
52+
// Parsing and validating input arguments
5753
gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true);
5854
if (FLAGS_h) {
5955
showUsage();
@@ -78,11 +74,11 @@ bool ParseAndCheckCommandLine(int argc, char *argv[]) {
7874
}
7975

8076

81-
int main(int argc, char *argv[]) {
77+
int main(int argc, char* argv[]) {
8278
try {
8379
PerformanceMetrics metrics;
8480

85-
// ------------------------------ Parsing and validating of input arguments --------------------------
81+
// Parsing and validating of input arguments
8682
if (!ParseAndCheckCommandLine(argc, argv)) {
8783
return 0;
8884
}
@@ -108,8 +104,8 @@ int main(int argc, char *argv[]) {
108104
int delay = 1;
109105
std::string windowName = "Gaze estimation demo";
110106

111-
std::unique_ptr<ImagesCapture> cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0,
112-
std::numeric_limits<size_t>::max(), stringToSize(FLAGS_res));
107+
std::unique_ptr<ImagesCapture> cap = openImagesCapture(
108+
FLAGS_i, FLAGS_loop, 0, std::numeric_limits<size_t>::max(), stringToSize(FLAGS_res));
113109

114110
auto startTime = std::chrono::steady_clock::now();
115111
cv::Mat frame = cap->read();
@@ -118,8 +114,9 @@ int main(int argc, char *argv[]) {
118114
}
119115

120116
cv::VideoWriter videoWriter;
121-
if (!FLAGS_o.empty() && !videoWriter.open(FLAGS_o, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'),
122-
cap->fps(), frame.size())) {
117+
if (!FLAGS_o.empty() &&
118+
!videoWriter.open(FLAGS_o, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), cap->fps(), frame.size()))
119+
{
123120
throw std::runtime_error("Can't open video writer");
124121
}
125122
uint32_t framesProcessed = 0;

demos/gaze_estimation_demo/cpp/models.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# This file can be used with the --list option of the model downloader.
2+
#facial-landmarks-98-detection-????
23
facial-landmarks-35-adas-????
34
face-detection-adas-????
45
face-detection-retail-????

0 commit comments

Comments
 (0)