Merge pull request #675 from jet47/gpu-test-fixes

GPU test fixes
This commit is contained in:
Andrey Kamaev 2013-03-21 08:59:34 -07:00
commit 172b4554f3
9 changed files with 109 additions and 20 deletions

View File

@ -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());

View File

@ -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())
{

View File

@ -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);

View File

@ -55,6 +55,8 @@ PERF_TEST_P(Image_NFeatures, Features2D_ORB,
Combine(Values<string>("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());

View File

@ -632,7 +632,7 @@ DEF_PARAM_TEST_1(Image, string);
PERF_TEST_P(Image, ImgProc_MeanShiftFiltering,
Values<string>("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<string>("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<string>("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);
@ -1034,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
{
@ -1077,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
{

View File

@ -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());

View File

@ -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<CvBGStatModel>::delete_obj()
@ -142,7 +154,7 @@ PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack,
PERF_TEST_P(ImagePair, Video_BroxOpticalFlow,
Values<pair_string>(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());
@ -372,8 +384,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
{
@ -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

View File

@ -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<CvBGStatModel>::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

View File

@ -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