From: Dmitry Budnikov Date: Wed, 2 Jun 2021 16:26:22 +0000 (+0300) Subject: Merge pull request #20189 from dbudniko:dbudniko/mtcnn_sample_with_regular_transpose_... X-Git-Tag: submit/tizen/20220120.021815~1^2~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=826fdaf06c6b935a25682755f69411b28c284c38;p=platform%2Fupstream%2Fopencv.git Merge pull request #20189 from dbudniko:dbudniko/mtcnn_sample_with_regular_transpose_kernel Remove custom transpose kernel from MTCNN sample --- diff --git a/modules/gapi/samples/face_detection_mtcnn.cpp b/modules/gapi/samples/face_detection_mtcnn.cpp index 2db7517296..6e88a9ec56 100644 --- a/modules/gapi/samples/face_detection_mtcnn.cpp +++ b/modules/gapi/samples/face_detection_mtcnn.cpp @@ -305,14 +305,6 @@ G_API_OP(SwapFaces, } }; -G_API_OP(Transpose, - , - "sample.custom.mtcnn.transpose") { - static cv::GMatDesc outMeta(const cv::GMatDesc in) { - return in.withSize(cv::Size(in.size.height, in.size.width)); - } -}; - //Custom kernels implementation GAPI_OCV_KERNEL(OCVBuildFaces, BuildFaces) { static void run(const cv::Mat & in_scores, @@ -450,12 +442,6 @@ GAPI_OCV_KERNEL(OCVSwapFaces, SwapFaces) { } };// GAPI_OCV_KERNEL(SwapFaces) -GAPI_OCV_KERNEL(OCVTranspose, Transpose) { - static void run(const cv::Mat &in_mat, - cv::Mat &out_mat) { - cv::transpose(in_mat, out_mat); - } -};// GAPI_OCV_KERNEL(Transpose) } // anonymous namespace } // namespace custom @@ -613,7 +599,7 @@ int main(int argc, char* argv[]) { //The very first PNet pyramid layer to init total_faces[0] in_resized[0] = cv::gapi::resize(in_originalRGB, level_size[0]); - in_transposed[0] = custom::Transpose::on(in_resized[0]); + in_transposed[0] = cv::gapi::transpose(in_resized[0]); std::tie(regressions[0], scores[0]) = run_mtcnn_p(in_transposed[0], get_pnet_level_name(level_size[0])); cv::GArray faces0 = custom::BuildFaces::on(scores[0], regressions[0], static_cast(scales[0]), conf_thresh_p); cv::GArray final_p_faces_for_bb2squares = custom::ApplyRegression::on(faces0, true); @@ -624,7 +610,7 @@ int main(int argc, char* argv[]) { for (int i = 1; i < pyramid_levels; ++i) { in_resized[i] = cv::gapi::resize(in_originalRGB, level_size[i]); - in_transposed[i] = custom::Transpose::on(in_resized[i]); + in_transposed[i] = cv::gapi::transpose(in_resized[i]); std::tie(regressions[i], scores[i]) = run_mtcnn_p(in_transposed[i], get_pnet_level_name(level_size[i])); cv::GArray faces = custom::BuildFaces::on(scores[i], regressions[i], static_cast(scales[i]), conf_thresh_p); cv::GArray final_p_faces_for_bb2squares_i = custom::ApplyRegression::on(faces, true); @@ -639,7 +625,7 @@ int main(int argc, char* argv[]) { //Refinement part of MTCNN graph cv::GArray faces_roi_pnet = custom::R_O_NetPreProcGetROIs::on(final_faces_pnet, in_sz); cv::GArray regressionsRNet, scoresRNet; - cv::GMat in_originalRGB_transposed = custom::Transpose::on(in_originalRGB); + cv::GMat in_originalRGB_transposed = cv::gapi::transpose(in_originalRGB); std::tie(regressionsRNet, scoresRNet) = cv::gapi::infer(faces_roi_pnet, in_originalRGB_transposed); //Refinement post-processing @@ -701,7 +687,6 @@ int main(int argc, char* argv[]) { , custom::OCVRNetPostProc , custom::OCVONetPostProc , custom::OCVSwapFaces - , custom::OCVTranspose >(); auto mtcnn_args = cv::compile_args(networks_mtcnn, kernels_mtcnn); if (streaming_queue_capacity != 0)