-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ref][Core][Opset13] NMSRotated-13 core shell and reference implement…
…ation (#19907) * nms_r_init * Add tests * Update nms refs * Update onnx import * Add nms rotated utils * Remove soft sigma and align constructors * Fix typo * Style apply * Add namespace for iou * Update opset comment * Revert cpu changes * onnx test cleanup * Update input types validation * Align shape_infer boxes * Test update * Fix warning * Temporary evaluate support for tests * Add counterclockwise support * Remove box_encoding attr * Fix clockwise box idx * More tests * Update opset test * Update boxes shape validation * Type prop tests * HostTensor to ov Tensor migration * Update output_type set get output_type_attr * Move setters and getters to cpp * Add visitor test * Cleanup * Remove temp eval * Headers adjustment * use float for division * Fix ref tests run * Tests and style code refactor * Move type check into box_last_dim * Update visitor test namespace * Check input type loop * Remove nms_rotated namespace and rename ref function * avoid copies in filling output tensor * Update shape var name * remove static from riou func * Update nms_rot utils * Move nms rot util to ov reference namespace * use std::cos and std:::sin * Update struct name * Explain usage of postprocessing * Update element type desc in error message * Add more comments * Adjust rotated util float types * Fix name conflicts and warnings * Update opset test ops number * Move int input check to the loop * Short box_def_size init * Move remove static_output from shape_infer params * Align float zero * Update third-party-programs * Fix TensorIt for CI * Add op check test
- Loading branch information
Showing
20 changed files
with
2,075 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (C) 2018-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/op/op.hpp" | ||
|
||
namespace ov { | ||
namespace op { | ||
|
||
namespace v13 { | ||
/// \brief NMSRotated operation | ||
/// | ||
class OPENVINO_API NMSRotated : public Op { | ||
public: | ||
OPENVINO_OP("NMSRotated", "opset13", op::Op); | ||
|
||
NMSRotated() = default; | ||
|
||
/// \brief Constructs a NMSRotated operation. | ||
/// | ||
/// \param boxes Node containing the coordinates of the bounding boxes | ||
/// \param scores Node containing the scores of the bounding boxes | ||
/// \param max_output_boxes_per_class Node containing maximum number of boxes to be | ||
/// selected per class | ||
/// \param iou_threshold Node containing intersection over union threshold | ||
/// \param score_threshold Node containing minimum score threshold | ||
/// \param sort_result_descending Specifies whether it is necessary to sort selected | ||
/// boxes across batches | ||
/// \param output_type Specifies the output type of the first and third output | ||
/// \param clockwise Specifies the direction of the rotation | ||
NMSRotated(const Output<Node>& boxes, | ||
const Output<Node>& scores, | ||
const Output<Node>& max_output_boxes_per_class, | ||
const Output<Node>& iou_threshold, | ||
const Output<Node>& score_threshold, | ||
const bool sort_result_descending = true, | ||
const ov::element::Type& output_type = ov::element::i64, | ||
const bool clockwise = true); | ||
|
||
bool visit_attributes(AttributeVisitor& visitor) override; | ||
void validate_and_infer_types() override; | ||
|
||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; | ||
|
||
bool get_sort_result_descending() const; | ||
void set_sort_result_descending(const bool sort_result_descending); | ||
|
||
element::Type get_output_type_attr() const; | ||
void set_output_type_attr(const element::Type& output_type); | ||
|
||
bool get_clockwise() const; | ||
void set_clockwise(const bool clockwise); | ||
|
||
protected: | ||
bool m_sort_result_descending = true; | ||
ov::element::Type m_output_type = ov::element::i64; | ||
bool m_clockwise = true; | ||
}; | ||
} // namespace v13 | ||
} // namespace op | ||
|
||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/core/reference/include/openvino/reference/nms_rotated.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (C) 2018-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/core/shape.hpp" | ||
#include "openvino/reference/non_max_suppression.hpp" | ||
|
||
namespace ov { | ||
namespace reference { | ||
|
||
void nms_rotated(const float* boxes_data, | ||
const Shape& boxes_data_shape, | ||
const float* scores_data, | ||
const Shape& scores_data_shape, | ||
int64_t max_output_boxes_per_class, | ||
float iou_threshold, | ||
float score_threshold, | ||
float soft_nms_sigma, | ||
int64_t* selected_indices, | ||
const Shape& selected_indices_shape, | ||
float* selected_scores, | ||
const Shape& selected_scores_shape, | ||
int64_t* valid_outputs, | ||
bool sort_result_descending, | ||
bool clockwise = true); | ||
|
||
constexpr auto nms_rotated_postprocessing = ov::reference::nms_postprocessing; | ||
|
||
} // namespace reference | ||
} // namespace ov |
Oops, something went wrong.