Revise PriorBox op (#6363)
* Use ngraph rtti macros * Check attribute count in visitor test case * Add priorBox class for SLT * Add priorBox SSLT * Add CPU SLT * moved type_prop tests to type_prop directory * Add backend tests * Add PriorBox to trusted ops list * infer first dimension of size 2
This commit is contained in:
parent
07b0b4ea83
commit
b231b2b576
@ -0,0 +1,98 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "shared_test_classes/single_layer/prior_box.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestDefinitions;
|
||||
|
||||
namespace {
|
||||
TEST_P(PriorBoxLayerTest, Serialize) {
|
||||
Serialize();
|
||||
}
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U16
|
||||
};
|
||||
const std::vector<std::vector<float>> min_sizes = {
|
||||
{16.f, 32.f}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> max_sizes = {
|
||||
{256.f, 512.f}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> aspect_ratios = {
|
||||
{0.66f, 1.56f}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> densities = {
|
||||
{0.55f}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> fixed_ratios = {
|
||||
{0.88f}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> fixed_sizes = {
|
||||
{1.25f}
|
||||
};
|
||||
|
||||
const std::vector<bool> clips = {
|
||||
true, false
|
||||
};
|
||||
|
||||
const std::vector<bool> flips = {
|
||||
true, false
|
||||
};
|
||||
|
||||
const std::vector<float> steps = {
|
||||
1.0f, 2.0f
|
||||
};
|
||||
|
||||
const std::vector<float> offsets = {
|
||||
0.0f, 0.5f
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> variances = {
|
||||
{2.22f, 3.14f}
|
||||
};
|
||||
|
||||
const std::vector<bool> scale_all_sizes = {
|
||||
true, false
|
||||
};
|
||||
|
||||
const std::vector<size_t> inputShape = {128, 128};
|
||||
const std::vector<size_t> imageShape = {50, 50};
|
||||
|
||||
const auto layerSpecificParams = ::testing::Combine(
|
||||
::testing::ValuesIn(min_sizes),
|
||||
::testing::ValuesIn(max_sizes),
|
||||
::testing::ValuesIn(aspect_ratios),
|
||||
::testing::ValuesIn(densities),
|
||||
::testing::ValuesIn(fixed_ratios),
|
||||
::testing::ValuesIn(fixed_sizes),
|
||||
::testing::ValuesIn(clips),
|
||||
::testing::ValuesIn(flips),
|
||||
::testing::ValuesIn(steps),
|
||||
::testing::ValuesIn(offsets),
|
||||
::testing::ValuesIn(variances),
|
||||
::testing::ValuesIn(scale_all_sizes));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_Basic, PriorBoxLayerTest,
|
||||
::testing::Combine(
|
||||
layerSpecificParams,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(inputShape),
|
||||
::testing::Values(imageShape),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
PriorBoxLayerTest::getTestCaseName);
|
||||
} // namespace
|
@ -0,0 +1,81 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/prior_box.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestDefinitions;
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U16};
|
||||
const std::vector<std::vector<float>> min_sizes = {
|
||||
{256.0f}};
|
||||
|
||||
const std::vector<std::vector<float>> max_sizes = {
|
||||
{315.0f}};
|
||||
|
||||
const std::vector<std::vector<float>> aspect_ratios = {
|
||||
{2.0f}};
|
||||
|
||||
const std::vector<std::vector<float>> densities = {
|
||||
{1.0f}};
|
||||
|
||||
const std::vector<std::vector<float>> fixed_ratios = {
|
||||
{}};
|
||||
|
||||
const std::vector<std::vector<float>> fixed_sizes = {
|
||||
{}};
|
||||
|
||||
const std::vector<bool> clips = {
|
||||
false, true};
|
||||
|
||||
const std::vector<bool> flips = {
|
||||
false, true};
|
||||
|
||||
const std::vector<float> steps = {
|
||||
1.0f,
|
||||
};
|
||||
|
||||
const std::vector<float> offsets = {
|
||||
0.0f,
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> variances = {
|
||||
{}};
|
||||
|
||||
const std::vector<bool> scale_all_sizes = {
|
||||
false, true};
|
||||
|
||||
const std::vector<size_t> inputShape = {300, 300};
|
||||
const std::vector<size_t> imageShape = {32, 32};
|
||||
|
||||
const auto layerSpecificParams = ::testing::Combine(
|
||||
::testing::ValuesIn(min_sizes),
|
||||
::testing::ValuesIn(max_sizes),
|
||||
::testing::ValuesIn(aspect_ratios),
|
||||
::testing::ValuesIn(densities),
|
||||
::testing::ValuesIn(fixed_ratios),
|
||||
::testing::ValuesIn(fixed_sizes),
|
||||
::testing::ValuesIn(clips),
|
||||
::testing::ValuesIn(flips),
|
||||
::testing::ValuesIn(steps),
|
||||
::testing::ValuesIn(offsets),
|
||||
::testing::ValuesIn(variances),
|
||||
::testing::ValuesIn(scale_all_sizes));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_Basic, PriorBoxLayerTest,
|
||||
::testing::Combine(
|
||||
layerSpecificParams,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(inputShape),
|
||||
::testing::Values(imageShape),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
PriorBoxLayerTest::getTestCaseName);
|
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_layer/prior_box.hpp"
|
||||
|
||||
namespace LayerTestDefinitions {
|
||||
|
||||
TEST_P(PriorBoxLayerTest, CompareWithRefs) {
|
||||
Run();
|
||||
}
|
||||
|
||||
} // namespace LayerTestDefinitions
|
@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <functional>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
#include "ie_core.hpp"
|
||||
#include "ie_precision.hpp"
|
||||
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
|
||||
#include "functional_test_utils/blob_utils.hpp"
|
||||
#include "shared_test_classes/base/layer_test_utils.hpp"
|
||||
#include "common_test_utils/common_utils.hpp"
|
||||
|
||||
#include "ngraph_functions/utils/ngraph_helpers.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
|
||||
namespace LayerTestDefinitions {
|
||||
using priorBoxSpecificParams = std::tuple<
|
||||
std::vector<float>, // min_size
|
||||
std::vector<float>, // max_size
|
||||
std::vector<float>, // aspect_ratio
|
||||
std::vector<float>, // density
|
||||
std::vector<float>, // fixed_ratio
|
||||
std::vector<float>, // fixed_size
|
||||
bool, // clip
|
||||
bool, // flip
|
||||
float, // step
|
||||
float, // offset
|
||||
std::vector<float>, // variance
|
||||
bool>; // scale_all_sizes
|
||||
|
||||
typedef std::tuple<
|
||||
priorBoxSpecificParams,
|
||||
InferenceEngine::Precision, // net precision
|
||||
InferenceEngine::Precision, // Input precision
|
||||
InferenceEngine::Precision, // Output precision
|
||||
InferenceEngine::Layout, // Input layout
|
||||
InferenceEngine::Layout, // Output layout
|
||||
InferenceEngine::SizeVector, // input shape
|
||||
InferenceEngine::SizeVector, // image shape
|
||||
std::string> priorBoxLayerParams;
|
||||
|
||||
class PriorBoxLayerTest
|
||||
: public testing::WithParamInterface<priorBoxLayerParams>,
|
||||
virtual public LayerTestsUtils::LayerTestsCommon {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<priorBoxLayerParams>& obj);
|
||||
protected:
|
||||
InferenceEngine::SizeVector inputShapes;
|
||||
InferenceEngine::SizeVector imageShapes;
|
||||
InferenceEngine::Precision netPrecision;
|
||||
std::vector<float> min_size;
|
||||
std::vector<float> max_size;
|
||||
std::vector<float> aspect_ratio;
|
||||
std::vector<float> density;
|
||||
std::vector<float> fixed_ratio;
|
||||
std::vector<float> fixed_size;
|
||||
std::vector<float> variance;
|
||||
float step;
|
||||
float offset;
|
||||
bool clip;
|
||||
bool flip;
|
||||
bool scale_all_sizes;
|
||||
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
} // namespace LayerTestDefinitions
|
@ -0,0 +1,91 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_layer/prior_box.hpp"
|
||||
|
||||
namespace LayerTestDefinitions {
|
||||
std::string PriorBoxLayerTest::getTestCaseName(const testing::TestParamInfo<priorBoxLayerParams>& obj) {
|
||||
InferenceEngine::Precision netPrecision;
|
||||
InferenceEngine::Precision inPrc, outPrc;
|
||||
InferenceEngine::Layout inLayout, outLayout;
|
||||
InferenceEngine::SizeVector inputShapes, imageShapes;
|
||||
std::string targetDevice;
|
||||
priorBoxSpecificParams specParams;
|
||||
std::tie(specParams,
|
||||
netPrecision,
|
||||
inPrc, outPrc, inLayout, outLayout,
|
||||
inputShapes,
|
||||
imageShapes,
|
||||
targetDevice) = obj.param;
|
||||
|
||||
std::vector<float> min_size, max_size, aspect_ratio, density, fixed_ratio, fixed_size, variance;
|
||||
float step, offset;
|
||||
bool clip, flip, scale_all_sizes;
|
||||
std::tie(min_size, max_size, aspect_ratio,
|
||||
density, fixed_ratio, fixed_size, clip,
|
||||
flip, step, offset, variance, scale_all_sizes) = specParams;
|
||||
|
||||
std::ostringstream result;
|
||||
const char separator = '_';
|
||||
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << separator;
|
||||
result << "imageS=" << CommonTestUtils::vec2str(imageShapes) << separator;
|
||||
result << "netPRC=" << netPrecision.name() << separator;
|
||||
result << "inPRC=" << inPrc.name() << separator;
|
||||
result << "outPRC=" << outPrc.name() << separator;
|
||||
result << "inL=" << inLayout << separator;
|
||||
result << "outL=" << outLayout << separator;
|
||||
result << "min_s=" << CommonTestUtils::vec2str(min_size) << separator;
|
||||
result << "max_s=" << CommonTestUtils::vec2str(max_size)<< separator;
|
||||
result << "asp_r=" << CommonTestUtils::vec2str(aspect_ratio)<< separator;
|
||||
result << "dens=" << CommonTestUtils::vec2str(density)<< separator;
|
||||
result << "fix_r=" << CommonTestUtils::vec2str(fixed_ratio)<< separator;
|
||||
result << "fix_s=" << CommonTestUtils::vec2str(fixed_size)<< separator;
|
||||
result << "var=" << CommonTestUtils::vec2str(variance)<< separator;
|
||||
result << "step=" << step << separator;
|
||||
result << "off=" << offset << separator;
|
||||
result << "clip=" << clip << separator;
|
||||
result << "flip=" << flip<< separator;
|
||||
result << "scale_all=" << scale_all_sizes << separator;
|
||||
result << "trgDev=" << targetDevice;
|
||||
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void PriorBoxLayerTest::SetUp() {
|
||||
priorBoxSpecificParams specParams;
|
||||
std::tie(specParams, netPrecision,
|
||||
inPrc, outPrc, inLayout, outLayout,
|
||||
inputShapes, imageShapes, targetDevice) = GetParam();
|
||||
|
||||
std::tie(min_size, max_size, aspect_ratio,
|
||||
density, fixed_ratio, fixed_size, clip,
|
||||
flip, step, offset, variance, scale_all_sizes) = specParams;
|
||||
|
||||
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
||||
auto params = ngraph::builder::makeParams(ngPrc, {inputShapes, imageShapes});
|
||||
|
||||
ngraph::op::PriorBoxAttrs attributes;
|
||||
attributes.min_size = min_size;
|
||||
attributes.max_size = max_size;
|
||||
attributes.aspect_ratio = aspect_ratio;
|
||||
attributes.density = density;
|
||||
attributes.fixed_ratio = fixed_ratio;
|
||||
attributes.fixed_size = fixed_size;
|
||||
attributes.variance = variance;
|
||||
attributes.step = step;
|
||||
attributes.offset = offset;
|
||||
attributes.clip = clip;
|
||||
attributes.flip = flip;
|
||||
|
||||
auto shape_of_1 = std::make_shared<ngraph::opset3::ShapeOf>(params[0]);
|
||||
auto shape_of_2 = std::make_shared<ngraph::opset3::ShapeOf>(params[1]);
|
||||
auto priorBox = std::make_shared<ngraph::op::PriorBox>(
|
||||
shape_of_1,
|
||||
shape_of_2,
|
||||
attributes);
|
||||
|
||||
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(priorBox)};
|
||||
function = std::make_shared <ngraph::Function>(results, params, "PriorBoxFunction");
|
||||
}
|
||||
} // namespace LayerTestDefinitions
|
@ -60,9 +60,10 @@ VERIFIED_OP_REFERENCES = [
|
||||
'NonMaxSuppression-4',
|
||||
'NonMaxSuppression-5',
|
||||
'NonZero-3',
|
||||
'PSROIPooling-1',
|
||||
'PriorBox-1',
|
||||
'Proposal-1',
|
||||
'Proposal-4',
|
||||
'PSROIPooling-1',
|
||||
'RNNSequence-5',
|
||||
'ROIAlign-3',
|
||||
'ROIPooling-2',
|
||||
|
@ -14,7 +14,7 @@
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
NGRAPH_RTTI_DEFINITION(op::PriorBox, "PriorBox", 0);
|
||||
NGRAPH_RTTI_DEFINITION(op::v0::PriorBox, "PriorBox", 0);
|
||||
|
||||
op::PriorBox::PriorBox(const Output<Node>& layer_shape,
|
||||
const Output<Node>& image_shape,
|
||||
@ -69,7 +69,7 @@ void op::PriorBox::validate_and_infer_types()
|
||||
}
|
||||
else
|
||||
{
|
||||
set_output_type(0, element::f32, PartialShape::dynamic());
|
||||
set_output_type(0, element::f32, PartialShape{2, Dimension::dynamic()});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,6 +171,7 @@ set(SRC
|
||||
type_prop/parameter.cpp
|
||||
type_prop/power.cpp
|
||||
type_prop/prelu.cpp
|
||||
type_prop/prior_box.cpp
|
||||
type_prop/proposal.cpp
|
||||
type_prop/psroi_pooling.cpp
|
||||
type_prop/range.cpp
|
||||
@ -445,6 +446,7 @@ set(MULTI_TEST_SRC
|
||||
backend/parameter_as_output.in.cpp
|
||||
backend/power.in.cpp
|
||||
backend/prelu.in.cpp
|
||||
backend/prior_box.in.cpp
|
||||
backend/proposal.in.cpp
|
||||
backend/psroi_pooling.in.cpp
|
||||
backend/range.in.cpp
|
||||
|
47
ngraph/test/backend/prior_box.in.cpp
Normal file
47
ngraph/test/backend/prior_box.in.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/prior_box.hpp"
|
||||
|
||||
#include "util/engine/test_engines.hpp"
|
||||
#include "util/test_case.hpp"
|
||||
#include "util/test_control.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
static string s_manifest = "${MANIFEST}";
|
||||
using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME});
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, prior_box)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {2.0f};
|
||||
attrs.aspect_ratio = {1.5f};
|
||||
attrs.scale_all_sizes = false;
|
||||
|
||||
Shape layer_shape_shape{2};
|
||||
Shape image_shape_shape{2};
|
||||
vector<int64_t> layer_shape{2, 2};
|
||||
vector<int64_t> image_shape{10, 10};
|
||||
|
||||
auto LS = op::Constant::create(element::i64, layer_shape_shape, layer_shape);
|
||||
auto IS = op::Constant::create(element::i64, image_shape_shape, image_shape);
|
||||
auto f = make_shared<Function>(make_shared<op::PriorBox>(LS, IS, attrs), ParameterVector{});
|
||||
const auto exp_shape = Shape{2, 32};
|
||||
vector<float> out{-0.75, -0.75, 1.25, 1.25, -0.974745, -0.566497, 1.47474, 1.0665,
|
||||
-0.25, -0.75, 1.75, 1.25, -0.474745, -0.566497, 1.97474, 1.0665,
|
||||
-0.75, -0.25, 1.25, 1.75, -0.974745, -0.0664966, 1.47474, 1.5665,
|
||||
-0.25, -0.25, 1.75, 1.75, -0.474745, -0.0664966, 1.97474, 1.5665,
|
||||
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
|
||||
|
||||
auto test_case = test::TestCase<TestEngine>(f);
|
||||
test_case.add_expected_output<float>(exp_shape, out);
|
||||
test_case.run_with_tolerance_as_fp(1.0e-5f);
|
||||
}
|
51
ngraph/test/type_prop/prior_box.cpp
Normal file
51
ngraph/test/type_prop/prior_box.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/prior_box.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
|
||||
TEST(type_prop, prior_box1)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {2.0f, 3.0f};
|
||||
attrs.aspect_ratio = {1.5f, 2.0f, 2.5f};
|
||||
attrs.scale_all_sizes = false;
|
||||
|
||||
auto layer_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {32, 32});
|
||||
auto image_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {300, 300});
|
||||
auto pb = std::make_shared<op::PriorBox>(layer_shape, image_shape, attrs);
|
||||
ASSERT_EQ(pb->get_shape(), (Shape{2, 20480}));
|
||||
}
|
||||
|
||||
TEST(type_prop, prior_box2)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {2.0f, 3.0f};
|
||||
attrs.aspect_ratio = {1.5f, 2.0f, 2.5f};
|
||||
attrs.flip = true;
|
||||
attrs.scale_all_sizes = false;
|
||||
|
||||
auto layer_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {32, 32});
|
||||
auto image_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {300, 300});
|
||||
auto pb = std::make_shared<op::PriorBox>(layer_shape, image_shape, attrs);
|
||||
ASSERT_EQ(pb->get_shape(), (Shape{2, 32768}));
|
||||
}
|
||||
|
||||
TEST(type_prop, prior_box3)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {256.0f};
|
||||
attrs.max_size = {315.0f};
|
||||
attrs.aspect_ratio = {2.0f};
|
||||
attrs.flip = true;
|
||||
|
||||
auto layer_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {1, 1});
|
||||
auto image_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {300, 300});
|
||||
auto pb = std::make_shared<op::PriorBox>(layer_shape, image_shape, attrs);
|
||||
ASSERT_EQ(pb->get_shape(), (Shape{2, 16}));
|
||||
}
|
@ -7,7 +7,6 @@
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/ctc_greedy_decoder.hpp"
|
||||
#include "ngraph/op/interpolate.hpp"
|
||||
#include "ngraph/op/prior_box.hpp"
|
||||
#include "ngraph/op/prior_box_clustered.hpp"
|
||||
#include "ngraph/op/region_yolo.hpp"
|
||||
#include "ngraph/op/reorg_yolo.hpp"
|
||||
@ -46,47 +45,6 @@ TEST(type_prop_layers, interpolate)
|
||||
.same_scheme(PartialShape{2, 2, Dimension::dynamic(), Dimension::dynamic()}));
|
||||
}
|
||||
|
||||
TEST(type_prop_layers, prior_box1)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {2.0f, 3.0f};
|
||||
attrs.aspect_ratio = {1.5f, 2.0f, 2.5f};
|
||||
attrs.scale_all_sizes = false;
|
||||
|
||||
auto layer_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {32, 32});
|
||||
auto image_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {300, 300});
|
||||
auto pb = make_shared<op::PriorBox>(layer_shape, image_shape, attrs);
|
||||
ASSERT_EQ(pb->get_shape(), (Shape{2, 20480}));
|
||||
}
|
||||
|
||||
TEST(type_prop_layers, prior_box2)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {2.0f, 3.0f};
|
||||
attrs.aspect_ratio = {1.5f, 2.0f, 2.5f};
|
||||
attrs.flip = true;
|
||||
attrs.scale_all_sizes = false;
|
||||
|
||||
auto layer_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {32, 32});
|
||||
auto image_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {300, 300});
|
||||
auto pb = make_shared<op::PriorBox>(layer_shape, image_shape, attrs);
|
||||
ASSERT_EQ(pb->get_shape(), (Shape{2, 32768}));
|
||||
}
|
||||
|
||||
TEST(type_prop_layers, prior_box3)
|
||||
{
|
||||
op::PriorBoxAttrs attrs;
|
||||
attrs.min_size = {256.0f};
|
||||
attrs.max_size = {315.0f};
|
||||
attrs.aspect_ratio = {2.0f};
|
||||
attrs.flip = true;
|
||||
|
||||
auto layer_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {1, 1});
|
||||
auto image_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {300, 300});
|
||||
auto pb = make_shared<op::PriorBox>(layer_shape, image_shape, attrs);
|
||||
ASSERT_EQ(pb->get_shape(), (Shape{2, 16}));
|
||||
}
|
||||
|
||||
TEST(type_prop_layers, prior_box_clustered)
|
||||
{
|
||||
op::PriorBoxClusteredAttrs attrs;
|
||||
|
@ -45,6 +45,8 @@ TEST(attributes, prior_box_op)
|
||||
const auto prior_box_attrs = prior_box->get_attrs();
|
||||
const auto g_prior_box_attrs = g_prior_box->get_attrs();
|
||||
|
||||
const auto expected_attr_count = 12;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
EXPECT_EQ(g_prior_box_attrs.min_size, prior_box_attrs.min_size);
|
||||
EXPECT_EQ(g_prior_box_attrs.max_size, prior_box_attrs.max_size);
|
||||
EXPECT_EQ(g_prior_box_attrs.aspect_ratio, prior_box_attrs.aspect_ratio);
|
||||
|
Loading…
Reference in New Issue
Block a user