John Richardson | 7f4a819 | 2018-02-05 15:12:22 +0000 | [diff] [blame] | 1 | /* |
| 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/MultiHOG.h" |
| 25 | #include "arm_compute/runtime/NEON/functions/NEHOGDescriptor.h" |
| 26 | #include "arm_compute/runtime/NEON/functions/NEHOGMultiDetection.h" |
| 27 | #include "arm_compute/runtime/Tensor.h" |
| 28 | #include "tests/NEON/Accessor.h" |
| 29 | #include "tests/NEON/ArrayAccessor.h" |
| 30 | #include "tests/NEON/HOGAccessor.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 | |
| 37 | namespace arm_compute |
| 38 | { |
| 39 | namespace test |
| 40 | { |
| 41 | namespace validation |
| 42 | { |
| 43 | namespace |
| 44 | { |
| 45 | /* Set the tolerance (percentage) used when validating the strength of detection window. */ |
| 46 | RelativeTolerance<float> tolerance(1.0f); |
| 47 | } // namespace |
| 48 | |
| 49 | TEST_SUITE(NEON) |
| 50 | TEST_SUITE(HOGMultiDetection) |
| 51 | |
| 52 | // *INDENT-OFF* |
| 53 | // clang-format off |
| 54 | using NEHOGMultiDetectionFixture = HOGMultiDetectionValidationFixture<Tensor, |
| 55 | HOG, |
| 56 | MultiHOG, |
| 57 | DetectionWindowArray, |
| 58 | Size2DArray, |
| 59 | Accessor, |
| 60 | ArrayAccessor<Size2D>, |
| 61 | ArrayAccessor<DetectionWindow>, |
| 62 | HOGAccessor, |
| 63 | NEHOGMultiDetection, |
| 64 | uint8_t, |
| 65 | float>; |
| 66 | |
| 67 | FIXTURE_DATA_TEST_CASE(RunSmall, NEHOGMultiDetectionFixture, framework::DatasetMode::PRECOMMIT, |
| 68 | combine(combine(combine( |
| 69 | datasets::SmallHOGMultiDetectionDataset(), |
| 70 | framework::dataset::make("Format", Format::U8)), |
| 71 | framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})), |
| 72 | framework::dataset::make("NonMaximaSuppression", {false, true}))) |
| 73 | { |
| 74 | // Validate output |
| 75 | validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance); |
| 76 | } |
| 77 | |
| 78 | FIXTURE_DATA_TEST_CASE(RunLarge, NEHOGMultiDetectionFixture, framework::DatasetMode::NIGHTLY, |
| 79 | combine(combine(combine( |
| 80 | datasets::LargeHOGMultiDetectionDataset(), |
| 81 | framework::dataset::make("Format", Format::U8)), |
| 82 | framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})), |
| 83 | framework::dataset::make("NonMaximaSuppression", {false, true}))) |
| 84 | { |
| 85 | // Validate output |
| 86 | validate_detection_windows(_target.begin(), _target.end(), _reference.begin(), _reference.end(), tolerance); |
| 87 | } |
| 88 | |
| 89 | // clang-format on |
| 90 | // *INDENT-ON* |
| 91 | |
| 92 | TEST_SUITE_END() |
| 93 | TEST_SUITE_END() |
| 94 | } // namespace validation |
| 95 | } // namespace test |
| 96 | } // namespace arm_compute |