Merge pull request #3699 from AleksandrPanov:mcc_add_perf_tests_improve_performance
Mcc add perf tests improve performance #3699 Added perf tests to mcc module. Also these optimizations have been added: - added `parallel_for_` to `performThreshold()` - removed `toL`/`fromL` and added `dst` to avoid copy data - added `parallel_for_` to `elementWise()` ("batch" optimization improves performance of Windows version, Linux without changes). Configuration: Ryzen 5950X, 2x16 GB 3000 MHz DDR4 OS: Windows 10, Ubuntu 20.04.5 LTS Performance results in milliseconds: | OS and alg version | process, ms | infer, ms | | -------------------- | ----- | ------ | | win_default | 63.09 | 457.57 | | win_optimized_without_batch | 48.69 | 111.78 | | win_optimized_batch | 48.42 | 47.28 | | linux_default | 50.88 | 300.7 | | linux_optimized_batch| 36.06 | 41.62 | ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] 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 CMakepull/3705/head
parent
5300337197
commit
5e592c2d96
9 changed files with 131 additions and 54 deletions
@ -0,0 +1,3 @@ |
||||
#include "perf_precomp.hpp" |
||||
|
||||
CV_PERF_TEST_MAIN(mcc) |
@ -0,0 +1,51 @@ |
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#include "perf_precomp.hpp" |
||||
|
||||
namespace opencv_test |
||||
{ |
||||
namespace |
||||
{ |
||||
|
||||
using namespace std; |
||||
|
||||
PERF_TEST(CV_mcc_perf, detect) { |
||||
string path = cvtest::findDataFile("cv/mcc/mcc_ccm_test.jpg"); |
||||
Mat img = imread(path, IMREAD_COLOR); |
||||
Ptr<CCheckerDetector> detector = CCheckerDetector::create(); |
||||
|
||||
// detect MCC24 board
|
||||
TEST_CYCLE() { |
||||
ASSERT_TRUE(detector->process(img, MCC24, 1, false)); |
||||
} |
||||
SANITY_CHECK_NOTHING(); |
||||
} |
||||
|
||||
PERF_TEST(CV_mcc_perf, infer) { |
||||
// read gold chartsRGB
|
||||
string path = cvtest::findDataFile("cv/mcc/mcc_ccm_test.yml"); |
||||
FileStorage fs(path, FileStorage::READ); |
||||
Mat chartsRGB; |
||||
FileNode node = fs["chartsRGB"]; |
||||
node >> chartsRGB; |
||||
fs.release(); |
||||
|
||||
// compute CCM
|
||||
ColorCorrectionModel model(chartsRGB.col(1).clone().reshape(3, chartsRGB.rows/3) / 255., COLORCHECKER_Macbeth); |
||||
model.run(); |
||||
|
||||
Mat img(1000, 4000, CV_8UC3); |
||||
randu(img, 0, 255); |
||||
img.convertTo(img, CV_64F, 1. / 255.); |
||||
|
||||
TEST_CYCLE() { |
||||
model.infer(img); |
||||
} |
||||
|
||||
SANITY_CHECK_NOTHING(); |
||||
} |
||||
|
||||
} // namespace
|
||||
} // namespace opencv_test
|
@ -0,0 +1,14 @@ |
||||
#ifndef __OPENCV_PERF_PRECOMP_HPP__ |
||||
#define __OPENCV_PERF_PRECOMP_HPP__ |
||||
|
||||
#include "opencv2/ts.hpp" |
||||
#include "opencv2/mcc.hpp" |
||||
|
||||
namespace opencv_test |
||||
{ |
||||
using namespace cv::mcc; |
||||
using namespace cv::ccm; |
||||
using namespace perf; |
||||
} |
||||
|
||||
#endif |
Loading…
Reference in new issue