From 83def21ba93d1fa0f12a516cb0ea6a033f72e306 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 20 Mar 2013 11:49:33 +0400 Subject: [PATCH 1/4] increased time limits in perf tests --- modules/gpu/perf/perf_calib3d.cpp | 6 +++--- modules/gpu/perf/perf_denoising.cpp | 2 +- modules/gpu/perf/perf_features2d.cpp | 2 ++ modules/gpu/perf/perf_imgproc.cpp | 10 +++++++--- modules/gpu/perf/perf_objdetect.cpp | 2 ++ modules/gpu/perf/perf_video.cpp | 2 +- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/gpu/perf/perf_calib3d.cpp b/modules/gpu/perf/perf_calib3d.cpp index 3631236fe..8019c0349 100644 --- a/modules/gpu/perf/perf_calib3d.cpp +++ b/modules/gpu/perf/perf_calib3d.cpp @@ -13,7 +13,7 @@ DEF_PARAM_TEST_1(ImagePair, pair_string); PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png", "gpu/perf/aloeR.png"))) { - declare.time(5.0); + declare.time(300.0); const cv::Mat imgLeft = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(imgLeft.empty()); @@ -54,7 +54,7 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png"))) { - declare.time(10.0); + declare.time(300.0); const cv::Mat imgLeft = readImage(GET_PARAM(0)); ASSERT_FALSE(imgLeft.empty()); @@ -88,7 +88,7 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png"))) { - declare.time(10.0); + declare.time(300.0); const cv::Mat imgLeft = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(imgLeft.empty()); diff --git a/modules/gpu/perf/perf_denoising.cpp b/modules/gpu/perf/perf_denoising.cpp index e4ce9f3c3..970122568 100644 --- a/modules/gpu/perf/perf_denoising.cpp +++ b/modules/gpu/perf/perf_denoising.cpp @@ -64,7 +64,7 @@ PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_NonLocalMeans, Values(21), Values(5))) { - declare.time(60.0); + declare.time(600.0); const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); diff --git a/modules/gpu/perf/perf_features2d.cpp b/modules/gpu/perf/perf_features2d.cpp index c6b1f598a..e5a6ef3c8 100644 --- a/modules/gpu/perf/perf_features2d.cpp +++ b/modules/gpu/perf/perf_features2d.cpp @@ -55,6 +55,8 @@ PERF_TEST_P(Image_NFeatures, Features2D_ORB, Combine(Values("gpu/perf/aloe.png"), Values(4000))) { + declare.time(300.0); + const cv::Mat img = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index d1a87968d..c984b04fd 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -632,7 +632,7 @@ DEF_PARAM_TEST_1(Image, string); PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, Values("gpu/meanshift/cones.png")) { - declare.time(15.0); + declare.time(300.0); const cv::Mat img = readImage(GetParam()); ASSERT_FALSE(img.empty()); @@ -668,7 +668,7 @@ PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, PERF_TEST_P(Image, ImgProc_MeanShiftProc, Values("gpu/meanshift/cones.png")) { - declare.time(5.0); + declare.time(300.0); const cv::Mat img = readImage(GetParam()); ASSERT_FALSE(img.empty()); @@ -702,7 +702,7 @@ PERF_TEST_P(Image, ImgProc_MeanShiftProc, PERF_TEST_P(Image, ImgProc_MeanShiftSegmentation, Values("gpu/meanshift/cones.png")) { - declare.time(5.0); + declare.time(300.0); const cv::Mat img = readImage(GetParam()); ASSERT_FALSE(img.empty()); @@ -830,6 +830,8 @@ PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, GPU_CHANNELS_1_3_4, ALL_TEMPLATE_METHODS)) { + declare.time(300.0); + const cv::Size size = GET_PARAM(0); const cv::Size templ_size = GET_PARAM(1); const int cn = GET_PARAM(2); @@ -868,6 +870,8 @@ PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate32F, GPU_CHANNELS_1_3_4, Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR)))) { + declare.time(300.0); + const cv::Size size = GET_PARAM(0); const cv::Size templ_size = GET_PARAM(1); const int cn = GET_PARAM(2); diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpu/perf/perf_objdetect.cpp index 51c8695d1..4f8e56853 100644 --- a/modules/gpu/perf/perf_objdetect.cpp +++ b/modules/gpu/perf/perf_objdetect.cpp @@ -19,6 +19,8 @@ PERF_TEST_P(Image, ObjDetect_HOG, "gpu/caltech/image_00000527_0.png", "gpu/caltech/image_00000574_0.png")) { + declare.time(300.0); + const cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index e9b38ed5e..86e129c73 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -142,7 +142,7 @@ PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack, PERF_TEST_P(ImagePair, Video_BroxOpticalFlow, Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) { - declare.time(10); + declare.time(300); cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); From b07bce11ef2238291b6c430f3e8def3160fec82b Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 20 Mar 2013 11:49:58 +0400 Subject: [PATCH 2/4] increased epsilon in sanity test --- modules/gpu/perf/perf_imgproc.cpp | 4 ++-- modules/gpu/perf/perf_video.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index c984b04fd..84cb0e200 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -1038,7 +1038,7 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerHarris, TEST_CYCLE() cv::gpu::cornerHarris(d_img, dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode); - GPU_SANITY_CHECK(dst); + GPU_SANITY_CHECK(dst, 1e-4); } else { @@ -1081,7 +1081,7 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, TEST_CYCLE() cv::gpu::cornerMinEigenVal(d_img, dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode); - GPU_SANITY_CHECK(dst); + GPU_SANITY_CHECK(dst, 1e-4); } else { diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index 86e129c73..876d81513 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -372,8 +372,8 @@ PERF_TEST_P(ImagePair, Video_OpticalFlowDual_TVL1, TEST_CYCLE() d_alg(d_frame0, d_frame1, u, v); - GPU_SANITY_CHECK(u, 1e-4); - GPU_SANITY_CHECK(v, 1e-4); + GPU_SANITY_CHECK(u, 1e-2); + GPU_SANITY_CHECK(v, 1e-2); } else { From 0149969463bc989d232525d903b0f63ccf889ea2 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 20 Mar 2013 11:50:42 +0400 Subject: [PATCH 3/4] disable tests that requires video support if it is not available --- modules/gpu/perf/perf_video.cpp | 42 +++++++++++++++++++++++++++---- modules/gpu/test/test_bgfg.cpp | 24 ++++++++++++++++++ modules/nonfree/perf/perf_gpu.cpp | 16 ++++++++++++ 3 files changed, 77 insertions(+), 5 deletions(-) diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index 876d81513..b998ff95f 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -4,6 +4,18 @@ using namespace std; using namespace testing; using namespace perf; +#if defined(HAVE_XINE) || \ + defined(HAVE_GSTREAMER) || \ + defined(HAVE_QUICKTIME) || \ + defined(HAVE_AVFOUNDATION) || \ + defined(HAVE_FFMPEG) || \ + defined(WIN32) /* assume that we have ffmpeg */ + +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1 +#else +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0 +#endif + namespace cv { template<> void Ptr::delete_obj() @@ -482,6 +494,8 @@ PERF_TEST_P(ImagePair, Video_FastOpticalFlowBM, ////////////////////////////////////////////////////// // FGDStatModel +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + DEF_PARAM_TEST_1(Video, string); PERF_TEST_P(Video, Video_FGDStatModel, @@ -548,9 +562,13 @@ PERF_TEST_P(Video, Video_FGDStatModel, } } +#endif + ////////////////////////////////////////////////////// // MOG +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + DEF_PARAM_TEST(Video_Cn_LearningRate, string, MatCn, double); PERF_TEST_P(Video_Cn_LearningRate, Video_MOG, @@ -643,9 +661,13 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG, } } +#endif + ////////////////////////////////////////////////////// // MOG2 +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + DEF_PARAM_TEST(Video_Cn, string, int); PERF_TEST_P(Video_Cn, Video_MOG2, @@ -740,9 +762,13 @@ PERF_TEST_P(Video_Cn, Video_MOG2, } } +#endif + ////////////////////////////////////////////////////// // MOG2GetBackgroundImage +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4)) @@ -818,9 +844,13 @@ PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, } } +#endif + ////////////////////////////////////////////////////// // GMG +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + DEF_PARAM_TEST(Video_Cn_MaxFeatures, string, MatCn, int); PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG, @@ -928,11 +958,13 @@ PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG, } } -#ifdef HAVE_NVCUVID +#endif ////////////////////////////////////////////////////// // VideoReader +#if defined(HAVE_NVCUVID) && BUILD_WITH_VIDEO_INPUT_SUPPORT + PERF_TEST_P(Video, Video_VideoReader, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) { declare.time(20); @@ -963,10 +995,12 @@ PERF_TEST_P(Video, Video_VideoReader, Values("gpu/video/768x576.avi", "gpu/video } } +#endif + ////////////////////////////////////////////////////// // VideoWriter -#ifdef WIN32 +#if defined(HAVE_NVCUVID) && defined(WIN32) PERF_TEST_P(Video, Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) { @@ -1024,6 +1058,4 @@ PERF_TEST_P(Video, Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video SANITY_CHECK(frame); } -#endif // WIN32 - -#endif // HAVE_NVCUVID +#endif diff --git a/modules/gpu/test/test_bgfg.cpp b/modules/gpu/test/test_bgfg.cpp index 253ded26c..9847fcfab 100644 --- a/modules/gpu/test/test_bgfg.cpp +++ b/modules/gpu/test/test_bgfg.cpp @@ -45,9 +45,23 @@ using namespace cvtest; +#if defined(HAVE_XINE) || \ + defined(HAVE_GSTREAMER) || \ + defined(HAVE_QUICKTIME) || \ + defined(HAVE_AVFOUNDATION) || \ + defined(HAVE_FFMPEG) || \ + defined(WIN32) /* assume that we have ffmpeg */ + +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1 +#else +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0 +#endif + ////////////////////////////////////////////////////// // FGDStatModel +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + namespace cv { template<> void Ptr::delete_obj() @@ -132,9 +146,13 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, FGDStatModel, testing::Combine( testing::Values(std::string("768x576.avi")), testing::Values(Channels(3), Channels(4)))); +#endif + ////////////////////////////////////////////////////// // MOG +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + namespace { IMPLEMENT_PARAM_CLASS(UseGray, bool) @@ -206,9 +224,13 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, MOG, testing::Combine( testing::Values(LearningRate(0.0), LearningRate(0.01)), WHOLE_SUBMAT)); +#endif + ////////////////////////////////////////////////////// // MOG2 +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + namespace { IMPLEMENT_PARAM_CLASS(DetectShadow, bool) @@ -322,6 +344,8 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, MOG2, testing::Combine( testing::Values(DetectShadow(true), DetectShadow(false)), WHOLE_SUBMAT)); +#endif + ////////////////////////////////////////////////////// // GMG diff --git a/modules/nonfree/perf/perf_gpu.cpp b/modules/nonfree/perf/perf_gpu.cpp index a68fb6a0e..c00955c89 100644 --- a/modules/nonfree/perf/perf_gpu.cpp +++ b/modules/nonfree/perf/perf_gpu.cpp @@ -4,6 +4,18 @@ using namespace std; using namespace testing; using namespace perf; +#if defined(HAVE_XINE) || \ + defined(HAVE_GSTREAMER) || \ + defined(HAVE_QUICKTIME) || \ + defined(HAVE_AVFOUNDATION) || \ + defined(HAVE_FFMPEG) || \ + defined(WIN32) /* assume that we have ffmpeg */ + +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1 +#else +# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0 +#endif + #if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) ////////////////////////////////////////////////////////////////////// @@ -55,6 +67,8 @@ PERF_TEST_P(Image, GPU_SURF, ////////////////////////////////////////////////////// // VIBE +#if BUILD_WITH_VIDEO_INPUT_SUPPORT + DEF_PARAM_TEST(Video_Cn, string, int); PERF_TEST_P(Video_Cn, GPU_VIBE, @@ -120,3 +134,5 @@ PERF_TEST_P(Video_Cn, GPU_VIBE, } #endif + +#endif From d87b709c2614c87f74ce72de8c23c0e623f91f11 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 21 Mar 2013 12:18:56 +0400 Subject: [PATCH 4/4] fixed minMax perf test --- modules/gpu/perf/perf_core.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp index 22840f9f4..70bb8f24f 100644 --- a/modules/gpu/perf/perf_core.cpp +++ b/modules/gpu/perf/perf_core.cpp @@ -1748,7 +1748,10 @@ PERF_TEST_P(Sz_Depth_Norm, Core_Norm, const int normType = GET_PARAM(2); cv::Mat src(size, depth); - declare.in(src, WARMUP_RNG); + if (depth == CV_8U) + cv::randu(src, 0, 254); + else + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { @@ -1923,7 +1926,10 @@ PERF_TEST_P(Sz_Depth, Core_MinMax, const int depth = GET_PARAM(1); cv::Mat src(size, depth); - declare.in(src, WARMUP_RNG); + if (depth == CV_8U) + cv::randu(src, 0, 254); + else + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { @@ -1958,7 +1964,10 @@ PERF_TEST_P(Sz_Depth, Core_MinMaxLoc, const int depth = GET_PARAM(1); cv::Mat src(size, depth); - declare.in(src, WARMUP_RNG); + if (depth == CV_8U) + cv::randu(src, 0, 254); + else + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) {