ie_detection_output_layer.hpp
1 // Copyright (C) 2018 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <builders/ie_layer_fragment.hpp>
8 #include <ie_inetwork.hpp>
9 #include <string>
10 #include <vector>
11 
12 namespace InferenceEngine {
13 namespace Builder {
14 
15 /**
16  * @brief The class represents a builder for ArgMax layer
17  */
18 class INFERENCE_ENGINE_API_CLASS(DetectionOutputLayer): public LayerFragment {
19 public:
20  /**
21  * @brief The constructor creates a builder with the name
22  * @param name Layer name
23  */
24  explicit DetectionOutputLayer(const std::string& name = "");
25  /**
26  * @brief The constructor creates a builder from generic builder
27  * @param genLayer generic builder
28  */
29  explicit DetectionOutputLayer(Layer& genLayer);
30  /**
31  * @brief Sets the name for the layer
32  * @param name Layer name
33  * @return reference to layer builder
34  */
35  DetectionOutputLayer& setName(const std::string& name);
36 
37  /**
38  * @brief Returns output port
39  * @return Output port
40  */
41  const Port& getOutputPort() const;
42  /**
43  * @brief Sets output port
44  * @param port Output port
45  * @return reference to layer builder
46  */
47  DetectionOutputLayer& setOutputPort(const Port& port);
48  /**
49  * @brief Returns input ports
50  * @return Vector of input ports
51  */
52  const std::vector<Port>& getInputPorts() const;
53  /**
54  * @brief Sets input ports
55  * @param ports Vector of input ports
56  * @return reference to layer builder
57  */
58  DetectionOutputLayer& setInputPorts(const std::vector<Port>& ports);
59  /**
60  * @brief Returns number of classes
61  * @return Number of classes
62  */
63  size_t getNumClasses() const;
64  /**
65  * @brief Sets number of classes to be predict
66  * @param num Number of classes
67  * @return reference to layer builder
68  */
69  DetectionOutputLayer& setNumClasses(size_t num);
70  /**
71  * @brief Returns background label ID
72  * @return Background ID
73  */
74  int getBackgroudLabelId() const;
75  /**
76  * @brief Sets background label ID
77  * @param labelId Background ID if there is no background class, set it to -1.
78  * @return reference to layer builder
79  */
80  DetectionOutputLayer& setBackgroudLabelId(int labelId);
81  /**
82  * @brief Returns maximum number of results to be kept on NMS stage
83  * @return Top K
84  */
85  int getTopK() const;
86  /**
87  * @brief Sets maximum number of results to be kept on NMS stage
88  * @param topK Top K
89  * @return reference to layer builder
90  */
91  DetectionOutputLayer& setTopK(int topK);
92  /**
93  * @brief Returns number of total boxes to be kept per image after NMS step
94  * @return Keep top K
95  */
96  int getKeepTopK() const;
97  /**
98  * @brief Sets number of total boxes to be kept per image after NMS step
99  * @param topK Keep top K
100  * @return reference to layer builder
101  */
102  DetectionOutputLayer& setKeepTopK(int topK);
103  /**
104  * @brief Returns number of oriented classes
105  * @return Number of oriented classes
106  */
107  int getNumOrientClasses() const;
108  /**
109  * @brief Sets number of oriented classes
110  * @param numClasses Number of classes
111  * @return reference to layer builder
112  */
113  DetectionOutputLayer& setNumOrientClasses(int numClasses);
114  /**
115  * @brief Returns type of coding method for bounding boxes
116  * @return String with code type
117  */
118  std::string getCodeType() const;
119  /**
120  * @brief Sets type of coding method for bounding boxes
121  * @param type Type
122  * @return reference to layer builder
123  */
124  DetectionOutputLayer& setCodeType(std::string type);
125  /**
126  * @brief Returns interpolate orientation
127  * @return Interpolate orientation
128  */
129  int getInterpolateOrientation() const;
130  /**
131  * @brief Sets interpolate orientation
132  * @param orient Orientation
133  * @return reference to layer builder
134  */
135  DetectionOutputLayer& setInterpolateOrientation(int orient);
136  /**
137  * @brief Returns threshold to be used in NMS stage
138  * @return Threshold
139  */
140  float getNMSThreshold() const;
141  /**
142  * @brief Sets threshold to be used in NMS stage
143  * @param threshold NMS threshold
144  * @return reference to layer builder
145  */
146  DetectionOutputLayer& setNMSThreshold(float threshold);
147  /**
148  * @brief Returns confidence threshold
149  * @return Threshold
150  */
151  float getConfidenceThreshold() const;
152  /**
153  * @brief Sets confidence threshold
154  * @param threshold Threshold
155  * @return reference to layer builder
156  */
157  DetectionOutputLayer& setConfidenceThreshold(float threshold);
158  /**
159  * @brief Returns share location
160  * @return true if bounding boxes are shared among different classes
161  */
162  bool getShareLocation() const;
163  /**
164  * @brief Sets share location
165  * @param flag true if bounding boxes are shared among different classes
166  * @return reference to layer builder
167  */
168  DetectionOutputLayer& setShareLocation(bool flag);
169  /**
170  * @brief Returns encoded settings
171  * @return true if variance is encoded in target
172  */
173  bool getVariantEncodedInTarget() const;
174  /**
175  * @brief Sets encoded settings
176  * @param flag true if variance is encoded in target
177  * @return reference to layer builder
178  */
179  DetectionOutputLayer& setVariantEncodedInTarget(bool flag);
180 };
181 
182 } // namespace Builder
183 } // namespace InferenceEngine
Definition: ie_argmax_layer.hpp:11
a header file for the Inference Engine Network interface