1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 #ifndef ANDROID_PACKAGES_MODULES_NEURALNETWORKS_COMMON_TYPES_OPERATIONS_GENERATE_PROPOSALS_H 18 #define ANDROID_PACKAGES_MODULES_NEURALNETWORKS_COMMON_TYPES_OPERATIONS_GENERATE_PROPOSALS_H 19 20 #include "OperationsValidationUtils.h" 21 22 namespace android::nn::bbox_ops { 23 24 namespace axis_aligned_bbox_transform { 25 26 constexpr char kOperationName[] = "AXIS_ALIGNED_BBOX_TRANSFORM"; 27 28 constexpr uint32_t kNumInputs = 4; 29 constexpr uint32_t kRoiTensor = 0; 30 constexpr uint32_t kDeltaTensor = 1; 31 constexpr uint32_t kBatchesTensor = 2; 32 constexpr uint32_t kImageInfoTensor = 3; 33 34 constexpr uint32_t kNumOutputs = 1; 35 constexpr uint32_t kOutputTensor = 0; 36 37 } // namespace axis_aligned_bbox_transform 38 39 namespace box_with_nms_limit { 40 41 constexpr char kOperationName[] = "BOX_WITH_NMS_LIMIT"; 42 43 constexpr uint32_t kNumInputs = 9; 44 constexpr uint32_t kScoreTensor = 0; 45 constexpr uint32_t kRoiTensor = 1; 46 constexpr uint32_t kBatchesTensor = 2; 47 constexpr uint32_t kScoreThresholdScalar = 3; 48 constexpr uint32_t kMaxNumDetectionScalar = 4; 49 constexpr uint32_t kNmsKernelScalar = 5; 50 constexpr uint32_t kIoUThresholdScalar = 6; 51 constexpr uint32_t kSigmaScalar = 7; 52 constexpr uint32_t kNmsScoreThresholdScalar = 8; 53 54 constexpr uint32_t kNumOutputs = 4; 55 constexpr uint32_t kOutputScoreTensor = 0; 56 constexpr uint32_t kOutputRoiTensor = 1; 57 constexpr uint32_t kOutputClassTensor = 2; 58 constexpr uint32_t kOutputBatchesTensor = 3; 59 60 } // namespace box_with_nms_limit 61 62 namespace generate_proposals { 63 64 constexpr char kOperationName[] = "GENERATE_PROPOSALS"; 65 66 constexpr uint32_t kNumInputs = 11; 67 constexpr uint32_t kScoreTensor = 0; 68 constexpr uint32_t kDeltaTensor = 1; 69 constexpr uint32_t kAnchorTensor = 2; 70 constexpr uint32_t kImageInfoTensor = 3; 71 constexpr uint32_t kHeightStrideSalar = 4; 72 constexpr uint32_t kWidthStrideScalar = 5; 73 constexpr uint32_t kPreNmsMaxScalar = 6; 74 constexpr uint32_t kPostNmsMaxScalar = 7; 75 constexpr uint32_t kIoUThresholdScalar = 8; 76 constexpr uint32_t kMinSizeScalar = 9; 77 constexpr uint32_t kLayoutScalar = 10; 78 79 constexpr uint32_t kNumOutputs = 3; 80 constexpr uint32_t kOutputScoreTensor = 0; 81 constexpr uint32_t kOutputRoiTensor = 1; 82 constexpr uint32_t kOutputBatchesTensor = 2; 83 84 } // namespace generate_proposals 85 86 namespace detection_postprocess { 87 88 constexpr char kOperationName[] = "DETECTION_POSTPROCESS"; 89 90 constexpr uint32_t kNumInputs = 14; 91 constexpr uint32_t kScoreTensor = 0; 92 constexpr uint32_t kDeltaTensor = 1; 93 constexpr uint32_t kAnchorTensor = 2; 94 constexpr uint32_t kScaleYScalar = 3; 95 constexpr uint32_t kScaleXScalar = 4; 96 constexpr uint32_t kScaleHScalar = 5; 97 constexpr uint32_t kScaleWScalar = 6; 98 constexpr uint32_t kUseRegularNmsScalar = 7; 99 constexpr uint32_t kMaxNumDetectionScalar = 8; 100 constexpr uint32_t kMaxClassesPerDetectionScalar = 9; 101 constexpr uint32_t kMaxNumDetectionPerClassScalar = 10; 102 constexpr uint32_t kScoreThresholdScalar = 11; 103 constexpr uint32_t kIoUThresholdScalar = 12; 104 constexpr uint32_t kIsBGInLabelScalar = 13; 105 106 constexpr uint32_t kNumOutputs = 4; 107 constexpr uint32_t kOutputScoreTensor = 0; 108 constexpr uint32_t kOutputRoiTensor = 1; 109 constexpr uint32_t kOutputClassTensor = 2; 110 constexpr uint32_t kOutputDetectionTensor = 3; 111 112 } // namespace detection_postprocess 113 114 } // namespace android::nn::bbox_ops 115 116 #endif // ANDROID_PACKAGES_MODULES_NEURALNETWORKS_COMMON_TYPES_OPERATIONS_GENERATE_PROPOSALS_H 117