* Revert "Fix experimental detectron do ref impl (#10621)"
This reverts commit d87233863d.
* Disabled Experimental Detectron per agreement with GPU team. Ticket to fix it: 90209
This commit is contained in:
committed by
GitHub
parent
dcc8f926e1
commit
af16ea1d79
@@ -2112,11 +2112,11 @@ bool evaluate(const shared_ptr<op::v6::ExperimentalDetectronDetectionOutput>& op
|
||||
const HostTensorVector& outputs,
|
||||
const HostTensorVector& inputs) {
|
||||
const auto attrs = op->get_attrs();
|
||||
const size_t output_roi_count = attrs.max_detections_per_image;
|
||||
size_t rois_num = attrs.max_detections_per_image;
|
||||
|
||||
const Shape output_boxes_shape = Shape{output_roi_count, 4};
|
||||
const Shape output_classes_shape = Shape{output_roi_count};
|
||||
const Shape output_scores_shape = Shape{output_roi_count};
|
||||
const Shape output_boxes_shape = Shape{rois_num, 4};
|
||||
const Shape output_classes_shape = Shape{rois_num};
|
||||
const Shape output_scores_shape = Shape{rois_num};
|
||||
|
||||
const auto output_type = op->get_input_element_type(0);
|
||||
|
||||
@@ -2124,7 +2124,6 @@ bool evaluate(const shared_ptr<op::v6::ExperimentalDetectronDetectionOutput>& op
|
||||
const auto input_deltas_data = get_floats(inputs[1], inputs[1]->get_shape());
|
||||
const auto input_scores_data = get_floats(inputs[2], inputs[2]->get_shape());
|
||||
const auto input_im_info_data = get_floats(inputs[3], inputs[3]->get_shape());
|
||||
const auto input_roi_count = inputs[0]->get_shape()[0];
|
||||
|
||||
std::vector<float> output_boxes(shape_size(output_boxes_shape));
|
||||
std::vector<int32_t> output_classes(shape_size(output_classes_shape));
|
||||
@@ -2141,7 +2140,6 @@ bool evaluate(const shared_ptr<op::v6::ExperimentalDetectronDetectionOutput>& op
|
||||
input_deltas_data.data(),
|
||||
input_scores_data.data(),
|
||||
input_im_info_data.data(),
|
||||
input_roi_count,
|
||||
attrs,
|
||||
output_boxes.data(),
|
||||
output_scores.data(),
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/experimental_detectron_detection_output.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/experimental_detectron_detection_output.hpp"
|
||||
#include "base_reference_test.hpp"
|
||||
|
||||
using namespace reference_tests;
|
||||
@@ -19,13 +18,9 @@ struct ExperimentalDOParams {
|
||||
ExperimentalDOParams(const Attrs& attrs,
|
||||
const size_t num_rois,
|
||||
const element::Type& iType,
|
||||
const std::vector<IT>& roisValues,
|
||||
const std::vector<IT>& deltasValues,
|
||||
const std::vector<IT>& scoresValues,
|
||||
const std::vector<IT>& imageSizeInfoValues,
|
||||
const std::vector<IT>& refBoxesValues,
|
||||
const std::vector<int32_t>& refClassesValues,
|
||||
const std::vector<IT>& refScoresValues,
|
||||
const std::vector<IT>& roisValues, const std::vector<IT>& deltasValues,
|
||||
const std::vector<IT>& scoresValues, const std::vector<IT>& imageSizeInfoValues,
|
||||
const std::vector<IT>& refBoxesValues, const std::vector<int32_t>& refClassesValues, const std::vector<IT>& refScoresValues,
|
||||
const std::string& testcaseName = "")
|
||||
: attrs(attrs),
|
||||
inType(iType),
|
||||
@@ -38,11 +33,11 @@ struct ExperimentalDOParams {
|
||||
refClassesData(CreateTensor(ov::element::i32, refClassesValues)),
|
||||
refScoresData(CreateTensor(iType, refScoresValues)),
|
||||
testcaseName(testcaseName) {
|
||||
roisShape = Shape{num_rois, 4};
|
||||
deltasShape = Shape{num_rois, static_cast<size_t>(attrs.num_classes * 4)};
|
||||
scoresShape = Shape{num_rois, static_cast<size_t>(attrs.num_classes)};
|
||||
imageSizeInfoShape = Shape{1, 3};
|
||||
}
|
||||
roisShape = Shape{num_rois, 4};
|
||||
deltasShape = Shape{num_rois, static_cast<size_t>(attrs.num_classes * 4)};
|
||||
scoresShape = Shape{num_rois, static_cast<size_t>(attrs.num_classes)};
|
||||
imageSizeInfoShape = Shape{1, 3};
|
||||
}
|
||||
|
||||
Attrs attrs;
|
||||
PartialShape roisShape;
|
||||
@@ -61,8 +56,7 @@ struct ExperimentalDOParams {
|
||||
std::string testcaseName;
|
||||
};
|
||||
|
||||
class ReferenceExperimentalDOLayerTest : public testing::TestWithParam<ExperimentalDOParams>,
|
||||
public CommonReferenceTest {
|
||||
class ReferenceExperimentalDOLayerTest : public testing::TestWithParam<ExperimentalDOParams>, public CommonReferenceTest {
|
||||
public:
|
||||
void SetUp() override {
|
||||
auto params = GetParam();
|
||||
@@ -90,9 +84,12 @@ private:
|
||||
const auto deltas = std::make_shared<op::v0::Parameter>(params.inType, params.deltasShape);
|
||||
const auto scores = std::make_shared<op::v0::Parameter>(params.inType, params.scoresShape);
|
||||
const auto im_info = std::make_shared<op::v0::Parameter>(params.inType, params.imageSizeInfoShape);
|
||||
const auto ExperimentalDO =
|
||||
std::make_shared<op::v6::ExperimentalDetectronDetectionOutput>(rois, deltas, scores, im_info, params.attrs);
|
||||
return std::make_shared<ov::Model>(ExperimentalDO->outputs(), ParameterVector{rois, deltas, scores, im_info});
|
||||
const auto ExperimentalDO = std::make_shared<op::v6::ExperimentalDetectronDetectionOutput>(rois,
|
||||
deltas,
|
||||
scores,
|
||||
im_info,
|
||||
params.attrs);
|
||||
return std::make_shared<ov::Model>(ExperimentalDO->outputs(), ParameterVector {rois, deltas, scores, im_info});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -104,54 +101,68 @@ template <element::Type_t IN_ET>
|
||||
std::vector<ExperimentalDOParams> generateExperimentalDOFloatParams() {
|
||||
using T = typename element_type_traits<IN_ET>::value_type;
|
||||
|
||||
std::vector<ExperimentalDOParams> experimentalDOParams{
|
||||
ExperimentalDOParams(
|
||||
Attrs{
|
||||
0.01000000074505806f, // score_threshold
|
||||
0.2f, // nms_threshold
|
||||
2.0f, // max_delta_log_wh
|
||||
2, // num_classes
|
||||
500, // post_nms_count
|
||||
5, // max_detections_per_image
|
||||
true, // class_agnostic_box_regression
|
||||
{10.0f, 10.0f, 5.0f, 5.0f} // deltas_weights
|
||||
},
|
||||
16,
|
||||
IN_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f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f},
|
||||
std::vector<ExperimentalDOParams> experimentalDOParams {
|
||||
ExperimentalDOParams(Attrs{0.01000000074505806f, // score_threshold
|
||||
0.2f, // nms_threshold
|
||||
2.0f, // max_delta_log_wh
|
||||
2, // num_classes
|
||||
500, // post_nms_count
|
||||
5, // max_detections_per_image
|
||||
true, // class_agnostic_box_regression
|
||||
{10.0f, 10.0f, 5.0f, 5.0f} // deltas_weights
|
||||
},
|
||||
16,
|
||||
IN_ET,
|
||||
std::vector<T>{1.0f, 1.0f, 10.0f, 10.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 8.0f, 5.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f},
|
||||
std::vector<T>{5.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 8.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
|
||||
std::vector<T>{0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.8f, 0.9f, 0.5f,
|
||||
0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
|
||||
0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f},
|
||||
std::vector<T>{16.0f, 12.0f, 1.0f},
|
||||
std::vector<T>{4.8929863f, 0.892986298f, 12.0f, 12.1070137f, 0.0f, 0.892986298f, 10.1070137f,
|
||||
12.1070137f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
|
||||
std::vector<int32_t>{0, 1, 0, 0, 0},
|
||||
std::vector<T>{0.8f, 0.9f, 0.0f, 0.0f, 0.0f}),
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f},
|
||||
std::vector<T>{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f},
|
||||
std::vector<T>{1.0f, 1.0f, 1.0f},
|
||||
std::vector<T>{0.8929862f,
|
||||
0.892986297607421875,
|
||||
12.10701370239257812,
|
||||
12.10701370239257812,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0},
|
||||
std::vector<int32_t>{1, 0, 0, 0, 0},
|
||||
std::vector<T>{1.0f, 0.0f, 0.0f, 0.0f, 0.0f}),
|
||||
};
|
||||
return experimentalDOParams;
|
||||
}
|
||||
|
||||
std::vector<ExperimentalDOParams> generateExperimentalDOCombinedParams() {
|
||||
const std::vector<std::vector<ExperimentalDOParams>> ExperimentalDOTypeParams{
|
||||
const std::vector<std::vector<ExperimentalDOParams>> ExperimentalDOTypeParams {
|
||||
generateExperimentalDOFloatParams<element::Type_t::f32>(),
|
||||
generateExperimentalDOFloatParams<element::Type_t::f16>(),
|
||||
generateExperimentalDOFloatParams<element::Type_t::bf16>(),
|
||||
};
|
||||
};
|
||||
std::vector<ExperimentalDOParams> combinedParams;
|
||||
|
||||
for (const auto& params : ExperimentalDOTypeParams) {
|
||||
@@ -160,8 +171,6 @@ std::vector<ExperimentalDOParams> generateExperimentalDOCombinedParams() {
|
||||
return combinedParams;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalDetectronDetectionOutput_With_Hardcoded_Refs,
|
||||
ReferenceExperimentalDOLayerTest,
|
||||
testing::ValuesIn(generateExperimentalDOCombinedParams()),
|
||||
ReferenceExperimentalDOLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalDetectronDetectionOutput_With_Hardcoded_Refs, ReferenceExperimentalDOLayerTest,
|
||||
testing::ValuesIn(generateExperimentalDOCombinedParams()), ReferenceExperimentalDOLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
||||
@@ -34,7 +34,6 @@ void experimental_detectron_detection_output(const float* input_rois,
|
||||
const float* input_deltas,
|
||||
const float* input_scores,
|
||||
const float* input_im_info,
|
||||
size_t roi_count,
|
||||
const op::v6::ExperimentalDetectronDetectionOutput::Attributes& attrs,
|
||||
float* output_boxes,
|
||||
float* output_scores,
|
||||
|
||||
@@ -54,7 +54,7 @@ void refine_boxes(const float* boxes,
|
||||
const float ctr_x = x0 + 0.5f * ww;
|
||||
const float ctr_y = y0 + 0.5f * hh;
|
||||
|
||||
for (int class_idx = 0; class_idx < classes_num; ++class_idx) {
|
||||
for (int class_idx = 1; class_idx < classes_num; ++class_idx) {
|
||||
const int64_t deltas_base_offset = classes_num * 4 * roi_idx + 4 * class_idx;
|
||||
const float dx = deltas[deltas_base_offset + 0] / weights[0];
|
||||
const float dy = deltas[deltas_base_offset + 1] / weights[1];
|
||||
@@ -76,10 +76,10 @@ void refine_boxes(const float* boxes,
|
||||
float y1_new = pred_ctr_y + 0.5f * pred_h - coordinates_offset;
|
||||
|
||||
// adjust new corner locations to be within the image region,
|
||||
x0_new = std::min(std::max(0.0f, x0_new), img_W);
|
||||
y0_new = std::min(std::max(0.0f, y0_new), img_H);
|
||||
x1_new = std::min(std::max(0.0f, x1_new), img_W);
|
||||
y1_new = std::min(std::max(0.0f, y1_new), img_H);
|
||||
x0_new = std::max<float>(0.0f, x0_new);
|
||||
y0_new = std::max<float>(0.0f, y0_new);
|
||||
x1_new = std::max<float>(0.0f, x1_new);
|
||||
y1_new = std::max<float>(0.0f, y1_new);
|
||||
|
||||
// recompute new width & height
|
||||
const float box_w = x1_new - x0_new + coordinates_offset;
|
||||
@@ -214,7 +214,6 @@ void experimental_detectron_detection_output(const float* boxes,
|
||||
const float* input_deltas,
|
||||
const float* input_scores,
|
||||
const float* input_im_info,
|
||||
size_t roi_count,
|
||||
const op::v6::ExperimentalDetectronDetectionOutput::Attributes& attrs,
|
||||
float* output_boxes,
|
||||
float* output_scores,
|
||||
@@ -222,7 +221,7 @@ void experimental_detectron_detection_output(const float* boxes,
|
||||
const float img_H = input_im_info[0];
|
||||
const float img_W = input_im_info[1];
|
||||
const int64_t classes_num = attrs.num_classes;
|
||||
const int64_t rois_num = static_cast<int64_t>(roi_count);
|
||||
const int64_t rois_num = static_cast<int64_t>(attrs.max_detections_per_image);
|
||||
const int64_t max_detections_per_image = static_cast<int64_t>(attrs.max_detections_per_image);
|
||||
const int64_t max_detections_per_class = attrs.post_nms_count;
|
||||
const float score_threshold = attrs.score_threshold;
|
||||
@@ -256,7 +255,7 @@ void experimental_detectron_detection_output(const float* boxes,
|
||||
std::vector<int64_t> detections_per_class(classes_num, 0);
|
||||
int64_t total_detections_num = 0;
|
||||
|
||||
for (int64_t class_idx = 0; class_idx < classes_num; ++class_idx) {
|
||||
for (int64_t class_idx = 1; class_idx < classes_num; ++class_idx) {
|
||||
nms_cf(&refined_scores[rois_num * class_idx],
|
||||
&refined_boxes[rois_num * 4 * class_idx],
|
||||
&refined_boxes_areas[rois_num * class_idx],
|
||||
|
||||
@@ -272,34 +272,54 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_detection_output)
|
||||
|
||||
auto test_case = test::TestCase(function, s_device);
|
||||
// rois
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
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 8.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
|
||||
test_case.add_expected_output<float>(
|
||||
Shape{5, 4},
|
||||
{4.8929863f, 0.892986298f, 12.0f, 12.1070137f, 0.0f, 0.892986298f, 10.1070137f, 12.1070137f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f});
|
||||
test_case.add_expected_output<int>(Shape{5}, {0, 1, 0, 0, 0});
|
||||
test_case.add_expected_output<float>(Shape{5}, {0.8f, 0.9f, 0.0f, 0.0f, 0.0f});
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f});
|
||||
// scores
|
||||
test_case.add_input<float>({1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f});
|
||||
// im_info
|
||||
test_case.add_input<float>({1.0f, 1.0f, 1.0f});
|
||||
|
||||
test_case.add_expected_output<float>(Shape{5, 4},
|
||||
{
|
||||
0.8929862f,
|
||||
0.892986297607421875,
|
||||
12.10701370239257812,
|
||||
12.10701370239257812,
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
});
|
||||
test_case.add_expected_output<int>(Shape{5}, {1, 0, 0, 0, 0});
|
||||
test_case.add_expected_output<float>(Shape{5}, {1.0f, 0.0f, 0.0f, 0.0f, 0.0f});
|
||||
|
||||
test_case.run();
|
||||
}
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "experimental_detectron_detection_output.h"
|
||||
|
||||
#include <ngraph/op/experimental_detectron_detection_output.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <ngraph/op/experimental_detectron_detection_output.hpp>
|
||||
#include "ie_parallel.hpp"
|
||||
#include "experimental_detectron_detection_output.h"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
|
||||
@@ -39,19 +38,13 @@ struct Indexer {
|
||||
}
|
||||
};
|
||||
|
||||
static void refine_boxes(const float* boxes,
|
||||
const float* deltas,
|
||||
const float* weights,
|
||||
const float* scores,
|
||||
float* refined_boxes,
|
||||
float* refined_boxes_areas,
|
||||
float* refined_scores,
|
||||
const int rois_num,
|
||||
const int classes_num,
|
||||
const float img_H,
|
||||
const float img_W,
|
||||
const float max_delta_log_wh,
|
||||
float coordinates_offset) {
|
||||
static
|
||||
void refine_boxes(const float* boxes, const float* deltas, const float* weights, const float* scores,
|
||||
float* refined_boxes, float* refined_boxes_areas, float* refined_scores,
|
||||
const int rois_num, const int classes_num,
|
||||
const float img_H, const float img_W,
|
||||
const float max_delta_log_wh,
|
||||
float coordinates_offset) {
|
||||
Indexer box_idx({rois_num, 4});
|
||||
Indexer delta_idx({rois_num, classes_num, 4});
|
||||
Indexer score_idx({rois_num, classes_num});
|
||||
@@ -76,7 +69,7 @@ static void refine_boxes(const float* boxes,
|
||||
const float ctr_x = x0 + 0.5f * ww;
|
||||
const float ctr_y = y0 + 0.5f * hh;
|
||||
|
||||
for (int class_idx = 0; class_idx < classes_num; ++class_idx) {
|
||||
for (int class_idx = 1; class_idx < classes_num; ++class_idx) {
|
||||
const float dx = deltas[delta_idx({roi_idx, class_idx, 0})] / weights[0];
|
||||
const float dy = deltas[delta_idx({roi_idx, class_idx, 1})] / weights[1];
|
||||
const float d_log_w = deltas[delta_idx({roi_idx, class_idx, 2})] / weights[2];
|
||||
@@ -97,10 +90,10 @@ static void refine_boxes(const float* boxes,
|
||||
float y1_new = pred_ctr_y + 0.5f * pred_h - coordinates_offset;
|
||||
|
||||
// adjust new corner locations to be within the image region,
|
||||
x0_new = std::min(std::max(0.0f, x0_new), img_W);
|
||||
y0_new = std::min(std::max(0.0f, y0_new), img_H);
|
||||
x1_new = std::min(std::max(0.0f, x1_new), img_W);
|
||||
y1_new = std::min(std::max(0.0f, y1_new), img_H);
|
||||
x0_new = std::max<float>(0.0f, x0_new);
|
||||
y0_new = std::max<float>(0.0f, y0_new);
|
||||
x1_new = std::max<float>(0.0f, x1_new);
|
||||
y1_new = std::max<float>(0.0f, y1_new);
|
||||
|
||||
// recompute new width & height
|
||||
const float box_w = x1_new - x0_new + coordinates_offset;
|
||||
@@ -123,22 +116,21 @@ static bool SortScorePairDescend(const std::pair<float, std::pair<int, int>>& pa
|
||||
return (pair1.first > pair2.first) || ((pair1.first == pair2.first) && (pair1.second.second < pair2.second.second));
|
||||
}
|
||||
|
||||
|
||||
struct ConfidenceComparator {
|
||||
explicit ConfidenceComparator(const float* conf_data) : _conf_data(conf_data) {}
|
||||
|
||||
bool operator()(int idx1, int idx2) {
|
||||
if (_conf_data[idx1] > _conf_data[idx2])
|
||||
return true;
|
||||
if (_conf_data[idx1] < _conf_data[idx2])
|
||||
return false;
|
||||
if (_conf_data[idx1] > _conf_data[idx2]) return true;
|
||||
if (_conf_data[idx1] < _conf_data[idx2]) return false;
|
||||
return idx1 < idx2;
|
||||
}
|
||||
|
||||
const float* _conf_data;
|
||||
};
|
||||
|
||||
static inline float JaccardOverlap(const float* decoded_bbox,
|
||||
const float* bbox_sizes,
|
||||
static inline float JaccardOverlap(const float *decoded_bbox,
|
||||
const float *bbox_sizes,
|
||||
const int idx1,
|
||||
const int idx2,
|
||||
const float coordinates_offset = 1) {
|
||||
@@ -161,7 +153,7 @@ static inline float JaccardOverlap(const float* decoded_bbox,
|
||||
float intersect_xmax = (std::min)(xmax1, xmax2);
|
||||
float intersect_ymax = (std::min)(ymax1, ymax2);
|
||||
|
||||
float intersect_width = intersect_xmax - intersect_xmin + coordinates_offset;
|
||||
float intersect_width = intersect_xmax - intersect_xmin + coordinates_offset;
|
||||
float intersect_height = intersect_ymax - intersect_ymin + coordinates_offset;
|
||||
|
||||
if (intersect_width <= 0 || intersect_height <= 0) {
|
||||
@@ -175,6 +167,7 @@ static inline float JaccardOverlap(const float* decoded_bbox,
|
||||
return intersect_size / (bbox1_size + bbox2_size - intersect_size);
|
||||
}
|
||||
|
||||
|
||||
static void nms_cf(const float* conf_data,
|
||||
const float* bboxes,
|
||||
const float* sizes,
|
||||
@@ -196,10 +189,8 @@ static void nms_cf(const float* conf_data,
|
||||
|
||||
int num_output_scores = (pre_nms_topn == -1 ? count : (std::min)(pre_nms_topn, count));
|
||||
|
||||
std::partial_sort_copy(indices,
|
||||
indices + count,
|
||||
buffer,
|
||||
buffer + num_output_scores,
|
||||
std::partial_sort_copy(indices, indices + count,
|
||||
buffer, buffer + num_output_scores,
|
||||
ConfidenceComparator(conf_data));
|
||||
|
||||
detections = 0;
|
||||
@@ -232,13 +223,11 @@ bool ExperimentalDetectronDetectionOutput::needPrepareParams() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExperimentalDetectronDetectionOutput::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op,
|
||||
std::string& errorMessage) noexcept {
|
||||
bool ExperimentalDetectronDetectionOutput::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept {
|
||||
try {
|
||||
const auto doOp = ngraph::as_type_ptr<const ngraph::op::v6::ExperimentalDetectronDetectionOutput>(op);
|
||||
if (!doOp) {
|
||||
errorMessage =
|
||||
"Node is not an instance of the ExperimentalDetectronDetectionOutput from the operations set v6.";
|
||||
errorMessage = "Node is not an instance of the ExperimentalDetectronDetectionOutput from the operations set v6.";
|
||||
return false;
|
||||
}
|
||||
} catch (...) {
|
||||
@@ -247,10 +236,9 @@ bool ExperimentalDetectronDetectionOutput::isSupportedOperation(const std::share
|
||||
return true;
|
||||
}
|
||||
|
||||
ExperimentalDetectronDetectionOutput::ExperimentalDetectronDetectionOutput(const std::shared_ptr<ngraph::Node>& op,
|
||||
const dnnl::engine& eng,
|
||||
WeightsSharing::Ptr& cache)
|
||||
: Node(op, eng, cache) {
|
||||
ExperimentalDetectronDetectionOutput::ExperimentalDetectronDetectionOutput
|
||||
(const std::shared_ptr<ngraph::Node>& op, const dnnl::engine& eng,
|
||||
WeightsSharing::Ptr &cache) : Node(op, eng, cache) {
|
||||
std::string errorMessage;
|
||||
if (!isSupportedOperation(op, errorMessage)) {
|
||||
IE_THROW(NotImplemented) << errorMessage;
|
||||
@@ -277,10 +265,11 @@ void ExperimentalDetectronDetectionOutput::initSupportedPrimitiveDescriptors() {
|
||||
for (int i = 0; i < inputShapes.size(); ++i)
|
||||
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
|
||||
|
||||
addSupportedPrimDesc(
|
||||
inDataConf,
|
||||
{{LayoutType::ncsp, Precision::FP32}, {LayoutType::ncsp, Precision::I32}, {LayoutType::ncsp, Precision::FP32}},
|
||||
impl_desc_type::ref_any);
|
||||
addSupportedPrimDesc(inDataConf,
|
||||
{{LayoutType::ncsp, Precision::FP32},
|
||||
{LayoutType::ncsp, Precision::I32},
|
||||
{LayoutType::ncsp, Precision::FP32}},
|
||||
impl_desc_type::ref_any);
|
||||
}
|
||||
|
||||
void ExperimentalDetectronDetectionOutput::execute(dnnl::stream strm) {
|
||||
@@ -288,14 +277,14 @@ void ExperimentalDetectronDetectionOutput::execute(dnnl::stream strm) {
|
||||
assert(classes_num_ == static_cast<int>(getParentEdgeAt(INPUT_SCORES)->getMemory().getStaticDims()[1]));
|
||||
assert(4 * classes_num_ == static_cast<int>(getParentEdgeAt(INPUT_DELTAS)->getMemory().getStaticDims()[1]));
|
||||
|
||||
const auto* boxes = reinterpret_cast<const float*>(getParentEdgeAt(INPUT_ROIS)->getMemoryPtr()->GetPtr());
|
||||
const auto* deltas = reinterpret_cast<const float*>(getParentEdgeAt(INPUT_DELTAS)->getMemoryPtr()->GetPtr());
|
||||
const auto* scores = reinterpret_cast<const float*>(getParentEdgeAt(INPUT_SCORES)->getMemoryPtr()->GetPtr());
|
||||
const auto* im_info = reinterpret_cast<const float*>(getParentEdgeAt(INPUT_IM_INFO)->getMemoryPtr()->GetPtr());
|
||||
const auto* boxes = reinterpret_cast<const float *>(getParentEdgeAt(INPUT_ROIS)->getMemoryPtr()->GetPtr());
|
||||
const auto* deltas = reinterpret_cast<const float *>(getParentEdgeAt(INPUT_DELTAS)->getMemoryPtr()->GetPtr());
|
||||
const auto* scores = reinterpret_cast<const float *>(getParentEdgeAt(INPUT_SCORES)->getMemoryPtr()->GetPtr());
|
||||
const auto* im_info = reinterpret_cast<const float *>(getParentEdgeAt(INPUT_IM_INFO)->getMemoryPtr()->GetPtr());
|
||||
|
||||
auto* output_boxes = reinterpret_cast<float*>(getChildEdgesAtPort(OUTPUT_BOXES)[0]->getMemoryPtr()->GetPtr());
|
||||
auto* output_scores = reinterpret_cast<float*>(getChildEdgesAtPort(OUTPUT_SCORES)[0]->getMemoryPtr()->GetPtr());
|
||||
auto* output_classes = reinterpret_cast<int32_t*>(getChildEdgesAtPort(OUTPUT_CLASSES)[0]->getMemoryPtr()->GetPtr());
|
||||
auto* output_boxes = reinterpret_cast<float *>(getChildEdgesAtPort(OUTPUT_BOXES)[0]->getMemoryPtr()->GetPtr());
|
||||
auto* output_scores = reinterpret_cast<float *>(getChildEdgesAtPort(OUTPUT_SCORES)[0]->getMemoryPtr()->GetPtr());
|
||||
auto* output_classes = reinterpret_cast<int32_t *>(getChildEdgesAtPort(OUTPUT_CLASSES)[0]->getMemoryPtr()->GetPtr());
|
||||
|
||||
const float img_H = im_info[0];
|
||||
const float img_W = im_info[1];
|
||||
@@ -307,17 +296,10 @@ void ExperimentalDetectronDetectionOutput::execute(dnnl::stream strm) {
|
||||
Indexer refined_box_idx({classes_num_, rois_num, 4});
|
||||
Indexer refined_score_idx({classes_num_, rois_num});
|
||||
|
||||
refine_boxes(boxes,
|
||||
deltas,
|
||||
&deltas_weights_[0],
|
||||
scores,
|
||||
&refined_boxes[0],
|
||||
&refined_boxes_areas[0],
|
||||
&refined_scores[0],
|
||||
rois_num,
|
||||
classes_num_,
|
||||
img_H,
|
||||
img_W,
|
||||
refine_boxes(boxes, deltas, &deltas_weights_[0], scores,
|
||||
&refined_boxes[0], &refined_boxes_areas[0], &refined_scores[0],
|
||||
rois_num, classes_num_,
|
||||
img_H, img_W,
|
||||
max_delta_log_wh_,
|
||||
1.0f);
|
||||
|
||||
@@ -327,7 +309,7 @@ void ExperimentalDetectronDetectionOutput::execute(dnnl::stream strm) {
|
||||
std::vector<int> detections_per_class(classes_num_, 0);
|
||||
int total_detections_num = 0;
|
||||
|
||||
for (int class_idx = 0; class_idx < classes_num_; ++class_idx) {
|
||||
for (int class_idx = 1; class_idx < classes_num_; ++class_idx) {
|
||||
nms_cf(&refined_scores[refined_score_idx({class_idx, 0})],
|
||||
&refined_boxes[refined_box_idx({class_idx, 0, 0})],
|
||||
&refined_boxes_areas[refined_score_idx({class_idx, 0})],
|
||||
@@ -373,7 +355,7 @@ void ExperimentalDetectronDetectionOutput::execute(dnnl::stream strm) {
|
||||
memset(output_classes, 0, max_detections_per_image_ * sizeof(output_classes[0]));
|
||||
|
||||
int i = 0;
|
||||
for (const auto& detection : conf_index_class_map) {
|
||||
for (const auto & detection : conf_index_class_map) {
|
||||
float score = detection.first;
|
||||
int cls = detection.second.first;
|
||||
int idx = detection.second.second;
|
||||
@@ -391,6 +373,6 @@ bool ExperimentalDetectronDetectionOutput::created() const {
|
||||
return getType() == Type::ExperimentalDetectronDetectionOutput;
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
} // namespace intel_cpu
|
||||
} // namespace ov
|
||||
} // namespace node
|
||||
} // namespace intel_cpu
|
||||
} // namespace ov
|
||||
|
||||
@@ -47,7 +47,7 @@ const std::vector<std::vector<InputShape>> inputShapes = {
|
||||
static_shapes_to_test_representation({{16, 4}, {16, 8}, {16, 2}, {1, 3}}),
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_ExperimentalDetectronDetectionOutput,
|
||||
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_ExperimentalDetectronDetectionOutput,
|
||||
ExperimentalDetectronDetectionOutputLayerTest,
|
||||
::testing::Combine(::testing::ValuesIn(inputShapes),
|
||||
::testing::ValuesIn(score_threshold),
|
||||
|
||||
@@ -3,19 +3,16 @@
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_layer/experimental_detectron_detection_output.hpp"
|
||||
|
||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
||||
|
||||
#include "common_test_utils/data_utils.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
#include "common_test_utils/data_utils.hpp"
|
||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
namespace subgraph {
|
||||
|
||||
namespace {
|
||||
std::ostream& operator<<(std::ostream& ss,
|
||||
const ngraph::opset6::ExperimentalDetectronDetectionOutput::Attributes& attributes) {
|
||||
std::ostream& operator <<(std::ostream& ss, const ngraph::opset6::ExperimentalDetectronDetectionOutput::Attributes& attributes) {
|
||||
ss << "score_threshold=" << attributes.score_threshold << "_";
|
||||
ss << "nms_threshold=" << attributes.nms_threshold << "_";
|
||||
ss << "max_delta_log_wh=" << attributes.max_delta_log_wh << "_";
|
||||
@@ -26,25 +23,26 @@ std::ostream& operator<<(std::ostream& ss,
|
||||
ss << "deltas_weights=" << CommonTestUtils::vec2str(attributes.deltas_weights);
|
||||
return ss;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
std::string ExperimentalDetectronDetectionOutputLayerTest::getTestCaseName(
|
||||
const testing::TestParamInfo<ExperimentalDetectronDetectionOutputTestParams>& obj) {
|
||||
const testing::TestParamInfo<ExperimentalDetectronDetectionOutputTestParams>& obj) {
|
||||
std::vector<ov::test::InputShape> inputShapes;
|
||||
ngraph::opset6::ExperimentalDetectronDetectionOutput::Attributes attributes;
|
||||
ElementType netPrecision;
|
||||
std::string targetName;
|
||||
std::tie(inputShapes,
|
||||
attributes.score_threshold,
|
||||
attributes.nms_threshold,
|
||||
attributes.max_delta_log_wh,
|
||||
attributes.num_classes,
|
||||
attributes.post_nms_count,
|
||||
attributes.max_detections_per_image,
|
||||
attributes.class_agnostic_box_regression,
|
||||
attributes.deltas_weights,
|
||||
netPrecision,
|
||||
targetName) = obj.param;
|
||||
std::tie(
|
||||
inputShapes,
|
||||
attributes.score_threshold,
|
||||
attributes.nms_threshold,
|
||||
attributes.max_delta_log_wh,
|
||||
attributes.num_classes,
|
||||
attributes.post_nms_count,
|
||||
attributes.max_detections_per_image,
|
||||
attributes.class_agnostic_box_regression,
|
||||
attributes.deltas_weights,
|
||||
netPrecision,
|
||||
targetName) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
|
||||
@@ -67,17 +65,18 @@ void ExperimentalDetectronDetectionOutputLayerTest::SetUp() {
|
||||
|
||||
ElementType netPrecision;
|
||||
std::string targetName;
|
||||
std::tie(inputShapes,
|
||||
attributes.score_threshold,
|
||||
attributes.nms_threshold,
|
||||
attributes.max_delta_log_wh,
|
||||
attributes.num_classes,
|
||||
attributes.post_nms_count,
|
||||
attributes.max_detections_per_image,
|
||||
attributes.class_agnostic_box_regression,
|
||||
attributes.deltas_weights,
|
||||
netPrecision,
|
||||
targetName) = this->GetParam();
|
||||
std::tie(
|
||||
inputShapes,
|
||||
attributes.score_threshold,
|
||||
attributes.nms_threshold,
|
||||
attributes.max_delta_log_wh,
|
||||
attributes.num_classes,
|
||||
attributes.post_nms_count,
|
||||
attributes.max_detections_per_image,
|
||||
attributes.class_agnostic_box_regression,
|
||||
attributes.deltas_weights,
|
||||
netPrecision,
|
||||
targetName) = this->GetParam();
|
||||
|
||||
if (netPrecision == element::f16)
|
||||
abs_threshold = 0.01;
|
||||
@@ -88,74 +87,49 @@ void ExperimentalDetectronDetectionOutputLayerTest::SetUp() {
|
||||
init_input_shapes(inputShapes);
|
||||
|
||||
auto params = ngraph::builder::makeDynamicParams(netPrecision, {inputDynamicShapes});
|
||||
auto paramsOuts =
|
||||
ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params));
|
||||
auto experimentalDetectron =
|
||||
std::make_shared<ngraph::opset6::ExperimentalDetectronDetectionOutput>(params[0], // input_rois
|
||||
params[1], // input_deltas
|
||||
params[2], // input_scores
|
||||
params[3], // input_im_info
|
||||
attributes);
|
||||
function = std::make_shared<ov::Model>(ov::OutputVector{experimentalDetectron->output(0),
|
||||
experimentalDetectron->output(1),
|
||||
experimentalDetectron->output(2)},
|
||||
"ExperimentalDetectronDetectionOutput");
|
||||
auto paramsOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params));
|
||||
auto experimentalDetectron = std::make_shared<ngraph::opset6::ExperimentalDetectronDetectionOutput>(
|
||||
params[0], // input_rois
|
||||
params[1], // input_deltas
|
||||
params[2], // input_scores
|
||||
params[3], // input_im_info
|
||||
attributes);
|
||||
function = std::make_shared<ov::Model>(
|
||||
ov::OutputVector{experimentalDetectron->output(0), experimentalDetectron->output(1)},
|
||||
"ExperimentalDetectronDetectionOutput");
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> getValues(const std::vector<float>& values) {
|
||||
std::vector<T> result(values.begin(), values.end());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<ov::Tensor> generateInputTensors() {
|
||||
const auto netPrecision = ov::element::from<T>();
|
||||
std::vector<ov::Tensor> inputTensors = {
|
||||
void ExperimentalDetectronDetectionOutputLayerTest::generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) {
|
||||
static const std::vector<ov::Tensor> inputTensors = {
|
||||
// 16 x 4 = 64
|
||||
ov::test::utils::create_tensor<T>(
|
||||
netPrecision,
|
||||
Shape{16, 4},
|
||||
getValues<T>({1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 4.0f,
|
||||
1.0f, 8.0f, 5.0f, 1.0f, 1.0f, 10.0f, 10.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f})),
|
||||
ov::test::utils::create_tensor<float>(ov::element::f32, Shape{16, 4}, {
|
||||
1.0f, 1.0f, 10.0f, 10.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 8.0f, 5.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
|
||||
}),
|
||||
// 16 x 8
|
||||
ov::test::utils::create_tensor<T>(
|
||||
netPrecision,
|
||||
Shape{16, 8},
|
||||
getValues<T>({1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 8.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 5.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f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1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
|
||||
}),
|
||||
// 16 x 2 = 32
|
||||
ov::test::utils::create_tensor<T>(
|
||||
netPrecision,
|
||||
Shape{16, 2},
|
||||
getValues<T>({0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.8f, 0.9f, 0.5f,
|
||||
0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
|
||||
0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f})),
|
||||
ov::test::utils::create_tensor<float>(ov::element::f32, Shape{16, 2}, {
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
|
||||
}),
|
||||
// 1 x 3 = 3
|
||||
ov::test::utils::create_tensor<T>(netPrecision, Shape{1, 3}, getValues<T>({16.0f, 12.0f, 1.0f}))};
|
||||
|
||||
return inputTensors;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void ExperimentalDetectronDetectionOutputLayerTest::generate_inputs(
|
||||
const std::vector<ngraph::Shape>& targetInputStaticShapes) {
|
||||
const auto netPrecision = std::get<9>(GetParam());
|
||||
|
||||
const std::vector<ov::Tensor> inputTensors =
|
||||
(netPrecision == element::f16) ? generateInputTensors<ov::float16>() : generateInputTensors<float>();
|
||||
ov::test::utils::create_tensor<float>(ov::element::f32, Shape{1, 3}, {1.0f, 1.0f, 1.0f})
|
||||
};
|
||||
|
||||
inputs.clear();
|
||||
const auto& funcInputs = function->inputs();
|
||||
@@ -168,6 +142,6 @@ void ExperimentalDetectronDetectionOutputLayerTest::generate_inputs(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace subgraph
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
} // namespace subgraph
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
|
||||
Reference in New Issue
Block a user