blob: 157102f2682686baa3147ad32d8fee51be722b0d [file] [log] [blame]
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +01001/*
Michalis Spyroud175ece2020-07-30 23:39:32 +01002 * Copyright (c) 2017-2020 Arm Limited.
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/core/Types.h"
25#include "arm_compute/runtime/CL/CLArray.h"
26#include "arm_compute/runtime/CL/CLTensor.h"
27#include "arm_compute/runtime/CL/CLTensorAllocator.h"
28#include "arm_compute/runtime/CL/functions/CLHarrisCorners.h"
29#include "tests/CL/CLAccessor.h"
30#include "tests/CL/CLArrayAccessor.h"
31#include "tests/PaddingCalculator.h"
32#include "tests/datasets/BorderModeDataset.h"
Alex Gilday345ab182018-01-09 11:40:19 +000033#include "tests/datasets/ImageFileDatasets.h"
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +010034#include "tests/datasets/ShapeDatasets.h"
35#include "tests/framework/Asserts.h"
36#include "tests/framework/Macros.h"
37#include "tests/framework/datasets/Datasets.h"
38#include "tests/validation/Validation.h"
39#include "tests/validation/fixtures/HarrisCornersFixture.h"
40
41namespace arm_compute
42{
43namespace test
44{
45namespace validation
46{
47namespace
48{
Michalis Spyrou80943252019-01-10 17:19:50 +000049const auto data_nightly = combine(framework::dataset::make("GradientSize", { 3, 5, 7 }), combine(framework::dataset::make("BlockSize", { 3, 5, 7 }), datasets::BorderModes()));
50const auto data_precommit = combine(framework::dataset::make("GradientSize", { 3 }), combine(framework::dataset::make("BlockSize", { 3 }), datasets::BorderModes()));
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +010051} // namespace
52
53TEST_SUITE(CL)
54TEST_SUITE(HarrisCorners)
55
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +010056template <typename T>
57using CLHarrisCornersFixture = HarrisCornersValidationFixture<CLTensor, CLAccessor, CLKeyPointArray, CLHarrisCorners, T>;
58
Michalis Spyroucac09dc2020-11-24 00:16:49 +000059FIXTURE_DATA_TEST_CASE(RunSmall, CLHarrisCornersFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallImageFiles(), data_precommit), framework::dataset::make("Format",
60 Format::U8)))
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +010061{
62 // Validate output
63 CLArrayAccessor<KeyPoint> array(_target);
64 validate_keypoints(array.buffer(), array.buffer() + array.num_values(), _reference.begin(), _reference.end(), RelativeTolerance<float>(0.0001f));
65}
66
Michalis Spyrou80943252019-01-10 17:19:50 +000067FIXTURE_DATA_TEST_CASE(RunLarge, CLHarrisCornersFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageFiles(), data_nightly), framework::dataset::make("Format",
68 Format::U8)))
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +010069{
70 // Validate output
71 CLArrayAccessor<KeyPoint> array(_target);
72 validate_keypoints(array.buffer(), array.buffer() + array.num_values(), _reference.begin(), _reference.end(), RelativeTolerance<float>(0.0001f));
73}
74
75TEST_SUITE_END()
76TEST_SUITE_END()
77} // namespace validation
78} // namespace test
79} // namespace arm_compute