2 * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved
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 #ifndef __ONERT_BACKEND_CPU_OPS_DPP_H__
18 #define __ONERT_BACKEND_CPU_OPS_DPP_H__
20 #include <exec/IFunction.h>
22 #include "OperationUtils.h"
33 class DetectionPostProcessLayer : public ::onert::exec::IFunction
48 struct DetectionPostProcessParameters
50 const IPortableTensor *boxes_input;
51 const IPortableTensor *scores_input;
52 const IPortableTensor *anchors_input;
53 IPortableTensor *box_coords_output;
54 IPortableTensor *box_classes_output;
55 IPortableTensor *box_scores_output;
56 IPortableTensor *num_selections_output;
57 std::vector<int32_t> boxes_descr;
58 std::vector<int32_t> scrores_descr;
60 uint32_t max_detections;
61 float score_threshold;
62 float iou_threshold; // intersection-over-union
63 uint32_t max_boxes_per_class;
64 bool center_box_format = false;
66 int32_t max_classes_per_detection;
78 int *selections_buffer = nullptr;
79 // TODO move all dynamic allocations here, and into configure phase
82 DetectionPostProcessLayer() : _parameters{}
87 virtual ~DetectionPostProcessLayer();
90 void configure(DetectionPostProcessParameters parameters);
95 DetectionPostProcessParameters _parameters;
97 Allocations _allocations;
102 } // namespace backend
105 #endif // __ONERT_BACKEND_CPU_OPS_DPP_H__