1 #ifndef CAFFE2_OPERATORS_GENERATE_PROPOSALS_OP_H_ 2 #define CAFFE2_OPERATORS_GENERATE_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" 18 : data_(data), dims_(dims) {}
23 const std::vector<int>& dims()
const {
26 int dim(
int i)
const {
27 DCHECK_LE(i, dims_.size());
30 const T* data()
const {
34 return std::accumulate(
35 dims_.begin(), dims_.end(), 1, std::multiplies<size_t>());
39 const T* data_ =
nullptr;
40 std::vector<int> dims_;
48 ERMatXf ComputeAllAnchors(
63 template <
class Context>
66 USE_OPERATOR_CONTEXT_FUNCTIONS;
70 OperatorBase::GetSingleArgument<float>(
"spatial_scale", 1.0 / 16)),
71 feat_stride_(1.0 / spatial_scale_),
73 OperatorBase::GetSingleArgument<int>(
"pre_nms_topN", 6000)),
75 OperatorBase::GetSingleArgument<int>(
"post_nms_topN", 300)),
77 OperatorBase::GetSingleArgument<float>(
"nms_thresh", 0.7f)),
78 rpn_min_size_(OperatorBase::GetSingleArgument<float>(
"min_size", 16)),
79 correct_transform_coords_(OperatorBase::GetSingleArgument<bool>(
80 "correct_transform_coords",
85 bool RunOnDevice()
override;
94 void ProposalsForOneImage(
95 const Eigen::Array3f& im_info,
96 const Eigen::Map<const ERMatXf>& all_anchors,
100 EArrXf* out_probs)
const;
104 float spatial_scale_{1.0};
105 float feat_stride_{1.0};
108 int rpn_pre_nms_topN_{6000};
110 int rpn_post_nms_topN_{300};
112 float rpn_nms_thresh_{0.7};
114 float rpn_min_size_{16};
118 bool correct_transform_coords_{
false};
123 #endif // CAFFE2_OPERATORS_GENERATE_PROPOSALS_OP_H_
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...