Skip to content

Commit

Permalink
Add Ngraph reference test for region_yolo
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorDuplensky committed May 25, 2021
1 parent eb4886e commit 302d8ef
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ const std::vector<ngraph::Shape> inShapes_mxnet = {
{1, 75, 16, 16},
{1, 75, 13, 13},
{1, 75, 8, 8},
{1, 303, 7, 7},
{1, 303, 14, 14},
{1, 303, 28, 28},
};

Expand Down
30 changes: 30 additions & 0 deletions ngraph/test/backend/region_yolo.in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,33 @@ NGRAPH_TEST(${BACKEND_NAME}, region_yolo_v3_mxnet)
shape, TEST_FILES, "region_out_yolov3_mxnet.data");
test_case.run_with_tolerance_as_fp(1.0e-4f);
}

NGRAPH_TEST(${BACKEND_NAME}, region_yolo_v3_mxnet_2)
{
const size_t num = 3;
const size_t coords = 4;
const size_t classes = 20;
const size_t batch = 1;
const size_t channels = 303;
const size_t width = 28;
const size_t height = 28;
const std::vector<int64_t> mask{0, 1, 2};
const int axis = 1;
const int end_axis = 3;

Shape input_shape{batch, channels, height, width};
Shape output_shape{batch, (classes + coords + 1) * mask.size(), height, width};

const auto A = make_shared<op::Parameter>(element::f32, input_shape);
const auto R = make_shared<op::v0::RegionYolo>(A, coords, classes, num, false, mask, axis, end_axis);
const auto f = make_shared<Function>(R, ParameterVector{A});

EXPECT_EQ(R->get_output_shape(0), output_shape);

auto test_case = test::TestCase<TestEngine>(f);

test_case.add_input_from_file<float>(input_shape, TEST_FILES, "region_in_yolov3_mxnet_2.data");
test_case.add_expected_output_from_file<float>(
output_shape, TEST_FILES, "region_out_yolov3_mxnet_2.data");
test_case.run_with_tolerance_as_fp(1.0e-4f);
}
Binary file added ngraph/test/files/region_in_yolov3_mxnet_2.data
Binary file not shown.
Binary file added ngraph/test/files/region_out_yolov3_mxnet_2.data
Binary file not shown.

0 comments on commit 302d8ef

Please sign in to comment.