experimental_detectron_detection_output.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <cstddef>
8 #include <vector>
9 #include "ngraph/attribute_adapter.hpp"
10 #include "ngraph/op/op.hpp"
11 #include "ngraph/op/util/attr_types.hpp"
12 
13 namespace ngraph
14 {
15  namespace op
16  {
17  namespace v6
18  {
19  /// \brief An operation ExperimentalDetectronDetectionOutput performs
20  /// non-maximum suppression to generate the detection output using
21  /// information on location and score predictions.
22  class NGRAPH_API ExperimentalDetectronDetectionOutput : public Op
23  {
24  public:
25  NGRAPH_RTTI_DECLARATION;
26 
27  /// \brief Structure that specifies attributes of the operation
28  struct Attributes
29  {
30  // specifies score threshold
31  float score_threshold;
32  // specifies NMS threshold
33  float nms_threshold;
34  // specifies maximal delta of logarithms for width and height
35  float max_delta_log_wh;
36  // specifies number of detected classes
37  int64_t num_classes;
38  // specifies maximal number of detections per class
39  int64_t post_nms_count;
40  // specifies maximual number of detections per image
41  size_t max_detections_per_image;
42  // a flag specifies whether to delete background classes or not
43  // `true` means background classes should be deleted,
44  // `false` means background classes shouldn't be deleted.
45  bool class_agnostic_box_regression;
46  // specifies deltas of weights
47  std::vector<float> deltas_weights;
48  };
49 
51  /// \brief Constructs a ExperimentalDetectronDetectionOutput operation.
52  ///
53  /// \param input_rois Input rois
54  /// \param input_deltas Input deltas
55  /// \param input_scores Input scores
56  /// \param input_im_info Input image info
57  /// \param attrs Attributes attributes
59  const Output<Node>& input_deltas,
60  const Output<Node>& input_scores,
61  const Output<Node>& input_im_info,
62  const Attributes& attrs);
63  bool visit_attributes(AttributeVisitor& visitor) override;
64 
65  void validate_and_infer_types() override;
66 
67  std::shared_ptr<Node>
68  clone_with_new_inputs(const OutputVector& new_args) const override;
69  /// \brief Returns attributes of the operation ExperimentalDetectronDetectionOutput
70  const Attributes& get_attrs() const { return m_attrs; }
71 
72  private:
73  Attributes m_attrs;
74  };
75  } // namespace v6
76  } // namespace op
77 } // namespace ngraph
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:59
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Root of all actual ops.
Definition: op.hpp:17
An operation ExperimentalDetectronDetectionOutput performs non-maximum suppression to generate the de...
Definition: experimental_detectron_detection_output.hpp:23
const Attributes & get_attrs() const
Returns attributes of the operation ExperimentalDetectronDetectionOutput.
Definition: experimental_detectron_detection_output.hpp:70
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
ExperimentalDetectronDetectionOutput(const Output< Node > &input_rois, const Output< Node > &input_deltas, const Output< Node > &input_scores, const Output< Node > &input_im_info, const Attributes &attrs)
Constructs a ExperimentalDetectronDetectionOutput operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Structure that specifies attributes of the operation.
Definition: experimental_detectron_detection_output.hpp:29