[MO, nGraph, transforms., ref., python] Support DetectionOutput-8 (#8853)
* Implement MO part for DetectionOutput-8 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Implement nGraph part for DetectionOutput-8 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Implement deduction of a number of classes method Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix build Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Implement nGraph tests to check shape inference for DetectionOutput-8 with deduction of num_classes Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Implement attributes tests for DetectionOutput-8 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Remove DetectionOutput-1 from opset8 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Add python bindings for DetectionOutput-8 and tests Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Implement downgrading and upgrading transformations for DetectionOutput Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Implement tests for downgrading and upgrading transformations for DetectionOutput Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Adopt existing reference for DetectionOutput-8 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix DetectionOutput-8 reference Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Add tests for DetectionOutput-8 reference Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Finish resolving merge conflict Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix python bindings after re-structuring Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix BOM package list Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix multibox_detection_test Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix python bindings for DetectionOutput-8 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Insert blank line between summary and description for python binding Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Apply review comments: identation, for loop Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix formatting in python bindings Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix supported_attrs for DetectionOutput from opset1 Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Add missed imports for python if_op Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Apply feedback and fix Win build Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Use the same test suite name for test mixture Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix transformation tests Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Recover BWDCMP_RTTI for legacy use and remove unused variables in tests Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Remove unused variables in type_prop tests Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Recover legacy referenceDetectionOutput constructor Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com> * Fix python binding for DetectionOutput Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
This commit is contained in:
@@ -45,21 +45,21 @@ struct DetectionOutputParams {
|
||||
refData(CreateTensor(iType, oValues)),
|
||||
testcaseName(test_name) {
|
||||
attrs.num_classes = num_classes;
|
||||
attrs.background_label_id = background_label_id;
|
||||
attrs.top_k = top_k;
|
||||
attrs.variance_encoded_in_target = variance_encoded_in_target;
|
||||
attrs.keep_top_k = keep_top_k;
|
||||
attrs.code_type = code_type;
|
||||
attrs.share_location = share_location;
|
||||
attrs.nms_threshold = nms_threshold;
|
||||
attrs.confidence_threshold = confidence_threshold;
|
||||
attrs.clip_after_nms = clip_after_nms;
|
||||
attrs.clip_before_nms = clip_before_nms;
|
||||
attrs.decrease_label_id = decrease_label_id;
|
||||
attrs.normalized = normalized;
|
||||
attrs.input_height = input_height;
|
||||
attrs.input_width = input_width;
|
||||
attrs.objectness_score = objectness_score;
|
||||
attrs_v8.background_label_id = attrs.background_label_id = background_label_id;
|
||||
attrs_v8.top_k = attrs.top_k = top_k;
|
||||
attrs_v8.variance_encoded_in_target = attrs.variance_encoded_in_target = variance_encoded_in_target;
|
||||
attrs_v8.keep_top_k = attrs.keep_top_k = keep_top_k;
|
||||
attrs_v8.code_type = attrs.code_type = code_type;
|
||||
attrs_v8.share_location = attrs.share_location = share_location;
|
||||
attrs_v8.nms_threshold = attrs.nms_threshold = nms_threshold;
|
||||
attrs_v8.confidence_threshold = attrs.confidence_threshold = confidence_threshold;
|
||||
attrs_v8.clip_after_nms = attrs.clip_after_nms = clip_after_nms;
|
||||
attrs_v8.clip_before_nms = attrs.clip_before_nms = clip_before_nms;
|
||||
attrs_v8.decrease_label_id = attrs.decrease_label_id = decrease_label_id;
|
||||
attrs_v8.normalized = attrs.normalized = normalized;
|
||||
attrs_v8.input_height = attrs.input_height = input_height;
|
||||
attrs_v8.input_width = attrs.input_width = input_width;
|
||||
attrs_v8.objectness_score = attrs.objectness_score = objectness_score;
|
||||
|
||||
size_t num_loc_classes = attrs.share_location ? 1 : attrs.num_classes;
|
||||
size_t prior_box_size = attrs.normalized ? 4 : 5;
|
||||
@@ -107,21 +107,21 @@ template <class IT>
|
||||
auxConfData(CreateTensor(iType, auxConfValues)),
|
||||
testcaseName(test_name) {
|
||||
attrs.num_classes = num_classes;
|
||||
attrs.background_label_id = background_label_id;
|
||||
attrs.top_k = top_k;
|
||||
attrs.variance_encoded_in_target = variance_encoded_in_target;
|
||||
attrs.keep_top_k = keep_top_k;
|
||||
attrs.code_type = code_type;
|
||||
attrs.share_location = share_location;
|
||||
attrs.nms_threshold = nms_threshold;
|
||||
attrs.confidence_threshold = confidence_threshold;
|
||||
attrs.clip_after_nms = clip_after_nms;
|
||||
attrs.clip_before_nms = clip_before_nms;
|
||||
attrs.decrease_label_id = decrease_label_id;
|
||||
attrs.normalized = normalized;
|
||||
attrs.input_height = input_height;
|
||||
attrs.input_width = input_width;
|
||||
attrs.objectness_score = objectness_score;
|
||||
attrs_v8.background_label_id = attrs.background_label_id = background_label_id;
|
||||
attrs_v8.top_k = attrs.top_k = top_k;
|
||||
attrs_v8.variance_encoded_in_target = attrs.variance_encoded_in_target = variance_encoded_in_target;
|
||||
attrs_v8.keep_top_k = attrs.keep_top_k = keep_top_k;
|
||||
attrs_v8.code_type = attrs.code_type = code_type;
|
||||
attrs_v8.share_location = attrs.share_location = share_location;
|
||||
attrs_v8.nms_threshold = attrs.nms_threshold = nms_threshold;
|
||||
attrs_v8.confidence_threshold = attrs.confidence_threshold = confidence_threshold;
|
||||
attrs_v8.clip_after_nms = attrs.clip_after_nms = clip_after_nms;
|
||||
attrs_v8.clip_before_nms = attrs.clip_before_nms = clip_before_nms;
|
||||
attrs_v8.decrease_label_id = attrs.decrease_label_id = decrease_label_id;
|
||||
attrs_v8.normalized = attrs.normalized = normalized;
|
||||
attrs_v8.input_height = attrs.input_height = input_height;
|
||||
attrs_v8.input_width = attrs.input_width = input_width;
|
||||
attrs_v8.objectness_score = attrs.objectness_score = objectness_score;
|
||||
|
||||
size_t num_loc_classes = attrs.share_location ? 1 : attrs.num_classes;
|
||||
size_t prior_box_size = attrs.normalized ? 4 : 5;
|
||||
@@ -135,6 +135,7 @@ template <class IT>
|
||||
}
|
||||
|
||||
ov::op::v0::DetectionOutput::Attributes attrs;
|
||||
ov::op::v8::DetectionOutput::Attributes attrs_v8;
|
||||
ov::PartialShape locShape;
|
||||
ov::PartialShape confShape;
|
||||
ov::PartialShape priorBoxesShape;
|
||||
@@ -194,10 +195,61 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class ReferenceDetectionOutputV8LayerTest : public testing::TestWithParam<DetectionOutputParams>,
|
||||
public CommonReferenceTest {
|
||||
public:
|
||||
void SetUp() override {
|
||||
auto params = GetParam();
|
||||
function = CreateFunction(params);
|
||||
if ((params.auxLocShape.size() != 0) && (params.auxConfShape.size() != 0))
|
||||
inputData = {params.locData, params.confData, params.priorBoxesData, params.auxConfData, params.auxLocData};
|
||||
else
|
||||
inputData = {params.locData, params.confData, params.priorBoxesData};
|
||||
refOutData = {params.refData};
|
||||
}
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<DetectionOutputParams>& obj) {
|
||||
auto param = obj.param;
|
||||
std::ostringstream result;
|
||||
result << "locShape=" << param.locShape << "_";
|
||||
result << "confShape=" << param.confShape << "_";
|
||||
result << "priorBoxesShape=" << param.priorBoxesShape << "_";
|
||||
if ((param.auxLocShape.size() != 0) && (param.auxConfShape.size() != 0)) {
|
||||
result << "auxLocShape=" << param.locShape << "_";
|
||||
result << "auxConfShape=" << param.confShape << "_";
|
||||
}
|
||||
result << "iType=" << param.inType;
|
||||
if (param.testcaseName != "")
|
||||
result << "_" << param.testcaseName;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
private:
|
||||
static std::shared_ptr<Function> CreateFunction(const DetectionOutputParams& params) {
|
||||
const auto loc = std::make_shared<op::v0::Parameter>(params.inType, params.locShape);
|
||||
const auto conf = std::make_shared<op::v0::Parameter>(params.inType, params.confShape);
|
||||
const auto priorBoxes = std::make_shared<op::v0::Parameter>(params.inType, params.priorBoxesShape);
|
||||
if ((params.auxLocShape.size() != 0) && (params.auxConfShape.size() != 0)) {
|
||||
const auto auxConf = std::make_shared<op::v0::Parameter>(params.inType, params.auxConfShape);
|
||||
const auto auxLoc = std::make_shared<op::v0::Parameter>(params.inType, params.auxLocShape);
|
||||
const auto DetectionOutput =
|
||||
std::make_shared<op::v8::DetectionOutput>(loc, conf, priorBoxes, auxConf, auxLoc, params.attrs_v8);
|
||||
return std::make_shared<ov::Function>(NodeVector{DetectionOutput},
|
||||
ParameterVector{loc, conf, priorBoxes, auxConf, auxLoc});
|
||||
} else {
|
||||
const auto DetectionOutput = std::make_shared<op::v8::DetectionOutput>(loc, conf, priorBoxes, params.attrs_v8);
|
||||
return std::make_shared<ov::Function>(NodeVector{DetectionOutput}, ParameterVector{loc, conf, priorBoxes});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(ReferenceDetectionOutputLayerTest, CompareWithRefs) {
|
||||
Exec();
|
||||
}
|
||||
|
||||
TEST_P(ReferenceDetectionOutputV8LayerTest, CompareWithRefs) {
|
||||
Exec();
|
||||
}
|
||||
|
||||
template <element::Type_t IN_ET>
|
||||
std::vector<DetectionOutputParams> generateDetectionOutputFloatParams() {
|
||||
using T = typename element_type_traits<IN_ET>::value_type;
|
||||
@@ -517,4 +569,9 @@ std::vector<DetectionOutputParams> generateDetectionOutputCombinedParams() {
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_DetectionOutput_With_Hardcoded_Refs, ReferenceDetectionOutputLayerTest,
|
||||
testing::ValuesIn(generateDetectionOutputCombinedParams()), ReferenceDetectionOutputLayerTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_DetectionOutput_With_Hardcoded_Refs,
|
||||
ReferenceDetectionOutputV8LayerTest,
|
||||
testing::ValuesIn(generateDetectionOutputCombinedParams()),
|
||||
ReferenceDetectionOutputV8LayerTest::getTestCaseName);
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user