Fix NMS5 dynamism issues (#3137)
* Fixed ConvertNMS5ToLegacy conversion pass to resolve dynamism as soon as possible; fixed output precision to avoid troubles during convert_precision pass * Added NMS5ToLegacy conversion for cldnn plugin * Fixed NMS3 copy method * Updated NMS5ToLegacy pass to avoid convert precision issues * Updated nGraph reader and Functional tests * Removing odd CF call * removed xfail for test that is expected to pass * Fixed Convert operations friendly_name * Removed NMS5ToLegacy from opset1_to_legacy conversion * Update NMS5 layer tests * Update NMS5 DSR tests
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp>
|
||||
#include <legacy/convert_function_to_cnn_network.hpp>
|
||||
#include <legacy/ie_util_internal.hpp>
|
||||
#include <legacy/graph_transformer.h>
|
||||
@@ -155,6 +156,7 @@ InferenceEngine::ICNNNetwork::Ptr clDNNEngine::CloneAndTransformNetwork(const In
|
||||
manager.register_pass<ngraph::pass::InitNodeInfo>();
|
||||
// WA: ConvertPriorBox must be executed before the 1st ConstantFolding pass
|
||||
manager.register_pass<ngraph::pass::ConvertPriorBox>();
|
||||
manager.register_pass<ngraph::pass::ConvertNMS5ToLegacyMatcher>();
|
||||
manager.register_pass<ngraph::pass::CommonOptimizations>();
|
||||
manager.register_pass<ngraph::pass::ConvertRNNSequenceToTensorIterator>();
|
||||
manager.register_pass<ngraph::pass::ConvertGRUSequenceToTensorIterator>();
|
||||
|
||||
@@ -14,6 +14,8 @@ file (GLOB LIBRARY_SRC
|
||||
set(LEGACY_SRC_ROOT "${IE_MAIN_SOURCE_DIR}/src/legacy_api/src/")
|
||||
set(LEGACY_LIBRARY_SHARED_SRCS
|
||||
"${LEGACY_SRC_ROOT}/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp"
|
||||
"${LEGACY_SRC_ROOT}/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp"
|
||||
"${LEGACY_SRC_ROOT}/ngraph_ops/nms_ie.cpp"
|
||||
"${LEGACY_SRC_ROOT}/ngraph_ops/onehot_ie.cpp")
|
||||
|
||||
set(IE_STATIC_DEPENDENT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/file_utils.cpp)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
// TODO: remove this pass usage
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp>
|
||||
|
||||
#include "ie_ngraph_utils.hpp"
|
||||
#include "exec_graph_info.hpp"
|
||||
@@ -334,11 +335,14 @@ CNNNetworkNGraphImpl::reshape(const std::map<std::string, std::vector<size_t>>&
|
||||
_ngraph_function->validate_nodes_and_infer_types();
|
||||
|
||||
{
|
||||
auto specialized_ngraph_function = cloneFunction(true);
|
||||
// Call this transformation because OneHot IE and nGraph have different output precisions
|
||||
auto specialized_ngraph_function = cloneFunction(false);
|
||||
{
|
||||
OV_ITT_SCOPED_TASK(itt::domains::IE, "CNNNetworkNGraphImpl::ConvertOneHot");
|
||||
OV_ITT_SCOPED_TASK(itt::domains::IE, "CNNNetworkNGraphImpl::ConvertToLegacy");
|
||||
::ngraph::pass::Manager manager;
|
||||
// resolves dynamism by replacing dynamic operation with static version
|
||||
manager.register_pass<::ngraph::pass::ConvertNMS5ToLegacyMatcher>();
|
||||
manager.register_pass<::ngraph::pass::ConstantFolding>();
|
||||
// OneHotToLegacy changes output precision
|
||||
manager.register_pass<::ngraph::pass::ConvertOneHotToOneHotIEMatcher>()->detect_output_type(
|
||||
specialized_ngraph_function);
|
||||
manager.run_passes(specialized_ngraph_function);
|
||||
|
||||
@@ -132,10 +132,16 @@ op::NonMaxSuppressionIE3::NonMaxSuppressionIE3(const Output<Node>& boxes,
|
||||
}
|
||||
|
||||
std::shared_ptr<Node> op::NonMaxSuppressionIE3::clone_with_new_inputs(const ngraph::OutputVector &new_args) const {
|
||||
check_new_args_count(this, new_args);
|
||||
return make_shared<NonMaxSuppressionIE3>(new_args.at(0), new_args.at(1), new_args.at(2), new_args.at(3),
|
||||
if (new_args.size() == 6) {
|
||||
return make_shared<NonMaxSuppressionIE3>(new_args.at(0), new_args.at(1), new_args.at(2), new_args.at(3),
|
||||
new_args.at(4), new_args.at(5), m_center_point_box, m_sort_result_descending,
|
||||
m_output_type);
|
||||
} else if (new_args.size() == 5) {
|
||||
return make_shared<NonMaxSuppressionIE3>(new_args.at(0), new_args.at(1), new_args.at(2), new_args.at(3),
|
||||
new_args.at(4), m_center_point_box, m_sort_result_descending,
|
||||
m_output_type);
|
||||
}
|
||||
throw ngraph::ngraph_error("Unsupported number of inputs: " + std::to_string(new_args.size()));
|
||||
}
|
||||
|
||||
bool op::NonMaxSuppressionIE3::visit_attributes(AttributeVisitor& visitor) {
|
||||
|
||||
@@ -84,8 +84,8 @@ ngraph::pass::ConvertNMS5ToLegacyMatcher::ConvertNMS5ToLegacyMatcher() {
|
||||
new_soft_nms_sigma,
|
||||
center_point_box,
|
||||
nms_5->get_sort_result_descending(),
|
||||
nms_5->get_output_type());
|
||||
new_ops.emplace_back(nms_legacy);
|
||||
element::i32);
|
||||
new_ops.push_back(nms_legacy);
|
||||
} else {
|
||||
nms_legacy = std::make_shared<op::NonMaxSuppressionIE3>(
|
||||
new_args.at(0),
|
||||
@@ -95,13 +95,27 @@ ngraph::pass::ConvertNMS5ToLegacyMatcher::ConvertNMS5ToLegacyMatcher() {
|
||||
new_score_threshold,
|
||||
center_point_box,
|
||||
nms_5->get_sort_result_descending(),
|
||||
nms_5->get_output_type());
|
||||
new_ops.emplace_back(nms_legacy);
|
||||
element::i32);
|
||||
new_ops.push_back(nms_legacy);
|
||||
}
|
||||
|
||||
Output<Node> output_0 = nms_legacy->output(0);
|
||||
if (nms_5->output(0).get_element_type() != output_0.get_element_type()) {
|
||||
output_0 = std::make_shared<opset1::Convert>(output_0, nms_5->output(0).get_element_type());
|
||||
output_0.get_node_shared_ptr()->set_friendly_name(nms_5->get_friendly_name() + "/convert.0");
|
||||
new_ops.emplace_back(output_0.get_node_shared_ptr());
|
||||
}
|
||||
|
||||
Output<Node> output_2 = nms_legacy->output(2);
|
||||
if (nms_5->output(2).get_element_type() != output_2.get_element_type()) {
|
||||
output_2 = std::make_shared<opset1::Convert>(output_2, nms_5->output(2).get_element_type());
|
||||
output_2.get_node_shared_ptr()->set_friendly_name(nms_5->get_friendly_name() + "/convert.2");
|
||||
new_ops.emplace_back(output_2.get_node_shared_ptr());
|
||||
}
|
||||
|
||||
nms_legacy->set_friendly_name(nms_5->get_friendly_name());
|
||||
ngraph::copy_runtime_info(nms_5, new_ops);
|
||||
ngraph::replace_node(nms_5, nms_legacy);
|
||||
ngraph::replace_node(nms_5, {output_0, nms_legacy->output(1), output_2});
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ bool ngraph::pass::ConvertOpSet1ToLegacy::run_on_function(std::shared_ptr<ngraph
|
||||
anchor->add_matcher<ngraph::pass::ConvertGatherTreeToGatherTreeIEMatcher>();
|
||||
anchor->add_matcher<ngraph::pass::ConvertTopKToTopKIEMatcher>();
|
||||
anchor->add_matcher<ngraph::pass::ConvertNMSToNMSIEMatcher>();
|
||||
anchor->add_matcher<ngraph::pass::ConvertNMS5ToLegacyMatcher>();
|
||||
anchor->add_matcher<ngraph::pass::ConvertGRUSequenceMatcher>();
|
||||
anchor->add_matcher<ngraph::pass::ConvertRNNSequenceMatcher>();
|
||||
anchor->add_matcher<ngraph::pass::ConvertLSTMSequenceMatcher>();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/reshape_fully_connected.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp>
|
||||
#include <legacy/ngraph_ops/fully_connected.hpp>
|
||||
|
||||
#include <transformations/opset_conversions/convert_opset3_to_opset2.hpp>
|
||||
@@ -100,6 +101,7 @@ static void Transformation(ICNNNetwork::Ptr& clonedNetwork, const Config& conf)
|
||||
manager.register_pass<ngraph::pass::InitNodeInfo>();
|
||||
// WA: ConvertPriorBox must be executed before the 1st ConstantFolding pass
|
||||
manager.register_pass<ngraph::pass::ConvertPriorBox>();
|
||||
manager.register_pass<ngraph::pass::ConvertNMS5ToLegacyMatcher>();
|
||||
manager.register_pass<ngraph::pass::CommonOptimizations>();
|
||||
manager.register_pass<ngraph::pass::ConvertRNNSequenceToTensorIterator>();
|
||||
manager.register_pass<ngraph::pass::ConvertGRUSequenceToTensorIterator>();
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include <ie_core.hpp>
|
||||
#include <legacy/details/ie_cnn_network_iterator.hpp>
|
||||
#include <legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp>
|
||||
#include <ngraph/pass/manager.hpp>
|
||||
|
||||
#include "common_test_utils/test_common.hpp"
|
||||
#include "common_test_utils/file_utils.hpp"
|
||||
@@ -39,6 +41,12 @@ protected:
|
||||
}
|
||||
|
||||
auto network = ie.ReadNetwork(modelV10, weights);
|
||||
auto f = network.getFunction();
|
||||
// WA: we have to resolve dynamysm manually to compare resulting function with v7 IR
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ngraph::pass::ConvertNMS5ToLegacyMatcher>();
|
||||
manager.run_passes(f);
|
||||
network = CNNNetwork(f);
|
||||
auto cnnNetwork = ie.ReadNetwork(oldModel, weights);
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
@@ -72,7 +72,7 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
|
||||
</output>
|
||||
</layer>
|
||||
<layer id="6" name="nms" type="NonMaxSuppression" version="opset5">
|
||||
<data box_encoding="corner" sort_result_descending="0"/>
|
||||
<data box_encoding="corner" sort_result_descending="0" output_type="i32"/>
|
||||
<input>
|
||||
<port id="0" precision="FP32">
|
||||
<dim>1</dim>
|
||||
@@ -248,8 +248,8 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
|
||||
<custom offset="12" precision="FP32" size="4"/>
|
||||
</blobs>
|
||||
</layer>
|
||||
<layer id="5" name="nms" type="NonMaxSuppression" precision="I64">
|
||||
<data center_point_box="false" output_type="I64" sort_result_descending="false"/>
|
||||
<layer id="5" name="nms" type="NonMaxSuppression" precision="I32">
|
||||
<data center_point_box="false" output_type="I32" sort_result_descending="false"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
@@ -272,7 +272,7 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
<port id="5" precision="I64">
|
||||
<port id="5" precision="I32">
|
||||
<dim>16000</dim>
|
||||
<dim>3</dim>
|
||||
</port>
|
||||
@@ -280,12 +280,12 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
|
||||
<dim>16000</dim>
|
||||
<dim>3</dim>
|
||||
</port>
|
||||
<port id="7" precision="I64">
|
||||
<port id="7" precision="I32">
|
||||
<dim>1</dim>
|
||||
</port>
|
||||
</output>
|
||||
</layer>
|
||||
<layer id="6" name="mul" type="Eltwise" precision="I64">
|
||||
<layer id="6" name="mul" type="Eltwise" precision="I32">
|
||||
<data operation="prod"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
@@ -298,13 +298,13 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
<port id="2" precision="I64">
|
||||
<port id="2" precision="I32">
|
||||
<dim>16000</dim>
|
||||
<dim>3</dim>
|
||||
</port>
|
||||
</output>
|
||||
</layer>
|
||||
<layer id="7" name="mul2" type="Eltwise" precision="I64">
|
||||
<layer id="7" name="mul2" type="Eltwise" precision="I32">
|
||||
<data operation="prod"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
@@ -315,7 +315,7 @@ TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
<port id="2" precision="I64">
|
||||
<port id="2" precision="I32">
|
||||
<dim>1</dim>
|
||||
</port>
|
||||
</output>
|
||||
|
||||
@@ -30,7 +30,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticSixInputs) {
|
||||
auto score_threshold = opset5::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto soft_nms_sigma = ngraph::opset5::Constant::create(element::f32, Shape{}, {0.25});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold,
|
||||
soft_nms_sigma, opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
soft_nms_sigma, opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -64,7 +64,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticSixInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
new_soft_nms_sigma, 0, true);
|
||||
new_soft_nms_sigma, 0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -84,7 +84,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticFiveInputs) {
|
||||
auto iou_threshold = opset5::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = opset5::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -114,7 +114,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticFiveInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -133,7 +133,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticFourInputs) {
|
||||
auto max_output_boxes_per_class = opset5::Constant::create(element::i64, Shape{}, {10});
|
||||
auto iou_threshold = opset5::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -163,7 +163,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticFourInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -181,7 +181,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticThreeInputs) {
|
||||
auto scores = std::make_shared<opset5::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = opset5::Constant::create(element::i64, Shape{}, {10});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -211,7 +211,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticThreeInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -228,7 +228,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticTwoInputs) {
|
||||
auto boxes = std::make_shared<opset5::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<opset5::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -258,7 +258,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEStaticTwoInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -279,7 +279,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1SixInputs) {
|
||||
auto score_threshold = opset5::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto soft_nms_sigma = ngraph::opset5::Constant::create(element::f32, Shape{}, {0.25});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold,
|
||||
soft_nms_sigma, opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
soft_nms_sigma, opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -314,7 +314,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1SixInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
new_soft_nms_sigma, 0, true);
|
||||
new_soft_nms_sigma, 0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -333,7 +333,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1FiveInputs) {
|
||||
auto iou_threshold = opset5::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = opset5::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -364,7 +364,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1FiveInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -382,7 +382,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1FourInputs) {
|
||||
auto max_output_boxes_per_class = opset5::Constant::create(element::i64, Shape{}, {10});
|
||||
auto iou_threshold = opset5::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -413,7 +413,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1FourInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -430,7 +430,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1ThreeInputs) {
|
||||
auto scores = std::make_shared<opset5::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto max_output_boxes_per_class = opset5::Constant::create(element::i64, Shape{}, {10});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -461,7 +461,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1ThreeInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -477,7 +477,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1TwoInputs) {
|
||||
auto boxes = std::make_shared<opset5::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto scores = std::make_shared<opset5::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -508,7 +508,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic1TwoInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -528,7 +528,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2SixInputs) {
|
||||
auto score_threshold = opset5::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto soft_nms_sigma = ngraph::opset5::Constant::create(element::f32, Shape{}, {0.25});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold,
|
||||
soft_nms_sigma, opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
soft_nms_sigma, opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -562,7 +562,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2SixInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
new_soft_nms_sigma, 0, true);
|
||||
new_soft_nms_sigma, 0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -581,7 +581,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2FiveInputs) {
|
||||
auto iou_threshold = opset5::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = opset5::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -611,7 +611,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2FiveInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -629,7 +629,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2FourInputs) {
|
||||
auto max_output_boxes_per_class = opset5::Constant::create(element::i64, Shape{}, {10});
|
||||
auto iou_threshold = opset5::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class, iou_threshold,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -659,7 +659,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2FourInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -676,7 +676,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2ThreeInputs) {
|
||||
auto scores = std::make_shared<opset5::Parameter>(element::f32, PartialShape{DYN, 1, 1000});
|
||||
auto max_output_boxes_per_class = opset5::Constant::create(element::i64, Shape{}, {10});
|
||||
auto nms = std::make_shared<opset5::NonMaxSuppression>(boxes, scores, max_output_boxes_per_class,
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true);
|
||||
opset5::NonMaxSuppression::BoxEncodingType::CORNER, true, element::i32);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -706,7 +706,7 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2ThreeInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
@@ -752,10 +752,12 @@ TEST(TransformationTests, ConvertNMS5ToNMSIEDynamic2TwoInputs) {
|
||||
opset5::Constant::create(ngraph::element::i64, one_dim_shape,
|
||||
one_dim_shape), true);
|
||||
auto nms = std::make_shared<op::NonMaxSuppressionIE3>(boxes, scores, new_max_per_class, new_iou_threshold, new_score_threshold,
|
||||
0, true);
|
||||
0, true, element::i32);
|
||||
nms->set_friendly_name("nms");
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
auto convert_0 = std::make_shared<opset1::Convert>(nms->output(0), element::i64);
|
||||
|
||||
f_ref = std::make_shared<Function>(NodeVector{convert_0}, ParameterVector{boxes, scores});
|
||||
}
|
||||
|
||||
auto res = compare_functions(f, f_ref);
|
||||
|
||||
@@ -77,9 +77,12 @@ protected:
|
||||
SetRefMode(LayerTestsUtils::RefMode::INTERPRETER);
|
||||
configuration[InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH] = CONFIG_VALUE(NO);
|
||||
const auto testedOp = createTestedOp();
|
||||
|
||||
const auto identity_0 = std::make_shared<ngraph::opset5::Multiply>(testedOp->output(0),
|
||||
ngraph::opset5::Constant::create(testedOp->output(0).get_element_type(), ngraph::Shape{1}, {1}));
|
||||
const auto identity_2 = std::make_shared<ngraph::opset5::Multiply>(testedOp->output(2),
|
||||
ngraph::opset5::Constant::create(testedOp->output(2).get_element_type(), ngraph::Shape{1}, {1}));
|
||||
function = std::make_shared<ngraph::Function>(
|
||||
ngraph::OutputVector{testedOp->output(0), testedOp->output(2)},
|
||||
ngraph::OutputVector{identity_0, identity_2},
|
||||
m_parameterVector);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,6 @@ using NmsParams = std::tuple<InputShapeParams,
|
||||
class NmsLayerTest : public testing::WithParamInterface<NmsParams>, virtual public LayerTestsUtils::LayerTestsCommon {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<NmsParams> obj);
|
||||
void ConfigureNetwork() override;
|
||||
void Infer() override;
|
||||
void Compare(const std::vector<std::vector<std::uint8_t>> &expectedOutputs, const std::vector<InferenceEngine::Blob::Ptr> &actualOutputs) override;
|
||||
|
||||
|
||||
@@ -37,19 +37,6 @@ std::string NmsLayerTest::getTestCaseName(testing::TestParamInfo<NmsParams> obj)
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void NmsLayerTest::ConfigureNetwork() {
|
||||
const OutputsDataMap &outputMap = cnnNetwork.getOutputsInfo();
|
||||
auto out = outputMap.begin();
|
||||
for (size_t i = 0; i < outputMap.size(); i++) {
|
||||
if (i < 2) {
|
||||
TensorDesc desc(out->second->getTensorDesc().getPrecision(), SizeVector{numOfSelectedBoxes, 3},
|
||||
TensorDesc::getLayoutByDims(SizeVector{numOfSelectedBoxes, 3}));
|
||||
*(out->second) = *std::make_shared<Data>(out->first, desc);
|
||||
}
|
||||
out++;
|
||||
}
|
||||
}
|
||||
|
||||
void NmsLayerTest::Infer() {
|
||||
inferRequest = executableNetwork.CreateInferRequest();
|
||||
inputs.clear();
|
||||
@@ -130,7 +117,10 @@ void NmsLayerTest::SetUp() {
|
||||
|
||||
auto nms = builder::makeNms(paramOuts[0], paramOuts[1], convertIE2nGraphPrc(maxBoxPrec), convertIE2nGraphPrc(thrPrec), maxOutBoxesPerClass, iouThr,
|
||||
scoreThr, softNmsSigma, boxEncoding, sortResDescend, outType);
|
||||
function = std::make_shared<Function>(nms, params, "NMS");
|
||||
auto nms_0_identity = std::make_shared<opset5::Multiply>(nms->output(0), opset5::Constant::create(outType, Shape{1}, {1}));
|
||||
auto nms_1_identity = std::make_shared<opset5::Multiply>(nms->output(1), opset5::Constant::create(ngPrc, Shape{1}, {1}));
|
||||
auto nms_2_identity = std::make_shared<opset5::Multiply>(nms->output(2), opset5::Constant::create(outType, Shape{1}, {1}));
|
||||
function = std::make_shared<Function>(OutputVector{nms_0_identity, nms_1_identity, nms_2_identity}, params, "NMS");
|
||||
}
|
||||
|
||||
TEST_P(NmsLayerTest, CompareWithRefs) {
|
||||
|
||||
@@ -174,30 +174,6 @@ xfail_issue_38735 = xfail_test(reason="RuntimeError: nGraph does not support the
|
||||
xfail_issue_38736 = xfail_test(reason="RuntimeError: nGraph does not support the following ONNX operations:"
|
||||
"NegativeLogLikelihoodLoss")
|
||||
|
||||
xfail_issue_42779 = xfail_test(reason="Unsupported dynamic ops:"
|
||||
"v1::TopKIE TopK_6774 (Gather_706[0]:f32{16000}, Unsqueeze_7522[0]:"
|
||||
"i32{1}) -> (f32{?}, i32{?})"
|
||||
"v0::Convert TopK_718.1 (TopK_6774[1]:i32{?}) -> (i32{?})"
|
||||
"v0::GatherIE Gather_733 (Gather_706[0]:f32{16000}, TopK_718.1[0]:"
|
||||
"i32{?}) -> (f32{?})"
|
||||
"v1::Reshape scores (Gather_733[0]:f32{?}, Constant_6852[0]:i32{2})"
|
||||
" -> (f32{1,?})"
|
||||
"v0::Result scores (scores[0]:f32{1,?}) -> (f32{1,?})"
|
||||
"v0::GatherIE Gather_729 (Gather_690[0]:i32{16000}, TopK_718.1[0]:"
|
||||
"i32{?}) -> (i32{?})"
|
||||
"v1::Reshape Unsqueeze_730 (Gather_729[0]:i32{?}, Constant_6854[0]:"
|
||||
"i32{2}) -> (i32{1,?})"
|
||||
"v1::Eltwise labels (Unsqueeze_730[0]:i32{1,?}, Constant_6855[0]:"
|
||||
"i32{}) -> (i32{1,?})"
|
||||
"v0::Result labels (labels[0]:i32{1,?}) -> (i32{1,?})"
|
||||
"v0::GatherIE Gather_720 (Gather_697[0]:i32{16000}, TopK_718.1[0]:"
|
||||
"i32{?}) -> (i32{?})"
|
||||
"v0::GatherIE Gather_727 (Squeeze_719[0]:f32{15130,4}, Gather_720[0]:"
|
||||
"i32{?}) -> (f32{?,4})"
|
||||
"v1::Reshape bboxes (Gather_727[0]:f32{?,4}, Constant_6859[0]:i32{3})"
|
||||
" -> (f32{1,?,4})"
|
||||
"v0::Result bboxes (bboxes[0]:f32{1,?,4}) -> (f32{1,?,4}))")
|
||||
|
||||
# Model ONNX Zoo issues:
|
||||
xfail_issue_36533 = xfail_test(reason="AssertionError: zoo models results mismatch")
|
||||
xfail_issue_39684 = xfail_test(reason="ngraph.exceptions.UserInputError:"
|
||||
|
||||
@@ -37,8 +37,7 @@ from tests import (
|
||||
xfail_issue_38084,
|
||||
xfail_issue_39669,
|
||||
xfail_issue_38726,
|
||||
xfail_issue_40686,
|
||||
xfail_issue_42779)
|
||||
xfail_issue_40686)
|
||||
|
||||
MODELS_ROOT_DIR = tests.MODEL_ZOO_DIR
|
||||
|
||||
@@ -157,7 +156,6 @@ if len(zoo_models) > 0:
|
||||
(xfail_issue_39685, "test_onnx_model_zoo_text_machine_comprehension_roberta_model_roberta_sequence_classification_9_roberta_sequence_classification_9_roberta_sequence_classification_9_cpu"),
|
||||
(xfail_issue_39669, "test_onnx_model_zoo_text_machine_comprehension_t5_model_t5_encoder_12_t5_encoder_cpu"),
|
||||
(xfail_issue_38084, "test_onnx_model_zoo_vision_object_detection_segmentation_mask_rcnn_model_MaskRCNN_10_mask_rcnn_R_50_FPN_1x_cpu"),
|
||||
(xfail_issue_42779, "test_onnx_model_zoo_vision_object_detection_segmentation_ssd_model_ssd_10_model_cpu"),
|
||||
(xfail_issue_38084, "test_onnx_model_zoo_vision_object_detection_segmentation_faster_rcnn_model_FasterRCNN_10_faster_rcnn_R_50_FPN_1x_cpu"),
|
||||
(xfail_issue_41815, "test_onnx_model_zoo_vision_object_detection_segmentation_yolov3_model_yolov3_10_yolov3_yolov3_cpu"),
|
||||
(xfail_issue_41815, "test_onnx_model_zoo_vision_object_detection_segmentation_tiny_yolov3_model_tiny_yolov3_11_yolov3_tiny_cpu"),
|
||||
|
||||
Reference in New Issue
Block a user