From 764f39e3d64da8a5002b220e1f9044f15e68a613 Mon Sep 17 00:00:00 2001 From: Isabella Gottardi Date: Thu, 9 Nov 2017 11:27:14 +0000 Subject: COMPMID-556 - Fix Warp Perspective validation Change-Id: I6504fb1e2d3d2b454a043d7157112891cef272a3 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/95045 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- tests/validation/CL/WarpPerspective.cpp | 10 ++-------- tests/validation/NEON/WarpPerspective.cpp | 10 ++-------- tests/validation/fixtures/WarpPerspectiveFixture.h | 14 ++++++++------ 3 files changed, 12 insertions(+), 22 deletions(-) (limited to 'tests/validation') diff --git a/tests/validation/CL/WarpPerspective.cpp b/tests/validation/CL/WarpPerspective.cpp index 2edf9119d6..a868e16b9e 100644 --- a/tests/validation/CL/WarpPerspective.cpp +++ b/tests/validation/CL/WarpPerspective.cpp @@ -105,20 +105,14 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLWarpPerspectiveFixture, framework::D framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), datasets::BorderModes())) { - // Create the valid mask Tensor - RawTensor valid_mask(_reference.shape(), _reference.data_type()); - - validate(CLAccessor(_target), _reference, valid_mask, tolerance_value, tolerance_number); + validate(CLAccessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); } FIXTURE_DATA_TEST_CASE(RunLarge, CLWarpPerspectiveFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::U8)), framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), datasets::BorderModes())) { - // Create the valid mask Tensor - RawTensor valid_mask{ _reference.shape(), _reference.data_type() }; - - validate(CLAccessor(_target), _reference, valid_mask, tolerance_value, tolerance_number); + validate(CLAccessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); } TEST_SUITE_END() diff --git a/tests/validation/NEON/WarpPerspective.cpp b/tests/validation/NEON/WarpPerspective.cpp index 45d3a0b878..804c080890 100644 --- a/tests/validation/NEON/WarpPerspective.cpp +++ b/tests/validation/NEON/WarpPerspective.cpp @@ -106,20 +106,14 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NEWarpPerspectiveFixture, framework::D framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), datasets::BorderModes())) { - // Create the valid mask Tensor - RawTensor valid_mask(_reference.shape(), _reference.data_type()); - - validate(Accessor(_target), _reference, valid_mask, tolerance_value, tolerance_number); + validate(Accessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); } FIXTURE_DATA_TEST_CASE(RunLarge, NEWarpPerspectiveFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::U8)), framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })), datasets::BorderModes())) { - // Create the valid mask Tensor - RawTensor valid_mask{ _reference.shape(), _reference.data_type() }; - - validate(Accessor(_target), _reference, valid_mask, tolerance_value, tolerance_number); + validate(Accessor(_target), _reference, _valid_mask, tolerance_value, tolerance_number); } TEST_SUITE_END() diff --git a/tests/validation/fixtures/WarpPerspectiveFixture.h b/tests/validation/fixtures/WarpPerspectiveFixture.h index c77efbdc0d..1a6d6c035e 100644 --- a/tests/validation/fixtures/WarpPerspectiveFixture.h +++ b/tests/validation/fixtures/WarpPerspectiveFixture.h @@ -70,9 +70,9 @@ public: protected: template - void fill(U &&tensor, int i = 0) + void fill(U &&tensor) { - library->fill_tensor_uniform(tensor, i); + library->fill_tensor_uniform(tensor, 0); } TensorType compute_target(const TensorShape &shape, const TensorShape &vmask_shape, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value, @@ -112,19 +112,21 @@ protected: // Create reference SimpleTensor src{ shape, data_type }; - SimpleTensor valid_mask{ vmask_shape, data_type }; + + // Create the valid mask Tensor + _valid_mask = SimpleTensor(shape, data_type); // Fill reference - fill(src, 0); - fill(valid_mask, 1); + fill(src); // Compute reference - return reference::warp_perspective(src, valid_mask, matrix, policy, border_mode, constant_border_value); + return reference::warp_perspective(src, _valid_mask, matrix, policy, border_mode, constant_border_value); } TensorType _target{}; SimpleTensor _reference{}; BorderMode _border_mode{}; + SimpleTensor _valid_mask{}; }; } // namespace validation } // namespace test -- cgit v1.2.1