Skip to content

Commit e41a440

Browse files
authored
Merge branch 'openvinotoolkit:master' into master
2 parents e46a540 + ba49ef6 commit e41a440

File tree

5 files changed

+45
-29
lines changed

5 files changed

+45
-29
lines changed

demos/interactive_face_detection_demo/cpp_gapi/face.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
# pragma once
66

77
#include <list>
8+
#include <map>
89

910
#include <opencv2/opencv.hpp>
1011

11-
// -------------------------Describe detected face on a frame-------------------------------------------------
12+
// -------------------------Describe detected face on a frame-------------------
1213

1314
struct Face {
1415
public:

demos/interactive_face_detection_demo/cpp_gapi/visualizer.cpp

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

55
#include <utils/ocv_common.hpp>
66
#include "visualizer.hpp"
77

88
// EmotionBarVisualizer
9-
EmotionBarVisualizer::EmotionBarVisualizer(std::vector<std::string> const& emotionNames, cv::Size size, cv::Size padding,
10-
double opacity, double textScale, int textThickness):
11-
emotionNames(emotionNames), size(size), padding(padding),
12-
opacity(opacity), textScale(textScale), textThickness(textThickness),
13-
internalPadding(0) {
9+
EmotionBarVisualizer::EmotionBarVisualizer(std::vector<std::string> const& emotionNames,
10+
cv::Size size,
11+
cv::Size padding,
12+
double opacity,
13+
double textScale,
14+
int textThickness):
15+
emotionNames(emotionNames), size(size), padding(padding), opacity(opacity),
16+
textScale(textScale), textThickness(textThickness), internalPadding(0) {
1417
auto itMax = std::max_element(emotionNames.begin(), emotionNames.end(), [] (std::string const& lhs, std::string const& rhs) {
1518
return lhs.length() < rhs.length();
1619
});
@@ -68,7 +71,7 @@ void PhotoFrameVisualizer::draw(cv::Mat& img, cv::Rect& bb, cv::Scalar color) {
6871

6972
// HeadPoseVisualizer
7073
HeadPoseVisualizer::HeadPoseVisualizer(float scale, cv::Scalar xAxisColor, cv::Scalar yAxisColor, cv::Scalar zAxisColor, int axisThickness):
71-
xAxisColor(xAxisColor), yAxisColor(yAxisColor), zAxisColor(zAxisColor), axisThickness(axisThickness), scale(scale) {
74+
xAxisColor(xAxisColor), yAxisColor(yAxisColor), zAxisColor(zAxisColor), axisThickness(axisThickness), scale(scale) {
7275
}
7376

7477
void HeadPoseVisualizer::buildCameraMatrix(cv::Mat& cameraMatrix, int cx, int cy, float focalLength) {
@@ -151,13 +154,13 @@ void HeadPoseVisualizer::draw(cv::Mat& frame, cv::Point3f cpoint, float yaw, flo
151154
// Visualizer
152155
Visualizer::Visualizer(bool m_ag, bool m_em, bool m_hp, bool m_lm,
153156
int leftPadding, int rightPadding, int topPadding, int bottomPadding):
154-
emotionVisualizer(nullptr), photoFrameVisualizer(std::make_shared<PhotoFrameVisualizer>()),
155-
headPoseVisualizer(std::make_shared<HeadPoseVisualizer>()),
156-
nxcells(0), nycells(0), xstep(0), ystep(0), leftPadding(leftPadding),
157-
rightPadding(rightPadding), topPadding(topPadding),
158-
bottomPadding(bottomPadding), frameCounter(0),
159-
_isAgeGenderEnabled(m_ag), _isEmotionsEnabled(m_em),
160-
_isHeadPoseEnabled(m_hp), _isLandmarksEnabled(m_lm) {}
157+
emotionVisualizer(nullptr), photoFrameVisualizer(std::make_shared<PhotoFrameVisualizer>()),
158+
headPoseVisualizer(std::make_shared<HeadPoseVisualizer>()),
159+
nxcells(0), nycells(0), xstep(0), ystep(0), leftPadding(leftPadding),
160+
rightPadding(rightPadding), topPadding(topPadding),
161+
bottomPadding(bottomPadding), frameCounter(0),
162+
_isAgeGenderEnabled(m_ag), _isEmotionsEnabled(m_em),
163+
_isHeadPoseEnabled(m_hp), _isLandmarksEnabled(m_lm) {}
161164

162165
void Visualizer::enableEmotionBar(const cv::Size inImgSize, std::vector<std::string> const& emotionNames) {
163166
if (inImgSize != imgSize) {
@@ -186,10 +189,11 @@ void Visualizer::enableEmotionBar(const cv::Size inImgSize, std::vector<std::str
186189
}
187190

188191
void Visualizer::drawFace(cv::Mat& img, Face::Ptr f, bool drawEmotionBar) {
189-
auto genderColor = (_isAgeGenderEnabled) ?
190-
((f->isMale()) ? cv::Scalar(255, 0, 0) :
191-
cv::Scalar(147, 20, 255)) :
192-
cv::Scalar(100, 100, 100);
192+
auto genderColor = (_isAgeGenderEnabled)
193+
? ((f->isMale())
194+
? cv::Scalar(255, 0, 0)
195+
: cv::Scalar(147, 20, 255))
196+
: cv::Scalar(100, 100, 100);
193197

194198
std::ostringstream out;
195199
if (_isAgeGenderEnabled) {

demos/interactive_face_detection_demo/cpp_gapi/visualizer.hpp

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

55
#pragma once
66

77
#include "face.hpp"
88

9-
// -------------------------Generic routines for visualization of detection results-------------------------------------------------
9+
// --------Generic routines for visualization of detection results--------
1010

1111
// Drawing a bar of emotions
1212
class EmotionBarVisualizer {
1313
public:
1414
using Ptr = std::shared_ptr<EmotionBarVisualizer>;
1515

16-
explicit EmotionBarVisualizer(std::vector<std::string> const& emotionNames, cv::Size size = cv::Size(300, 140), cv::Size padding = cv::Size(10, 10),
17-
double opacity = 0.6, double textScale = 1, int textThickness = 1);
16+
explicit EmotionBarVisualizer(std::vector<std::string> const& emotionNames,
17+
cv::Size size = cv::Size(300, 140),
18+
cv::Size padding = cv::Size(10, 10),
19+
double opacity = 0.6,
20+
double textScale = 1,
21+
int textThickness = 1);
22+
23+
void draw(cv::Mat& img,
24+
std::map<std::string, float> emotions,
25+
cv::Point org,
26+
cv::Scalar fgcolor,
27+
cv::Scalar bgcolor);
1828

19-
void draw(cv::Mat& img, std::map<std::string, float> emotions, cv::Point org, cv::Scalar fgcolor, cv::Scalar bgcolor);
2029
cv::Size getSize();
2130
private:
2231
std::vector<std::string> emotionNames;
@@ -52,10 +61,10 @@ class HeadPoseVisualizer {
5261
using Ptr = std::shared_ptr<HeadPoseVisualizer>;
5362

5463
explicit HeadPoseVisualizer(float scale = 50,
55-
cv::Scalar xAxisColor = cv::Scalar(0, 0, 255),
56-
cv::Scalar yAxisColor = cv::Scalar(0, 255, 0),
57-
cv::Scalar zAxisColor = cv::Scalar(255, 0, 0),
58-
int axisThickness = 2);
64+
cv::Scalar xAxisColor = cv::Scalar(0, 0, 255),
65+
cv::Scalar yAxisColor = cv::Scalar(0, 255, 0),
66+
cv::Scalar zAxisColor = cv::Scalar(255, 0, 0),
67+
int axisThickness = 2);
5968

6069
void draw(cv::Mat& frame, cv::Point3f cpoint, float yaw, float pitch, float roll);
6170

tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def _read_configs(arguments):
146146
definitions = os.environ.get(DEFINITION_ENV_VAR) or local_config.get('global_definitions')
147147
if definitions:
148148
definitions = read_yaml(Path(arguments.config).parent / definitions)
149-
global_config = read_yaml(arguments.definitions) if arguments.definitions else definitions
149+
global_config = (
150+
read_yaml(arguments.definitions) if 'definitions' in arguments and arguments.definitions else definitions
151+
)
150152

151153
return global_config, local_config
152154

0 commit comments

Comments
 (0)