1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
7 #include <builders/ie_layer_decorator.hpp>
8 #include <ie_network.hpp>
12 namespace InferenceEngine {
16 * @brief The class represents a builder for ArgMax layer
18 class INFERENCE_ENGINE_API_CLASS(DetectionOutputLayer): public LayerDecorator {
21 * @brief The constructor creates a builder with the name
22 * @param name Layer name
24 explicit DetectionOutputLayer(const std::string& name = "");
26 * @brief The constructor creates a builder from generic builder
27 * @param layer pointer to generic builder
29 explicit DetectionOutputLayer(const Layer::Ptr& layer);
31 * @brief The constructor creates a builder from generic builder
32 * @param layer constant pointer to generic builder
34 explicit DetectionOutputLayer(const Layer::CPtr& layer);
36 * @brief Sets the name for the layer
37 * @param name Layer name
38 * @return reference to layer builder
40 DetectionOutputLayer& setName(const std::string& name);
43 * @brief Returns output port
46 const Port& getOutputPort() const;
48 * @brief Sets output port
49 * @param port Output port
50 * @return reference to layer builder
52 DetectionOutputLayer& setOutputPort(const Port& port);
54 * @brief Returns input ports
55 * @return Vector of input ports
57 const std::vector<Port>& getInputPorts() const;
59 * @brief Sets input ports
60 * @param ports Vector of input ports
61 * @return reference to layer builder
63 DetectionOutputLayer& setInputPorts(const std::vector<Port>& ports);
65 * @brief Returns number of classes
66 * @return Number of classes
68 size_t getNumClasses() const;
70 * @brief Sets number of classes to be predict
71 * @param num Number of classes
72 * @return reference to layer builder
74 DetectionOutputLayer& setNumClasses(size_t num);
76 * @brief Returns background label ID
77 * @return Background ID
79 int getBackgroudLabelId() const;
81 * @brief Sets background label ID
82 * @param labelId Background ID if there is no background class, set it to -1.
83 * @return reference to layer builder
85 DetectionOutputLayer& setBackgroudLabelId(int labelId);
87 * @brief Returns maximum number of results to be kept on NMS stage
92 * @brief Sets maximum number of results to be kept on NMS stage
94 * @return reference to layer builder
96 DetectionOutputLayer& setTopK(int topK);
98 * @brief Returns number of total boxes to be kept per image after NMS step
101 int getKeepTopK() const;
103 * @brief Sets number of total boxes to be kept per image after NMS step
104 * @param topK Keep top K
105 * @return reference to layer builder
107 DetectionOutputLayer& setKeepTopK(int topK);
109 * @brief Returns number of oriented classes
110 * @return Number of oriented classes
112 int getNumOrientClasses() const;
114 * @brief Sets number of oriented classes
115 * @param numClasses Number of classes
116 * @return reference to layer builder
118 DetectionOutputLayer& setNumOrientClasses(int numClasses);
120 * @brief Returns type of coding method for bounding boxes
121 * @return String with code type
123 std::string getCodeType() const;
125 * @brief Sets type of coding method for bounding boxes
127 * @return reference to layer builder
129 DetectionOutputLayer& setCodeType(std::string type);
131 * @brief Returns interpolate orientation
132 * @return Interpolate orientation
134 int getInterpolateOrientation() const;
136 * @brief Sets interpolate orientation
137 * @param orient Orientation
138 * @return reference to layer builder
140 DetectionOutputLayer& setInterpolateOrientation(int orient);
142 * @brief Returns threshold to be used in NMS stage
145 float getNMSThreshold() const;
147 * @brief Sets threshold to be used in NMS stage
148 * @param threshold NMS threshold
149 * @return reference to layer builder
151 DetectionOutputLayer& setNMSThreshold(float threshold);
153 * @brief Returns confidence threshold
156 float getConfidenceThreshold() const;
158 * @brief Sets confidence threshold
159 * @param threshold Threshold
160 * @return reference to layer builder
162 DetectionOutputLayer& setConfidenceThreshold(float threshold);
164 * @brief Returns share location
165 * @return true if bounding boxes are shared among different classes
167 bool getShareLocation() const;
169 * @brief Sets share location
170 * @param flag true if bounding boxes are shared among different classes
171 * @return reference to layer builder
173 DetectionOutputLayer& setShareLocation(bool flag);
175 * @brief Returns encoded settings
176 * @return true if variance is encoded in target
178 bool getVariantEncodedInTarget() const;
180 * @brief Sets encoded settings
181 * @param flag true if variance is encoded in target
182 * @return reference to layer builder
184 DetectionOutputLayer& setVariantEncodedInTarget(bool flag);
187 } // namespace Builder
188 } // namespace InferenceEngine