mirror of
https://github.com/opencv/opencv.git
synced 2025-06-28 07:23:30 +08:00
Merge pull request #20474 from dbudniko:dbudniko/mtcnn_graph_without_resizes
Remove explicit PNet resizes from MTCNN graph * remove PNet resizes * address comment from Ruslan
This commit is contained in:
parent
d52e4e5df3
commit
ba0cea6826
@ -591,16 +591,13 @@ int main(int argc, char* argv[]) {
|
|||||||
cv::GMat in_originalRGB = cv::gapi::BGR2RGB(in_original);
|
cv::GMat in_originalRGB = cv::gapi::BGR2RGB(in_original);
|
||||||
cv::GMat in_transposedRGB = cv::gapi::transpose(in_originalRGB);
|
cv::GMat in_transposedRGB = cv::gapi::transpose(in_originalRGB);
|
||||||
cv::GOpaque<cv::Size> in_sz = cv::gapi::streaming::size(in_original);
|
cv::GOpaque<cv::Size> in_sz = cv::gapi::streaming::size(in_original);
|
||||||
cv::GMat in_resized[MAX_PYRAMID_LEVELS];
|
|
||||||
cv::GMat regressions[MAX_PYRAMID_LEVELS];
|
cv::GMat regressions[MAX_PYRAMID_LEVELS];
|
||||||
cv::GMat scores[MAX_PYRAMID_LEVELS];
|
cv::GMat scores[MAX_PYRAMID_LEVELS];
|
||||||
cv::GArray<custom::Face> nms_p_faces[MAX_PYRAMID_LEVELS];
|
cv::GArray<custom::Face> nms_p_faces[MAX_PYRAMID_LEVELS];
|
||||||
cv::GArray<custom::Face> total_faces[MAX_PYRAMID_LEVELS];
|
cv::GArray<custom::Face> total_faces[MAX_PYRAMID_LEVELS];
|
||||||
|
|
||||||
//The very first PNet pyramid layer to init total_faces[0]
|
//The very first PNet pyramid layer to init total_faces[0]
|
||||||
cv::Size currentSize = cv::Size(level_size[0].height, level_size[0].width);
|
std::tie(regressions[0], scores[0]) = run_mtcnn_p(in_transposedRGB, get_pnet_level_name(level_size[0]));
|
||||||
in_resized[0] = cv::gapi::resize(in_transposedRGB, currentSize);
|
|
||||||
std::tie(regressions[0], scores[0]) = run_mtcnn_p(in_resized[0], get_pnet_level_name(level_size[0]));
|
|
||||||
cv::GArray<custom::Face> faces0 = custom::BuildFaces::on(scores[0], regressions[0], static_cast<float>(scales[0]), conf_thresh_p);
|
cv::GArray<custom::Face> faces0 = custom::BuildFaces::on(scores[0], regressions[0], static_cast<float>(scales[0]), conf_thresh_p);
|
||||||
cv::GArray<custom::Face> final_p_faces_for_bb2squares = custom::ApplyRegression::on(faces0, true);
|
cv::GArray<custom::Face> final_p_faces_for_bb2squares = custom::ApplyRegression::on(faces0, true);
|
||||||
cv::GArray<custom::Face> final_faces_pnet0 = custom::BBoxesToSquares::on(final_p_faces_for_bb2squares);
|
cv::GArray<custom::Face> final_faces_pnet0 = custom::BBoxesToSquares::on(final_p_faces_for_bb2squares);
|
||||||
@ -608,9 +605,7 @@ int main(int argc, char* argv[]) {
|
|||||||
//The rest PNet pyramid layers to accumlate all layers result in total_faces[PYRAMID_LEVELS - 1]]
|
//The rest PNet pyramid layers to accumlate all layers result in total_faces[PYRAMID_LEVELS - 1]]
|
||||||
for (int i = 1; i < pyramid_levels; ++i)
|
for (int i = 1; i < pyramid_levels; ++i)
|
||||||
{
|
{
|
||||||
currentSize = cv::Size(level_size[i].height, level_size[i].width);
|
std::tie(regressions[i], scores[i]) = run_mtcnn_p(in_transposedRGB, get_pnet_level_name(level_size[i]));
|
||||||
in_resized[i] = cv::gapi::resize(in_transposedRGB, currentSize);
|
|
||||||
std::tie(regressions[i], scores[i]) = run_mtcnn_p(in_resized[i], get_pnet_level_name(level_size[i]));
|
|
||||||
cv::GArray<custom::Face> faces = custom::BuildFaces::on(scores[i], regressions[i], static_cast<float>(scales[i]), conf_thresh_p);
|
cv::GArray<custom::Face> faces = custom::BuildFaces::on(scores[i], regressions[i], static_cast<float>(scales[i]), conf_thresh_p);
|
||||||
cv::GArray<custom::Face> final_p_faces_for_bb2squares_i = custom::ApplyRegression::on(faces, true);
|
cv::GArray<custom::Face> final_p_faces_for_bb2squares_i = custom::ApplyRegression::on(faces, true);
|
||||||
cv::GArray<custom::Face> final_faces_pnet_i = custom::BBoxesToSquares::on(final_p_faces_for_bb2squares_i);
|
cv::GArray<custom::Face> final_faces_pnet_i = custom::BBoxesToSquares::on(final_p_faces_for_bb2squares_i);
|
||||||
|
Loading…
Reference in New Issue
Block a user