mirror of
https://github.com/opencv/opencv.git
synced 2024-12-16 02:19:12 +08:00
f9e9567870
features2d: reduce accuracy test avg memory consumption #25424
**Merge with contrib**: https://github.com/opencv/opencv_contrib/pull/3722
I've observed high memory consumption in the `opencv_test_features2d` (x86_64, Ubuntu 22.04, Debug):
![image](https://github.com/opencv/opencv/assets/3304494/419d65d9-d727-4d1e-bdec-dbde6681c188)
It's always more than 180 MiB with peak at 535 MiB
This was caused by pointers to the algorithm object instances stored in the tests parameters. I've replaced them with factory functions/lambdas with the following result:
![image](https://github.com/opencv/opencv/assets/3304494/bd4ff0ea-3db4-4ab8-8e6d-192a3826e99c)
Now peak is at 355 MiB and permanent consumption level is ~ 1-2 MiB
**Note:** current peak is caused by KAZE features allocating 8x image size utility buffers. Not sure if we can or should do anything about it: 66fb5021e9/modules/features2d/src/kaze/KAZEFeatures.cpp (L61-L68)
58 lines
2.4 KiB
C++
58 lines
2.4 KiB
C++
// 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 "test_precomp.hpp"
|
|
#include "test_invariance_utils.hpp"
|
|
|
|
#include "test_detectors_invariance.impl.hpp"
|
|
|
|
namespace opencv_test { namespace {
|
|
|
|
const static std::string IMAGE_TSUKUBA = "features2d/tsukuba.png";
|
|
const static std::string IMAGE_BIKES = "detectors_descriptors_evaluation/images_datasets/bikes/img1.png";
|
|
#define Value(...) Values(make_tuple(__VA_ARGS__))
|
|
|
|
/*
|
|
* Detector's rotation invariance check
|
|
*/
|
|
|
|
INSTANTIATE_TEST_CASE_P(SIFT, DetectorRotationInvariance,
|
|
Value(IMAGE_TSUKUBA, []() { return SIFT::create(); }, 0.45f, 0.70f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(BRISK, DetectorRotationInvariance,
|
|
Value(IMAGE_TSUKUBA, []() { return BRISK::create(); }, 0.45f, 0.76f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(ORB, DetectorRotationInvariance,
|
|
Value(IMAGE_TSUKUBA, []() { return ORB::create(); }, 0.5f, 0.76f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(AKAZE, DetectorRotationInvariance,
|
|
Value(IMAGE_TSUKUBA, []() { return AKAZE::create(); }, 0.5f, 0.71f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DetectorRotationInvariance,
|
|
Value(IMAGE_TSUKUBA, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.5f, 0.71f));
|
|
|
|
/*
|
|
* Detector's scale invariance check
|
|
*/
|
|
|
|
INSTANTIATE_TEST_CASE_P(SIFT, DetectorScaleInvariance,
|
|
Value(IMAGE_BIKES, []() { return SIFT::create(0, 3, 0.09); }, 0.60f, 0.98f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(BRISK, DetectorScaleInvariance,
|
|
Value(IMAGE_BIKES, []() { return BRISK::create(); }, 0.08f, 0.49f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(ORB, DetectorScaleInvariance,
|
|
Value(IMAGE_BIKES, []() { return ORB::create(); }, 0.08f, 0.49f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(KAZE, DetectorScaleInvariance,
|
|
Value(IMAGE_BIKES, []() { return KAZE::create(); }, 0.08f, 0.49f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(AKAZE, DetectorScaleInvariance,
|
|
Value(IMAGE_BIKES, []() { return AKAZE::create(); }, 0.08f, 0.49f));
|
|
|
|
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DetectorScaleInvariance,
|
|
Value(IMAGE_BIKES, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.08f, 0.49f));
|
|
|
|
}} // namespace
|