Skip to content

Commit

Permalink
P2 + small alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Pashchenkov committed Aug 4, 2021
1 parent 0f20832 commit f564df1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ GAPI_OCV_KERNEL(OCVBoxesAndMarks, custom::BoxesAndMarks) {
}
}
}
};
}; // GAPI_OCV_KERNEL(BoxesAndMarks)

cv::gapi::GKernelPackage custom::kernels() {
return cv::gapi::kernels<OCVBuildFaces,
Expand Down
30 changes: 15 additions & 15 deletions demos/gaze_estimation_demo/cpp_gapi/src/results_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ void ResultsMarker::mark(cv::Mat& image,
if (showFaceBoundingBox) {
cv::rectangle(image, faceInferenceResults.faceBoundingBox, cv::Scalar::all(255), 1);
putHighlightedText(image,
cv::format("Detector confidence: %0.2f",
static_cast<double>(faceInferenceResults.faceDetectionConfidence)),
cv::Point(static_cast<int>(tl.x),
static_cast<int>(tl.y - 5. * faceBoundingBoxWidth / 200.)),
cv::FONT_HERSHEY_COMPLEX, scale, cv::Scalar(200, 10, 10), 1);
cv::format("Detector confidence: %0.2f",
static_cast<double>(faceInferenceResults.faceDetectionConfidence)),
cv::Point(static_cast<int>(tl.x),
static_cast<int>(tl.y - 5. * faceBoundingBoxWidth / 200.)),
cv::FONT_HERSHEY_COMPLEX, scale, cv::Scalar(200, 10, 10), 1);
}

if (showHeadPoseAxes) {
Expand Down Expand Up @@ -73,10 +73,10 @@ void ResultsMarker::mark(cv::Mat& image,
cv::Scalar(255, 0, 255), 2);

putHighlightedText(image,
cv::format("head pose: (y=%0.0f, p=%0.0f, r=%0.0f)", std::round(yaw), std::round(pitch), std::round(roll)),
cv::Point(static_cast<int>(faceBoundingBox.tl().x),
static_cast<int>(faceBoundingBox.br().y + 5. * faceBoundingBoxWidth / 100.)),
cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1);
cv::format("head pose: (y=%0.0f, p=%0.0f, r=%0.0f)", std::round(yaw), std::round(pitch), std::round(roll)),
cv::Point(static_cast<int>(faceBoundingBox.tl().x),
static_cast<int>(faceBoundingBox.br().y + 5. * faceBoundingBoxWidth / 100.)),
cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1);
}

if (showLandmarks) {
Expand Down Expand Up @@ -114,12 +114,12 @@ void ResultsMarker::mark(cv::Mat& image,
gazeVectorToGazeAngles(faceInferenceResults.gazeVector, gazeAngles);

putHighlightedText(image,
cv::format("gaze angles: (h=%0.0f, v=%0.0f)",
static_cast<double>(std::round(gazeAngles.x)),
static_cast<double>(std::round(gazeAngles.y))),
cv::Point(static_cast<int>(faceBoundingBox.tl().x),
static_cast<int>(faceBoundingBox.br().y + 12. * faceBoundingBoxWidth / 100.)),
cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1);
cv::format("gaze angles: (h=%0.0f, v=%0.0f)",
static_cast<double>(std::round(gazeAngles.x)),
static_cast<double>(std::round(gazeAngles.y))),
cv::Point(static_cast<int>(faceBoundingBox.tl().x),
static_cast<int>(faceBoundingBox.br().y + 12. * faceBoundingBoxWidth / 100.)),
cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1);
}
}
if (showEyeState) {
Expand Down
10 changes: 5 additions & 5 deletions demos/interactive_face_detection_demo/cpp_gapi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ int main(int argc, char *argv[]) {
cv::GMat detections = cv::gapi::infer<Faces>(in);

cv::GArray<cv::Rect> faces = PostProc::on(detections, in,
FLAGS_t,
FLAGS_bb_enlarge_coef,
FLAGS_dx_coef,
FLAGS_dy_coef);
FLAGS_t,
FLAGS_bb_enlarge_coef,
FLAGS_dx_coef,
FLAGS_dy_coef);
auto outs = GOut(frame, detections, faces);

cv::GArray<cv::GMat> ages, genders;
Expand Down Expand Up @@ -351,7 +351,7 @@ int main(int argc, char *argv[]) {
}

return cv::GComputation(cv::GIn(in), std::move(outs));
});
});

auto det_net = cv::gapi::ie::Params<Faces> {
FLAGS_m, // path to model
Expand Down
12 changes: 4 additions & 8 deletions demos/smart_classroom_demo/cpp_gapi/include/initialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ void configNets(const NetsFlagsPack& flags,
}.cfgOutputLayers(outputBlobList);
networks += cv::gapi::networks(action_net);
slog::info << "The Person/Action Detection model " << flags.m_act << " is loaded to " << flags.d_act << " device." << slog::endl;
}
else {
} else {
slog::info << "Person/Action Detection DISABLED." << slog::endl;
}
if (!flags.m_fd.empty()) {
Expand All @@ -228,8 +227,7 @@ void configNets(const NetsFlagsPack& flags,
{1u, 3u, static_cast<size_t>(flags.inh_fd), static_cast<size_t>(flags.inw_fd)});
networks += cv::gapi::networks(det_net);
slog::info << "The Face Detection model" << flags.m_fd << " is loaded to " << flags.d_fd << " device." << slog::endl;
}
else {
} else {
slog::info << "Face Detection DISABLED." << slog::endl;
}

Expand All @@ -242,8 +240,7 @@ void configNets(const NetsFlagsPack& flags,
};
if (!flags.m_lm.empty()) {
slog::info << "The Facial Landmarks Regression model" << flags.m_lm << " is loaded to " << flags.d_lm << " device." << slog::endl;
}
else {
} else {
slog::info << "Facial Landmarks Regression DISABLED." << slog::endl;
}
/** Create reidentification net's parameters **/
Expand All @@ -255,8 +252,7 @@ void configNets(const NetsFlagsPack& flags,
networks += cv::gapi::networks(landm_net, reident_net);
if (!flags.m_reid.empty()) {
slog::info << "The Face Re-Identification model " << flags.m_reid << " is loaded to " << flags.d_reid << " device." << slog::endl;
}
else {
} else {
slog::info << "Face Re-Identification DISABLED." << slog::endl;
}
InferenceEngine::Core ie;
Expand Down

0 comments on commit f564df1

Please sign in to comment.