1 #ifndef CAFFE2_OPERATORS_COLLECT_AND_DISTRIBUTE_FPN_RPN_PROPOSALS_OP_H_ 2 #define CAFFE2_OPERATORS_COLLECT_AND_DISTRIBUTE_FPN_RPN_PROPOSALS_OP_H_ 4 #include "caffe2/core/context.h" 5 #include "caffe2/core/operator.h" 6 #include "caffe2/utils/eigen_utils.h" 7 #include "caffe2/utils/math.h" 14 ERArrXXf BoxesArea(
const ERArrXXf& boxes);
18 ERArrXXf MapRoIsToFpnLevels(Eigen::Ref<const ERArrXXf> rois,
19 const float k_min,
const float k_max,
20 const float s0,
const float lvl0);
24 void SortAndLimitRoIsByScores(Eigen::Ref<const EArrXf> scores,
int n,
29 void ArgSort(EArrXi& arr);
33 void RowsWhereRoILevelEquals(Eigen::Ref<const ERArrXXf> rois,
34 const ERArrXXf& lvls,
const int lvl,
35 ERArrXXf* out_filtered, EArrXi* out_indices);
45 template <
class Context>
48 USE_OPERATOR_CONTEXT_FUNCTIONS;
49 template <
class... Args>
53 this->
template GetSingleArgument<int>(
"roi_canonical_scale", 224)),
55 this->
template GetSingleArgument<int>(
"roi_canonical_level", 4)),
57 this->
template GetSingleArgument<int>(
"roi_max_level", 5)),
59 this->
template GetSingleArgument<int>(
"roi_min_level", 2)),
61 this->
template GetSingleArgument<int>(
"rpn_max_level", 6)),
63 this->
template GetSingleArgument<int>(
"rpn_min_level", 2)),
65 this->
template GetSingleArgument<int>(
"rpn_post_nms_topN", 2000)) {
69 "roi_max_level " + c10::to_string(roi_max_level_) +
70 " must be greater than or equal to roi_min_level " +
71 c10::to_string(roi_min_level_) +
".");
75 "rpn_max_level " + c10::to_string(rpn_max_level_) +
76 " must be greater than or equal to rpn_min_level " +
77 c10::to_string(rpn_min_level_) +
".");
80 ~CollectAndDistributeFpnRpnProposalsOp() {}
82 bool RunOnDevice()
override;
86 int roi_canonical_scale_{224};
88 int roi_canonical_level_{4};
90 int roi_max_level_{5};
92 int roi_min_level_{2};
94 int rpn_max_level_{6};
96 int rpn_min_level_{2};
98 int rpn_post_nms_topN_{2000};
103 #endif // CAFFE2_OPERATORS_COLLECT_AND_DISTRIBUTE_FPN_RPN_PROPOSALS_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...