2 // Copyright (c) 2016 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 #ifndef DETECTION_OUTPUT_H
19 #define DETECTION_OUTPUT_H
22 /// @addtogroup c_api C API
24 /// @addtogroup c_topology Network Topology
26 /// @addtogroup c_primitives Primitives
33 /// @brief Select method for coding the prior-boxes in Detection Output layer ( @CLDNN_PRIMITIVE_DESC{detection_output} ).
34 typedef enum /*:int32_t*/
36 cldnn_code_type_corner,
37 cldnn_code_type_center_size,
38 cldnn_code_type_corner_size,
39 } cldnn_prior_box_code_type;
41 /// @brief Generates a list of detections based on location and confidence predictions by doing non maximum suppression.
42 /// @details Each row is a 7 dimension vector, which stores: [image_id, label, confidence, xmin, ymin, xmax, ymax].
43 /// If number of detections per image is lower than keep_top_k, will write dummy results at the end with image_id=-1.
44 CLDNN_BEGIN_PRIMITIVE_DESC(detection_output)
45 /// @brief Number of classes to be predicted.
47 /// @brief Number of total bounding boxes to be kept per image after NMS step.
49 /// @brief If not 0, bounding box are shared among different classes.
50 uint32_t share_location;
51 /// @brief Background label id (-1 if there is no background class).
52 int background_label_id;
53 /// @brief Threshold for NMS step.
55 /// @brief Maximum number of results to be kept in NMS.
57 /// @brief Used for adaptive NMS.
59 /// @brief Type of coding method for bounding box. See #cldnn_prior_box_code_type.
61 /// @brief If not 0, variance is encoded in target; otherwise we need to adjust the predicted offset accordingly.
62 uint32_t variance_encoded_in_target;
63 /// @brief Only keep detections with confidences larger than this threshold.
64 float confidence_threshold;
65 /// @brief Number of elements in a single prior description (4 if priors calculated using PriorBox layer, 5 - if Proposal)
66 int32_t prior_info_size;
67 /// @brief Offset of the box coordinates w.r.t. the beginning of a prior info record
68 int32_t prior_coordinates_offset;
69 /// @brief If true, priors are normalized to [0; 1] range.
70 uint32_t prior_is_normalized;
71 /// @brief Width of input image.
73 /// @brief Height of input image.
75 /// @brief Decrease label id to skip background label equal to 0. Can't be used simultaneously with background_label_id.
76 int32_t decrease_label_id;
77 /// @brief Clip decoded boxes right after decoding
78 int32_t clip_before_nms;
79 /// @brief Clip decoded boxes after nms step
80 int32_t clip_after_nms;
81 CLDNN_END_PRIMITIVE_DESC(detection_output)
83 CLDNN_DECLARE_PRIMITIVE_TYPE_ID(detection_output);
92 #endif /* DETECTION_OUTPUT_H */