From e1cd60c96edcf16f32e337561d6240321e817895 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Mon, 2 Oct 2017 17:00:38 +0300 Subject: [PATCH] saliency: remove broken perf tests --- modules/saliency/perf/perf_main.cpp | 3 - .../perf_motionSaliencyBinWangApr2014.cpp | 106 ----------------- modules/saliency/perf/perf_objectnessBING.cpp | 108 ------------------ modules/saliency/perf/perf_precomp.hpp | 21 ---- .../perf_staticSaliencySpectralResidual.cpp | 87 -------------- .../src/motionSaliencyBinWangApr2014.cpp | 2 + 6 files changed, 2 insertions(+), 325 deletions(-) delete mode 100644 modules/saliency/perf/perf_main.cpp delete mode 100644 modules/saliency/perf/perf_motionSaliencyBinWangApr2014.cpp delete mode 100644 modules/saliency/perf/perf_objectnessBING.cpp delete mode 100644 modules/saliency/perf/perf_precomp.hpp delete mode 100644 modules/saliency/perf/perf_staticSaliencySpectralResidual.cpp diff --git a/modules/saliency/perf/perf_main.cpp b/modules/saliency/perf/perf_main.cpp deleted file mode 100644 index f84b6e5d2..000000000 --- a/modules/saliency/perf/perf_main.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "perf_precomp.hpp" - -CV_PERF_TEST_MAIN(saliency) diff --git a/modules/saliency/perf/perf_motionSaliencyBinWangApr2014.cpp b/modules/saliency/perf/perf_motionSaliencyBinWangApr2014.cpp deleted file mode 100644 index 5e641d9f4..000000000 --- a/modules/saliency/perf/perf_motionSaliencyBinWangApr2014.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// - // - // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. - // - // By downloading, copying, installing or using the software you agree to this license. - // If you do not agree to this license, do not download, install, - // copy or use the software. - // - // - // License Agreement - // For Open Source Computer Vision Library - // - // Copyright (C) 2014, OpenCV Foundation, all rights reserved. - // Third party copyrights are property of their respective owners. - // - // Redistribution and use in source and binary forms, with or without modification, - // are permitted provided that the following conditions are met: - // - // * Redistribution's of source code must retain the above copyright notice, - // this list of conditions and the following disclaimer. - // - // * Redistribution's in binary form must reproduce the above copyright notice, - // this list of conditions and the following disclaimer in the documentation - // and/or other materials provided with the distribution. - // - // * The name of the copyright holders may not be used to endorse or promote products - // derived from this software without specific prior written permission. - // - // This software is provided by the copyright holders and contributors "as is" and - // any express or implied warranties, including, but not limited to, the implied - // warranties of merchantability and fitness for a particular purpose are disclaimed. - // In no event shall the Intel Corporation or contributors be liable for any direct, - // indirect, incidental, special, exemplary, or consequential damages - // (including, but not limited to, procurement of substitute goods or services; - // loss of use, data, or profits; or business interruption) however caused - // and on any theory of liability, whether in contract, strict liability, - // or tort (including negligence or otherwise) arising in any way out of - // the use of this software, even if advised of the possibility of such damage. - // - //M*/ - -#include "perf_precomp.hpp" -#include -#include - -//write sanity: ./bin/opencv_perf_saliency --perf_write_sanity=true -//verify sanity: ./bin/opencv_perf_saliency - -using namespace std; -using namespace cv; -using namespace perf; - -#define TESTSET_NAMES \ - "/cv/saliency/motion/blizzard.webm",\ - "/cv/saliency/motion/pedestrian.webm" ,\ - "/cv/saliency/motion/snowFall.webm" - -const string SALIENCY_DIR = "cv/saliency"; - -typedef perf::TestBaseWithParam sal; - -PERF_TEST_P(sal, motionSaliencyBinWangApr2014, testing::Values(TESTSET_NAMES)) -{ - string filename = getDataPath(GetParam()); - int startFrame=0; - Mat frame; - Mat saliencyMap; - double videoSize=0; - - Ptr saliencyAlgorithm = saliency::Saliency::create( "BinWangApr2014" ); - - TEST_CYCLE_N(1) - { - VideoCapture c; - c.open( filename); - videoSize=c.get( CAP_PROP_FRAME_COUNT); - c.set( CAP_PROP_POS_FRAMES, startFrame ); - - for ( int frameCounter = 0; frameCounter < videoSize; frameCounter++ ) - { - c >> frame; - - if( frame.empty() ) - { - break; - } - - saliencyAlgorithm.dynamicCast()->setImagesize( frame.cols, frame.rows ); - saliencyAlgorithm.dynamicCast()->init(); - - if( saliencyAlgorithm->computeSaliency( frame, saliencyMap ) ) - { - - } - else - { - FAIL()<< "***Error in the instantiation of the saliency algorithm...***\n" << endl; - return; - } - - } - } - - SANITY_CHECK(saliencyMap); - -} diff --git a/modules/saliency/perf/perf_objectnessBING.cpp b/modules/saliency/perf/perf_objectnessBING.cpp deleted file mode 100644 index 6b502585e..000000000 --- a/modules/saliency/perf/perf_objectnessBING.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// - // - // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. - // - // By downloading, copying, installing or using the software you agree to this license. - // If you do not agree to this license, do not download, install, - // copy or use the software. - // - // - // License Agreement - // For Open Source Computer Vision Library - // - // Copyright (C) 2014, OpenCV Foundation, all rights reserved. - // Third party copyrights are property of their respective owners. - // - // Redistribution and use in source and binary forms, with or without modification, - // are permitted provided that the following conditions are met: - // - // * Redistribution's of source code must retain the above copyright notice, - // this list of conditions and the following disclaimer. - // - // * Redistribution's in binary form must reproduce the above copyright notice, - // this list of conditions and the following disclaimer in the documentation - // and/or other materials provided with the distribution. - // - // * The name of the copyright holders may not be used to endorse or promote products - // derived from this software without specific prior written permission. - // - // This software is provided by the copyright holders and contributors "as is" and - // any express or implied warranties, including, but not limited to, the implied - // warranties of merchantability and fitness for a particular purpose are disclaimed. - // In no event shall the Intel Corporation or contributors be liable for any direct, - // indirect, incidental, special, exemplary, or consequential damages - // (including, but not limited to, procurement of substitute goods or services; - // loss of use, data, or profits; or business interruption) however caused - // and on any theory of liability, whether in contract, strict liability, - // or tort (including negligence or otherwise) arising in any way out of - // the use of this software, even if advised of the possibility of such damage. - // - //M*/ - -#include "perf_precomp.hpp" - -//write sanity: ./bin/opencv_perf_saliency --perf_write_sanity=true -//verify sanity: ./bin/opencv_perf_saliency - -using namespace std; -using namespace cv; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; - -typedef perf::TestBaseWithParam sal; - -#define BING_IMAGES \ - "cv/saliency/objectness/000021.jpg", \ -"cv/saliency/objectness/000022.jpg" - -void getMatOfRects( const vector& saliencyMap, Mat& bbs_mat ) -{ - for ( int b = 0; b < (int)saliencyMap.size(); b++ ) - { - bbs_mat.at( b, 0 ) = saliencyMap[b].val[0]; - bbs_mat.at( b, 1 ) = saliencyMap[b].val[1]; - bbs_mat.at( b, 2 ) = saliencyMap[b].val[2]; - bbs_mat.at( b, 3 ) = saliencyMap[b].val[3]; - } -} - -PERF_TEST_P(sal, objectnessBING, testing::Values(BING_IMAGES)) -{ - string filename = getDataPath(GetParam()); - cout< saliencyMap; - String training_path = "/home/puja/src/opencv_contrib/modules/saliency/samples/ObjectnessTrainedModel"; - - if (image.empty()) - FAIL() << "Unable to load source image " << filename; - - Ptr saliencyAlgorithm = saliency::Saliency::create( "BING" ); - - TEST_CYCLE_N(1) - { - if( training_path.empty() ) - { - FAIL() << "Path of trained files missing! " << endl; - return; - } - - else - { - saliencyAlgorithm.dynamicCast()->setTrainingPath( training_path ); - saliencyAlgorithm.dynamicCast()->setBBResDir( training_path + "/Results" ); - - if( saliencyAlgorithm->computeSaliency( image, saliencyMap ) ) - { - - } - } - } //end CYCLE - - //save the bounding boxes in a Mat - Mat bbs_mat( (int)saliencyMap.size(), 4, CV_32F ); - getMatOfRects( saliencyMap, bbs_mat ); - - SANITY_CHECK( bbs_mat); -} diff --git a/modules/saliency/perf/perf_precomp.hpp b/modules/saliency/perf/perf_precomp.hpp deleted file mode 100644 index 150886492..000000000 --- a/modules/saliency/perf/perf_precomp.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - -#ifndef __OPENCV_SALIENCY_PRECOMP_HPP__ -#define __OPENCV_SALIENCY_PRECOMP_HPP__ - -#include -#include -#include -#include - -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif - -#endif diff --git a/modules/saliency/perf/perf_staticSaliencySpectralResidual.cpp b/modules/saliency/perf/perf_staticSaliencySpectralResidual.cpp deleted file mode 100644 index ca470da59..000000000 --- a/modules/saliency/perf/perf_staticSaliencySpectralResidual.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// - // - // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. - // - // By downloading, copying, installing or using the software you agree to this license. - // If you do not agree to this license, do not download, install, - // copy or use the software. - // - // - // License Agreement - // For Open Source Computer Vision Library - // - // Copyright (C) 2014, OpenCV Foundation, all rights reserved. - // Third party copyrights are property of their respective owners. - // - // Redistribution and use in source and binary forms, with or without modification, - // are permitted provided that the following conditions are met: - // - // * Redistribution's of source code must retain the above copyright notice, - // this list of conditions and the following disclaimer. - // - // * Redistribution's in binary form must reproduce the above copyright notice, - // this list of conditions and the following disclaimer in the documentation - // and/or other materials provided with the distribution. - // - // * The name of the copyright holders may not be used to endorse or promote products - // derived from this software without specific prior written permission. - // - // This software is provided by the copyright holders and contributors "as is" and - // any express or implied warranties, including, but not limited to, the implied - // warranties of merchantability and fitness for a particular purpose are disclaimed. - // In no event shall the Intel Corporation or contributors be liable for any direct, - // indirect, incidental, special, exemplary, or consequential damages - // (including, but not limited to, procurement of substitute goods or services; - // loss of use, data, or profits; or business interruption) however caused - // and on any theory of liability, whether in contract, strict liability, - // or tort (including negligence or otherwise) arising in any way out of - // the use of this software, even if advised of the possibility of such damage. - // - //M*/ - -#include "perf_precomp.hpp" - -//write sanity: ./bin/opencv_perf_saliency --perf_write_sanity=true -//verify sanity: ./bin/opencv_perf_saliency - -using namespace std; -using namespace cv; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; - -typedef perf::TestBaseWithParam sal; - -#define STATIC_IMAGES \ - "cv/saliency/static_saliency/8.jpg",\ - "cv/saliency/static_saliency/39.jpg" ,\ - "cv/saliency/static_saliency/41.jpg" ,\ - "cv/saliency/static_saliency/62.jpg" - -PERF_TEST_P(sal, statiSaliencySpectralResidual, testing::Values(STATIC_IMAGES)) -{ - string filename = getDataPath(GetParam()); - Mat image = imread(filename); - Mat saliencyMap; - - if (image.empty()) - FAIL() << "Unable to load source image " << filename; - - Ptr saliencyAlgorithm = saliency::Saliency::create( "SPECTRAL_RESIDUAL" ); - - TEST_CYCLE_N(1) - { - - if( saliencyAlgorithm->computeSaliency( image, saliencyMap ) ) - { - - } - else - { - FAIL()<< "***Error in the instantiation of the saliency algorithm...***\n" << endl; - return; - } - } //end CYCLE - - SANITY_CHECK(saliencyMap); -} diff --git a/modules/saliency/src/motionSaliencyBinWangApr2014.cpp b/modules/saliency/src/motionSaliencyBinWangApr2014.cpp index d6fef1bd7..4e9348373 100644 --- a/modules/saliency/src/motionSaliencyBinWangApr2014.cpp +++ b/modules/saliency/src/motionSaliencyBinWangApr2014.cpp @@ -623,6 +623,8 @@ bool MotionSaliencyBinWangApr2014::decisionThresholdAdaptation() bool MotionSaliencyBinWangApr2014::computeSaliencyImpl( InputArray image, OutputArray saliencyMap ) { + CV_Assert(image.channels() == 1); + Mat highResBFMask, u_highResBFMask; Mat lowResBFMask, u_lowResBFMask; Mat not_lowResBFMask;