Implement ExperimentalDetectronROIFeatureExtractor operation as nGraph op (#3739)

* Commit.

* Written the header file of the nGraph operation ExperimentalDetectronROIFeatureExtractor.

* Started to write cpp-file for the nGraph operation ExperimentalDetectronROIFeatureExtractor.

* Deleted in_ports_count attribute for the MO operation ExperimentalDetectronROIFeatureExtractor.

* Written validate_and_infer_type() method of ngraph::op::v6::ExperimentalDetectronROIFeatureExtractor.

* Code style fixes.

* Code style fixes.

* Small fixes.

* Code style fixes.

* Now operation ExperimentalDetectronROIFeatureExtractor is read as nGraph operation ExperimentalDetectronROIFeatureExtractor.

* Implemented op::v6::ExperimentalDetectronROIFeatureExtractor::clone_with_new_inputs().

* Added macro NGRAPH_OP_SCOPE to the cpp-file of the nGraph operation ExperimentalDetectronROIFeatureExtractor.

* Fixes in some tests.

* Code style fix.

* Fixed yet another test for ExperimentalDetectronROIFeatureExtractor.

* Added tests for reading ExperimentalDetectronROIFeatureExtractor as operation from opset6.

* Added more test for reading ExperimentalDetectronROIFeatureExtractor as operation from opset6.

* Started to write shape infer tests for the nGraph operation ExperimentalDetectronROIFeatureExtractor.

* Corrected ngraph/test/CMakeLists.txt.

* Small changes.

* Code style fix.

* Small fixes.

* Added ctor of ExperimentalDetectronROIFeatureExtractor with NodeVector as argument.

* Added setting the attribute in_ports_count when the MO operation ExperimentalDetectronROIFeatureExtractor is creating in the MO transformation ONNXMaskRCNNTransformation.

* Added shape infer for the second output of the nGraph operation ExperimentalDetectronROIFeatureExtractor.

* Written shape infer tests for nGraph operation ExperimentalDetectronROIFeatureExtractor (case when input shapes are partially dynamic).

* Small fixes.

* Code style fix.

* Deleted redundant &expected_channels.

* Code style fix.

* Small refactoring.

* Small fixes.

* Small changes.

* Small fixes.

* Deleted attribute distribute_rois_between_levels of ExperimentalDetectronROIFeatureExtractoe.

* Deleted attribute preserve_rois_order of ExperimentalDetectronROIFeatureExtractoe.

* Deleted attribute image_id of ExperimentalDetectronROIFeatureExtractoe.

* Now MO generates attribute 'aligned' of ExperimentalDetectronROIFeatureExtractor only with values 'true' or 'false'.

* Small fix.

* Fix in the conversion of the attribute 'aligned' of MO operation ExperimentalDetectronROIFeatureExtractor to string.

* Tabs were replaced by spaces in some XMLs.

* Tabs were replaced by spaces in ngraph_reshape_tests.cpp.

* Fixed copyrights.

* Applied small patch to IREngine from PR https://github.com/openvinotoolkit/openvino/pull/3814.

* Tabs were replaced by spaces in cnn_ngraph_impl_tests.cpp.

* op::v6::ExperimentalDetectronROIFeatureExtractor::validate_and_infer_types() was rewritten using operator & for channels.

* Added tests for input shapes of op::v6::ExperimentalDetectronROIFeatureExtractor in the case when inputs shapes consist of intervals.

* Fixes in test type_prop.detectron_roi_feature_extractor_intervals.
This commit is contained in:
Vladimir Gavrilov authored and GitHub committed 2021-01-20 16:20:54 +03:00
1 parent 562e01843f
commit 318db6eccc
21 files changed
+1403 -351

No files matched your search

@@ -99,13 +99,11 @@ def insert_ExperimentalDetectronROIFeatureExtractor1(graph: Graph, replacement_d
old_output_node = Node(graph, replacement_descriptions['ROIFeatureExtractor1_output'])
input_fpn_head_nodes = [Node(graph, node_id) for node_id in input_fpn_heads]
fpn_roi_align = ExperimentalDetectronROIFeatureExtractor(graph, {'name': 'ROIFeatureExtractor_1',
'distribute_rois_between_levels': 1,
'image_id': 0,
'output_size': 14,
'preserve_rois_order': 1,
'pyramid_scales': int64_array(
[4, 8, 16, 32, 64]),
'sampling_ratio': 2, }).create_node()
'sampling_ratio': 2,
'in_ports_count': 5}).create_node()
fpn_roi_align.in_port(0).connect(Node(graph, 'DetectionOutput').out_port(0))
for ind, fpn_node in enumerate(input_fpn_head_nodes):
fpn_roi_align.in_port(ind + 1).connect(fpn_node.out_port(0))
@@ -118,13 +116,11 @@ def insert_ExperimentalDetectronROIFeatureExtractor2(graph: Graph, replacement_d
old_output_node = Node(graph, replacement_descriptions['ROIFeatureExtractor2_output'])
input_fpn_head_nodes = [Node(graph, node_id) for node_id in input_fpn_heads]
fpn_roi_align = ExperimentalDetectronROIFeatureExtractor(graph, {'name': 'ROIFeatureExtractor_2',
'distribute_rois_between_levels': 1,
'image_id': 0,
'output_size': 7,
'preserve_rois_order': 1,
'pyramid_scales': int64_array(
[4, 8, 16, 32, 64]),
'sampling_ratio': 2, }).create_node()
'sampling_ratio': 2,
'in_ports_count': 5}).create_node()
fpn_roi_align.in_port(0).connect(Node(graph, replacement_descriptions['ROIFeatureExtractor2_input']).out_port(0))
for ind, fpn_node in enumerate(input_fpn_head_nodes):
fpn_roi_align.in_port(ind + 1).connect(fpn_node.out_port(0))
@@ -1,5 +1,5 @@
"""
Copyright (c) 2020 Intel Corporation
Copyright (c) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -41,10 +41,7 @@ def insert_experimental_layers(graph: Graph, input_fpn_heads: list, inp: str, ou
input_fpn_head_nodes = [Node(graph, node_id) for node_id in input_fpn_heads]
fpn_roi_align = ExperimentalDetectronROIFeatureExtractor(graph, {'name': output_name,
'distribute_rois_between_levels': 1,
'image_id': 0,
'output_size': 7,
'preserve_rois_order': 1,
'pyramid_scales': int64_array(
[4, 8, 16, 32, 64]),
'sampling_ratio': 2, }).create_node()
@@ -1,5 +1,5 @@
"""
Copyright (C) 2018-2020 Intel Corporation
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,8 +29,6 @@ class ExperimentalDetectronROIFeatureExtractorFrontExtractor(FrontExtractorOp):
def extract(cls, node):
attrs = dict(output_size=onnx_attr(node, 'output_size', 'i', 7),
sampling_ratio=onnx_attr(node, 'sampling_ratio', 'i', 2),
distribute_rois_between_levels=onnx_attr(node, 'distribute_rois_between_levels', 'i', 1),
preserve_rois_order=onnx_attr(node, 'preserve_rois_order', 'i', 1),
aligned=onnx_attr(node, 'aligned', 'i', 0),
num_classes=onnx_attr(node, 'num_classes', 'i', 81),
post_nms_count=onnx_attr(node, 'post_nms_count', 'i', 2000),
@@ -1,5 +1,5 @@
"""
Copyright (C) 2018-2020 Intel Corporation
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,9 +26,8 @@ class ExperimentalDetectronROIFeatureExtractor(Op):
mandatory_props = dict(
type=__class__.op,
op=__class__.op,
version='experimental',
version='opset6',
infer=__class__.infer,
in_ports_count=5,
out_ports_count=2,
)
@@ -36,13 +35,10 @@ class ExperimentalDetectronROIFeatureExtractor(Op):
def backend_attrs(self):
return [
'distribute_rois_between_levels',
('pyramid_scales', lambda node: ','.join(map(str, node['pyramid_scales']))),
'image_id',
'output_size',
'sampling_ratio',
'preserve_rois_order',
'aligned']
('aligned', lambda node: str(bool(node.soft_get('aligned', False))).lower())]
@staticmethod
def infer(node):