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