Skip to content

GAPI: Add compare function to perf tests#21150

Merged
alalek merged 9 commits intoopencv:4.xfrom
alexgiving:atrutnev/fluid_perf
Dec 14, 2021
Merged

GAPI: Add compare function to perf tests#21150
alalek merged 9 commits intoopencv:4.xfrom
alexgiving:atrutnev/fluid_perf

Conversation

@alexgiving
Copy link
Copy Markdown
Member

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2021.4.1:20.04
build_image:Custom Win=openvino-2021.4.1
build_image:Custom Mac=openvino-2021.4.1

test_modules:Custom=gapi,python2,python3,java
test_modules:Custom Win=gapi,python2,python3,java
test_modules:Custom Mac=gapi,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

{
EXPECT_TRUE(cmpF(out_mat_ocv, out_mat_gapi));
EXPECT_EQ(0, cv::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz_in);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave only one EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); and remove the rest.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied, thanks

Copy link
Copy Markdown
Contributor

@OrestChura OrestChura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!!

Copy link
Copy Markdown
Contributor

@OrestChura OrestChura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve conflicts as well as address some small comments remaining

Copy link
Copy Markdown
Contributor

@OrestChura OrestChura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@anna-khakimova
Copy link
Copy Markdown
Member

@alexgiving could you please resolve merge conflicts and revert all changes doesn't linked with topic of this PR?

cv::Size sz;
MatType type = -1;
cv::GCompileArgs compile_args;
std::tie(cmpF, opType, sz, type, compile_args) = GetParam();;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove redundant ; at the end of line.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied

Values(cv::compile_args(CORE_CPU))));

INSTANTIATE_TEST_CASE_P(AddWeightedPerfTestCPU, AddWeightedPerfTest,
Combine(Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()),
Copy link
Copy Markdown
Member

@anna-khakimova anna-khakimova Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please try to use AbsExact() function here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that test there is a comparison between (cv::Scalar, cv::Scalar), AbsExact() compare two cv::Mat

Copy link
Copy Markdown
Member

@anna-khakimova anna-khakimova Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you means AddWeightedPerfTestCPU? Are you sure?

Copy link
Copy Markdown
Member

@anna-khakimova anna-khakimova Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I means AddWeightedPerfTestCPU test case. It compares 2 cv::Mat. I'm sure. So, please try AbsExact().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied

Values(cv::compile_args(CORE_GPU))));


INSTANTIATE_TEST_CASE_P(DISABLED_ConcatVertVecPerfTestGPU, ConcatVertVecPerfTest,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please left a comment why this test still disabled?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That test is working now. Enabled

@alexgiving alexgiving force-pushed the atrutnev/fluid_perf branch 2 times, most recently from 339917d to faade90 Compare December 13, 2021 16:45
@dmatveev dmatveev added this to the 4.5.5 milestone Dec 13, 2021
@alexgiving alexgiving force-pushed the atrutnev/fluid_perf branch 2 times, most recently from 740bb86 to 1b38586 Compare December 13, 2021 18:47
class TransposePerfTest : public TestPerfParams<tuple<compare_f, cv::Size, MatType, cv::GCompileArgs>> {};
class ResizePerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, cv::Size, cv::GCompileArgs>> {};
class BottleneckKernelsConstInputPerfTest : public TestPerfParams<tuple<compare_f, std::string, cv::GCompileArgs>> {};
class BottleneckKernelsConstInputPerfTest : public TestPerfParams<tuple<compare_f, std::string, double, double, cv::GCompileArgs>> {};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove possibility of configuration scale parameter. This contradicts the meaning of the test. For this test case fx and fy must be strictly equal to 0.5. Always.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied

Values("cv/optflow/frames/1080p_00.png", "cv/optflow/frames/720p_00.png",
"cv/optflow/frames/VGA_00.png", "cv/dnn_face/recognition/Aaron_Tippin_0001.jpg"),
Values(0.5),
Values(0.5),
Copy link
Copy Markdown
Member

@anna-khakimova anna-khakimova Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this configuration parameters. fx and fy must be equals to 0.5 constantly. It should not be possible to change them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied

Copy link
Copy Markdown
Member

@anna-khakimova anna-khakimova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

@alexgiving
Copy link
Copy Markdown
Member Author

alexgiving commented Dec 14, 2021

AddWeightedPerfTest is not work on OpenCL on GPU (throw termination reason: reached maximum number of iterations/AbsExact error: G-API output and reference output matrixes are not bitexact equal.) with parameters (Any, 5) and (32FC1, Any) [3034]

@alalek alalek assigned dmatveev and unassigned anna-khakimova Dec 14, 2021
Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, approved 👍

The only question: How much time our perf test takes now? I believe we should cut the number of tested combinations to fit it into the reasonable amount (as @alalek has indicated a couple of times)

@alalek alalek merged commit 295da7e into opencv:4.x Dec 14, 2021
@alalek alalek mentioned this pull request Dec 30, 2021
@alalek alalek mentioned this pull request Feb 22, 2022
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
GAPI: Add compare function to perf tests

* Add PhasePerfTest and SqrtPerfTest

* rebasing

* debug tests

* remove spaces

* Disable DivRCPerfTestGPU

* rebase

* Applied comments

* Correction

* Revert parameter changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants