Skip to content

Commit 53a5e98

Browse files
authored
Merge pull request #3063 from mpashchenkov/mp/klocwork-issues
Fixed some demo mistakes
2 parents bf03f50 + c866dc3 commit 53a5e98

File tree

6 files changed

+24
-9
lines changed

6 files changed

+24
-9
lines changed

demos/common/cpp/models/src/style_transfer_model.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ void StyleTransferModel::prepareInputsOutputs(InferenceEngine::CNNNetwork& cnnNe
4040
SizeVector& inSizeVector = inputShapes.begin()->second;
4141
if (inSizeVector.size() != 4 || inSizeVector[0] != 1 || inSizeVector[1] != 3)
4242
throw std::runtime_error("3-channel 4-dimensional model's input is expected");
43-
InputInfo& inputInfo = *cnnNetwork.getInputsInfo().begin()->second;
43+
auto inputsDataMap = cnnNetwork.getInputsInfo();
44+
if (inputsDataMap.empty()) {
45+
throw std::runtime_error("Network input data node information is empty");
46+
}
47+
InputInfo& inputInfo = *inputsDataMap.begin()->second;
48+
4449
inputInfo.setPrecision(Precision::FP32);
4550

4651
// --------------------------- Prepare output blobs -----------------------------------------------------

demos/gaze_estimation_demo/cpp/src/landmarks_estimator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ namespace gaze_estimation {
1111

1212
LandmarksEstimator::LandmarksEstimator(
1313
InferenceEngine::Core& ie, const std::string& modelPath, const std::string& deviceName) :
14-
ieWrapper(ie, modelPath, modelType, deviceName)
15-
{
14+
ieWrapper(ie, modelPath, modelType, deviceName), numberLandmarks (0u) {
1615
inputBlobName = ieWrapper.expectSingleInput();
1716
ieWrapper.expectImageInput(inputBlobName);
1817

demos/gesture_recognition_demo/cpp_gapi/main.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,19 @@ int main(int argc, char *argv[]) {
101101
FLAGS_m_d, // path to model
102102
fileNameNoExt(FLAGS_m_d) + ".bin", // path to weights
103103
FLAGS_d_d // device to use
104-
}.cfgOutputLayers({"boxes"}); // This clarification here because
105-
// of GAPI take the last layer from .xml
106-
// and last layer sould be the outpul layer
104+
}.cfgOutputLayers({"boxes"}); // This clarification here because of
105+
// GAPI take the first layer name from OutputsInfo
106+
// for one output G_API_NET API
107+
slog::info << "The Person Detection ASL model " << FLAGS_m_d << " is loaded to " << FLAGS_d_d << " device." << slog::endl;
107108

108109
auto action_recognition = cv::gapi::ie::Params<nets::ActionRecognition> {
109110
FLAGS_m_a, // path to model
110111
fileNameNoExt(FLAGS_m_a) + ".bin", // path to weights
111112
FLAGS_d_a // device to use
112-
}.cfgOutputLayers({"output"}); // The same
113+
}.cfgOutputLayers({"output"}); // This clarification here because of
114+
// GAPI take the first layer name from OutputsInfo
115+
// for one output G_API_NET API
116+
slog::info << "The Action Recognition model " << FLAGS_m_a << " is loaded to " << FLAGS_d_a << " device." << slog::endl;
113117

114118
/** Custom kernels **/
115119
auto kernels = custom::kernels();

demos/gesture_recognition_demo/cpp_gapi/src/custom_kernels.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ struct Params {
112112
prepared_mat = params.prepared_mat;
113113
last_id.fetch_add(params.last_id);
114114
}
115+
Params& operator=(const Params& params) {
116+
current_frame = params.current_frame;
117+
prepared_mat = params.prepared_mat;
118+
last_id.fetch_add(params.last_id);
119+
return *this;
120+
}
115121
};
116122
} // namespace BatchState
117123

demos/interactive_face_detection_demo/cpp_gapi/face.cpp

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

77
Face::Face(size_t id, cv::Rect& location):
88
_location(location), _intensity_mean(0.f), _id(id), _age(-1),
9-
_maleScore(0), _femaleScore(0), _yaw(0.f), _pitch(0.f), _roll(0.f) {}
9+
_maleScore(0), _femaleScore(0), _yaw(0.f), _pitch(0.f), _roll(0.f),
10+
_realFaceConfidence(0.f) {}
1011

1112
void Face::updateAge(float value) {
1213
_age = (_age == -1) ? value : 0.95f * _age + 0.05f * value;

demos/interactive_face_detection_demo/cpp_gapi/face.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ struct Face {
4444
float _yaw;
4545
float _pitch;
4646
float _roll;
47-
std::vector<float> _landmarks;
4847
float _realFaceConfidence;
48+
std::vector<float> _landmarks;
4949
};
5050

5151
// ----------------- Utils -----------------

0 commit comments

Comments
 (0)