[ONNX FE] Extend ONNX FE for operation GenerateProposals (#12510)

* Create ONNX FrontEnd GenerateProposals op

* Add onnx GP Op validation

* Add batch 2 test

* Improve code readability

.. per review comments

* Fix test model paths

* Use heterogeneous test values
This commit is contained in:
Tomasz Jankowski
2022-08-18 11:26:48 +02:00
committed by GitHub
parent 8b75e8d4b9
commit e24a5b8ac3
10 changed files with 500 additions and 8 deletions

View File

@@ -65,7 +65,7 @@ All proposals of the whole batch are concated image by image, and distinguishabl
* *nms_eta*
* **Description**: eta parameter for adaptive NMS.
* **Range of values**: a floating-point number in close range `[0, 1.0]`.
* **Range of values**: a floating-point number in closed range `[0, 1.0]`.
* **Type**: float
* **Default value**: `1.0`
* **Required**: *no*

View File

@@ -3589,7 +3589,7 @@ template <element::Type_t ET>
bool evaluate(const shared_ptr<op::v9::GenerateProposals>& op,
const HostTensorVector& outputs,
const HostTensorVector& inputs) {
const auto attrs = op->get_attrs();
const auto& attrs = op->get_attrs();
size_t post_nms_count = 0;
if (attrs.post_nms_count < 0) {
@@ -3600,12 +3600,12 @@ bool evaluate(const shared_ptr<op::v9::GenerateProposals>& op,
post_nms_count = static_cast<size_t>(attrs.post_nms_count);
}
const auto output_type = op->get_input_element_type(0);
const auto& output_type = op->get_input_element_type(0);
const auto im_info_shape = inputs[0]->get_shape();
const auto anchors_shape = inputs[1]->get_shape();
const auto deltas_shape = inputs[2]->get_shape();
const auto scores_shape = inputs[3]->get_shape();
const auto& im_info_shape = inputs[0]->get_shape();
const auto& anchors_shape = inputs[1]->get_shape();
const auto& deltas_shape = inputs[2]->get_shape();
const auto& scores_shape = inputs[3]->get_shape();
const auto im_info_data = get_floats(inputs[0], im_info_shape);
const auto anchors_data = get_floats(inputs[1], anchors_shape);
@@ -3639,7 +3639,7 @@ bool evaluate(const shared_ptr<op::v9::GenerateProposals>& op,
outputs[1]->set_element_type(output_type);
outputs[1]->set_shape(output_scores_shape);
const auto roi_num_type = op->get_output_element_type(2);
const auto& roi_num_type = op->get_output_element_type(2);
Shape output_roi_num_shape = Shape{im_info_shape[0]};
outputs[2]->set_element_type(roi_num_type);
outputs[2]->set_shape(output_roi_num_shape);