experimental_detectron_generate_proposals.hpp
1 //*****************************************************************************
2 // Copyright 2017-2021 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
16 
17 #pragma once
18 
19 #include <cstdint>
20 #include <vector>
21 #include "ngraph/attribute_adapter.hpp"
22 #include "ngraph/op/op.hpp"
23 #include "ngraph/op/util/attr_types.hpp"
24 
25 namespace ngraph
26 {
27  namespace op
28  {
29  namespace v6
30  {
31  /// \brief An operation ExperimentalDetectronGenerateProposalsSingleImage, according to
32  /// the repository https://github.com/openvinotoolkit/training_extensions
33  /// (see pytorch_toolkit/instance_segmentation/segmentoly/rcnn/proposal.py).
35  {
36  public:
37  NGRAPH_RTTI_DECLARATION;
38 
39  /// \brief Structure that specifies attributes of the operation
40  struct Attributes
41  {
42  // minimum box width & height
43  float min_size;
44  // specifies NMS threshold
45  float nms_threshold;
46  // number of top-n proposals after NMS
47  int64_t post_nms_count;
48  // number of top-n proposals before NMS
49  int64_t pre_nms_count;
50  };
51 
53  /// \brief Constructs a ExperimentalDetectronGenerateProposalsSingleImage operation.
54  ///
55  /// \param im_info Input image info
56  /// \param anchors Input anchors
57  /// \param deltas Input deltas
58  /// \param scores Input scores
59  /// \param attrs Operation attributes
61  const Output<Node>& anchors,
62  const Output<Node>& deltas,
63  const Output<Node>& scores,
64  const Attributes& attrs);
65 
66  bool visit_attributes(AttributeVisitor& visitor) override;
67 
68  void validate_and_infer_types() override;
69 
70  std::shared_ptr<Node>
71  clone_with_new_inputs(const OutputVector& new_args) const override;
72 
73  const Attributes& get_attrs() const { return m_attrs; }
74  private:
75  Attributes m_attrs;
76  };
77  }
78  }
79 }
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:71
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Root of all actual ops.
Definition: op.hpp:29
An operation ExperimentalDetectronGenerateProposalsSingleImage, according to the repository https://g...
Definition: experimental_detectron_generate_proposals.hpp:35
ExperimentalDetectronGenerateProposalsSingleImage(const Output< Node > &im_info, const Output< Node > &anchors, const Output< Node > &deltas, const Output< Node > &scores, const Attributes &attrs)
Constructs a ExperimentalDetectronGenerateProposalsSingleImage operation.
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Structure that specifies attributes of the operation.
Definition: experimental_detectron_generate_proposals.hpp:41