blob: 634af416e2282f53260fc4fbf06fef317fd74d23 [file] [log] [blame]
John Richardson7f4a8192018-02-05 15:12:22 +00001/*
2 * Copyright (c) 2018 ARM Limited.
3 *
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/runtime/CL/CLMultiHOG.h"
25#include "arm_compute/runtime/CL/functions/CLHOGDescriptor.h"
26#include "arm_compute/runtime/CL/functions/CLHOGMultiDetection.h"
27#include "arm_compute/runtime/Tensor.h"
28#include "tests/CL/CLAccessor.h"
29#include "tests/CL/CLArrayAccessor.h"
30#include "tests/CL/CLHOGAccessor.h"
31#include "tests/datasets/HOGMultiDetectionDataset.h"
32#include "tests/framework/Macros.h"
33#include "tests/framework/datasets/Datasets.h"
34#include "tests/validation/Validation.h"
35#include "tests/validation/fixtures/HOGMultiDetectionFixture.h"
36
37namespace arm_compute
38{
39namespace test
40{
41namespace validation
42{
43namespace
44{
45/* Set the tolerance (percentage) used when validating the strength of detection window. */
46RelativeTolerance<float> tolerance(0.1f);
47} // namespace
48
49TEST_SUITE(CL)
50TEST_SUITE(HOGMultiDetection)
51
52// *INDENT-OFF*
53// clang-format off
54using CLHOGMultiDetectionFixture = HOGMultiDetectionValidationFixture<CLTensor,
55 CLHOG,
56 CLMultiHOG,
57 CLDetectionWindowArray,
58 CLSize2DArray,
59 CLAccessor,
60 CLArrayAccessor<Size2D>,
61 CLArrayAccessor<DetectionWindow>,
62 CLHOGAccessor,
63 CLHOGMultiDetection,
64 uint8_t,
65 float>;
66
67
68FIXTURE_DATA_TEST_CASE(RunSmall, CLHOGMultiDetectionFixture, framework::DatasetMode::PRECOMMIT,
69 combine(combine(combine(
70 datasets::SmallHOGMultiDetectionDataset(),
71 framework::dataset::make("Format", Format::U8)),
72 framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})),
73 framework::dataset::make("NonMaximaSuppression", {false, true})))
74{
75 // Validate output
76 validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance);
77}
78
79FIXTURE_DATA_TEST_CASE(RunLarge, CLHOGMultiDetectionFixture, framework::DatasetMode::NIGHTLY,
80 combine(combine(combine(
81 datasets::LargeHOGMultiDetectionDataset(),
82 framework::dataset::make("Format", Format::U8)),
83 framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})),
84 framework::dataset::make("NonMaximaSuppression", {false, true})))
85{
86 // Validate output
87 validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance);
88}
89
90// clang-format on
91// *INDENT-ON*
92
93TEST_SUITE_END()
94TEST_SUITE_END()
95} // namespace validation
96} // namespace test
97} // namespace arm_compute