The facial landmarks via IE sample is added for dnn module#15137
The facial landmarks via IE sample is added for dnn module#15137OrestChura wants to merge 5 commits intoopencv:masterfrom
Conversation
|
@dmatveev, @AsyaPronina, @andrey-golubev, @rgarnov, @dkurt Hello! Please, review my PR |
samples/dnn/facial_landmarks_ie.cpp
Outdated
| using namespace cv::dnn; | ||
|
|
||
| #include <iostream> | ||
| //#include "common.hpp" |
samples/dnn/facial_landmarks_ie.cpp
Outdated
| "{ b | | The color to draw face rectangle and landmarks in format \"(b, g, r)\".}" | ||
| "{ g | | The color to draw face rectangle and landmarks in format \"(b, g, r)\".}" | ||
| "{ r | | The color to draw face rectangle and landmarks in format \"(b, g, r)\".}" | ||
| "{ faceframework | | Optional name of an origin framework of the facedetector. Detect it automatically if it does not set. }" |
samples/dnn/facial_landmarks_ie.cpp
Outdated
| "3: VPU }" | ||
| ); | ||
|
|
||
| parser.about("Use this script to run classification deep learning networks using OpenCV."); |
There was a problem hiding this comment.
About message need to be fixed
samples/dnn/facial_landmarks_ie.cpp
Outdated
| //Models' definition & initialization | ||
| Net faceNet = readNet(facexmlPath, facebinPath); | ||
| faceNet.setPreferableTarget(faceTarget); | ||
| faceNet.setPreferableBackend(faceBackend); |
There was a problem hiding this comment.
There is only DNN_INFERENCE_ENGINE_BACKEND is supported fo IR models so you can emit faceBackend argument
There was a problem hiding this comment.
Have I got it right that it has no sense even to ask the user about backends as there is only one of them available, so I can delete parser keys too?
|
@AsyaPronina I asked to make an MR in our internal Gitlab, not here. Not sure if it makes sense to start merging it right now in any form. Please make an integration branch in Gitlab and move the MRs there (open against that integration branch). |
|
Still, if you think it is more useful and productive to continue here (and while a build is green), please continue here. Not sure if any builder actually tests this code now, though (some custom builder configurations is required AFAIK). |
- In addition to the Dmitry's issue, framework parser key is cut; - Work with color changed, choosing by user is cut; - Some fixes about Point() declarations; - Comment fixes
samples/dnn/facial_landmarks_ie.cpp
Outdated
| const unsigned int landmrows = 60; | ||
| const float bb_enlarge_coefficient = 1.0f; | ||
|
|
||
| const std::string win1 = "FaceLandmarkDetector"; |
There was a problem hiding this comment.
win1 is not a good name in my opinion, why do you use 1?
There was a problem hiding this comment.
Because there was another window some time ago.. My mistake, thank you
samples/dnn/facial_landmarks_ie.cpp
Outdated
| @@ -0,0 +1,195 @@ | |||
| // This file is part of OpenCV project. | |||
There was a problem hiding this comment.
Sorry for confuse but license header is not need in the samples folder
There was a problem hiding this comment.
The strings 1-7 should be removed?
There was a problem hiding this comment.
There is the license header in, for example, colorization sample..
samples/dnn/facial_landmarks_ie.cpp
Outdated
| } | ||
|
|
||
| //Parsing input arguments | ||
| const std::string facexmlPath = parser.get<std::string>("facestruct"); |
There was a problem hiding this comment.
If you use Camel case for variable naming please follow standard rules for this:
CamelCase Notation
CamelCase (sometimes called "CamelBack") notation is the practice of writing compound words or phrases in which the parts are joined without spaces, with each part's initial letter capitalized and the first letter in either upper or lower case. For example: SampleDataTable, computeExpr
samples/dnn/facial_landmarks_ie.cpp
Outdated
| if (parser.has("input")) | ||
| cap.open(parser.get<String>("input")); | ||
| else if (!cap.open(0)) | ||
| { |
samples/dnn/facial_landmarks_ie.cpp
Outdated
| break; | ||
| } | ||
|
|
||
| Mat shwimg; //Image to show |
There was a problem hiding this comment.
I suggest to stick to one naming style
samples/dnn/facial_landmarks_ie.cpp
Outdated
| Mat inputImg; | ||
| resize(img, inputImg, Size(facecols, facerows)); | ||
|
|
||
| //Infering Facedetector |
There was a problem hiding this comment.
Face detector or FaceDetector
samples/dnn/facial_landmarks_ie.cpp
Outdated
| Mat outFaces = faceNet.forward(); | ||
|
|
||
| float* faceData = (float*)(outFaces.data); | ||
| for (size_t i = 0; i < outFaces.total(); i += faceObjectSize) |
There was a problem hiding this comment.
Very minor suggestion: if you use size_t it is better to use 0ul
samples/dnn/facial_landmarks_ie.cpp
Outdated
| int top = int(faceData[i + 4] * img.rows); | ||
| top = std::max(top, 0); | ||
| int right = int(faceData[i + 5] * img.cols); | ||
| right = std::min(right, img.cols-2); |
There was a problem hiding this comment.
Please stick to the one convention about using or not the spaces between operators and operands
samples/dnn/facial_landmarks_ie.cpp
Outdated
|
|
||
| //Postprocessing for landmarks | ||
| int max_of_sizes = std::max(width, height); | ||
| int add_width = int(max_of_sizes*bb_enlarge_coefficient) - width; |
There was a problem hiding this comment.
max_of_sizes and bb_enlarge_coefficient namings differ from Camel Case code convention you use in other code
Okay will sort out with this today |
|
So what it means? Why high level API is not using G-API? |
To be fair, I am not sure what the "high-level API" is. G-API has its own programming model so we're adding inference there now, and this one should be among the early samples. |
|
@dkurt thanks! Actually, efficient pipelining of preprocessing, inference, postprocessing, and other stuff is the reason why we add inference & streaming extensions in G-API. So what's the point and value-add of High-level API? @bhack meanwhile, if you're interested, here's some sample code and some more general info on G-API. |
|
@dmatveev, Due with this high-level API user do not use |
- Some small issues
|
I created 1 PR for the DNN high_level api, adding a keypoints module. Maybe this chain of detection->landmarking could be implemented as part of said module by chaining the detection and keypointing module? |
Thanks a lot! Have seen your PR, it looks reasonable to integrate our sample into your module, but is there any sense to add the InferenceEngine dependence into it? In my opinion, the sample is more intented to reflect the IE models usage in DNN API. |
|
It seems that this won't be done yet as per dkurts's comment. |
|
The PR is closed as a similar sample exists already, so there's no need in this sample. |
This pullrequest changes