mirror of
https://github.com/opencv/opencv.git
synced 2025-07-20 19:17:36 +08:00
tests: add "bigdata" tests
This commit is contained in:
parent
6582afcdbb
commit
703f79b757
@ -522,33 +522,23 @@ protected:
|
|||||||
|
|
||||||
TEST(Core_InputOutput, misc) { CV_MiscIOTest test; test.safe_run(); }
|
TEST(Core_InputOutput, misc) { CV_MiscIOTest test; test.safe_run(); }
|
||||||
|
|
||||||
/*class CV_BigMatrixIOTest : public cvtest::BaseTest
|
#if 0 // 4+ GB of data, 40+ GB of estimated result size, it is very slow
|
||||||
|
BIGDATA_TEST(Core_InputOutput, huge)
|
||||||
{
|
{
|
||||||
public:
|
RNG& rng = theRNG();
|
||||||
CV_BigMatrixIOTest() {}
|
int N = 1000, M = 1200000;
|
||||||
~CV_BigMatrixIOTest() {}
|
std::cout << "Allocating..." << std::endl;
|
||||||
protected:
|
Mat mat(M, N, CV_32F);
|
||||||
void run(int)
|
std::cout << "Initializing..." << std::endl;
|
||||||
|
rng.fill(mat, RNG::UNIFORM, 0, 1);
|
||||||
|
std::cout << "Writing..." << std::endl;
|
||||||
{
|
{
|
||||||
try
|
FileStorage fs(cv::tempfile(".xml"), FileStorage::WRITE);
|
||||||
{
|
fs << "mat" << mat;
|
||||||
RNG& rng = theRNG();
|
fs.release();
|
||||||
int N = 1000, M = 1200000;
|
|
||||||
Mat mat(M, N, CV_32F);
|
|
||||||
rng.fill(mat, RNG::UNIFORM, 0, 1);
|
|
||||||
FileStorage fs(cv::tempfile(".xml"), FileStorage::WRITE);
|
|
||||||
fs << "mat" << mat;
|
|
||||||
fs.release();
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
#endif
|
||||||
TEST(Core_InputOutput, huge) { CV_BigMatrixIOTest test; test.safe_run(); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
TEST(Core_globbing, accuracy)
|
TEST(Core_globbing, accuracy)
|
||||||
{
|
{
|
||||||
|
@ -1776,4 +1776,26 @@ TEST(Mat_, template_based_ptr)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
BIGDATA_TEST(Mat, push_back_regression_4158) // memory usage: ~10.6 Gb
|
||||||
|
{
|
||||||
|
Mat result;
|
||||||
|
|
||||||
|
Mat tail(100, 500000, CV_32FC2, Scalar(1, 2));
|
||||||
|
|
||||||
|
tail.copyTo(result);
|
||||||
|
for (int i = 1; i < 15; i++)
|
||||||
|
{
|
||||||
|
result.push_back(tail);
|
||||||
|
std::cout << "i = " << i << " result = " << result.size() << " used = " << (uint64)result.total()*result.elemSize()*(1.0 / (1 << 20)) << " Mb"
|
||||||
|
<< " allocated=" << (uint64)(result.datalimit - result.datastart)*(1.0 / (1 << 20)) << " Mb" << std::endl;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
Rect roi(0, tail.rows * i, tail.cols, tail.rows);
|
||||||
|
int nz = countNonZero(result(roi).reshape(1) == 2);
|
||||||
|
EXPECT_EQ(tail.total(), (size_t)nz) << "i=" << i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
@ -420,34 +420,18 @@ void CV_ThreshTest::prepare_to_validation( int /*test_case_idx*/ )
|
|||||||
|
|
||||||
TEST(Imgproc_Threshold, accuracy) { CV_ThreshTest test; test.safe_run(); }
|
TEST(Imgproc_Threshold, accuracy) { CV_ThreshTest test; test.safe_run(); }
|
||||||
|
|
||||||
#if defined(_M_X64) || defined(__x86_64__)
|
BIGDATA_TEST(Imgproc_Threshold, huge)
|
||||||
TEST(Imgproc_Threshold, huge) /* since the test needs a lot of memory, enable it only on 64-bit Intel/AMD platforms, otherwise it may take a lot of time because of heavy swapping */
|
|
||||||
#else
|
|
||||||
TEST(DISABLED_Imgproc_Threshold, huge)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Mat m;
|
Mat m(65000, 40000, CV_8U);
|
||||||
try
|
ASSERT_FALSE(m.isContinuous());
|
||||||
{
|
|
||||||
m.create(65000, 40000, CV_8U);
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !m.empty() )
|
uint64 i, n = (uint64)m.rows*m.cols;
|
||||||
{
|
for( i = 0; i < n; i++ )
|
||||||
ASSERT_FALSE(m.isContinuous());
|
m.data[i] = (uchar)(i & 255);
|
||||||
|
|
||||||
uint64 i, n = (uint64)m.rows*m.cols;
|
cv::threshold(m, m, 127, 255, cv::THRESH_BINARY);
|
||||||
for( i = 0; i < n; i++ )
|
int nz = cv::countNonZero(m); // FIXIT 'int' is not enough here (overflow is possible with other inputs)
|
||||||
m.data[i] = (uchar)(i & 255);
|
ASSERT_EQ((uint64)nz, n / 2);
|
||||||
|
|
||||||
cv::threshold(m, m, 127, 255, cv::THRESH_BINARY);
|
|
||||||
int nz = cv::countNonZero(m);
|
|
||||||
ASSERT_EQ(nz, (int)(n/2));
|
|
||||||
}
|
|
||||||
// just skip the test if there is no enough memory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user