-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrotate_roi_align_layer.cpp
61 lines (48 loc) · 1.67 KB
/
rotate_roi_align_layer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <cfloat>
#include <cmath>
#include "caffe/rotate_pool.hpp"
using std::max;
using std::min;
using std::floor;
using std::ceil;
namespace caffe {
template <typename Dtype>
void RotateROIAlignLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
RotateROIAlignParameter rotate_align_param = this->layer_param_.rotate_align_param();
CHECK_GT(rotate_align_param.pooled_h(), 0)
<< "pooled_h must be > 0";
CHECK_GT(rotate_align_param.pooled_w(), 0)
<< "pooled_w must be > 0";
pooled_height_ = rotate_align_param.pooled_h();
pooled_width_ = rotate_align_param.pooled_w();
spatial_scale_ = rotate_align_param.spatial_scale();
LOG(INFO) << "Spatial scale: " << spatial_scale_;
}
template <typename Dtype>
void RotateROIAlignLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
channels_ = bottom[0]->channels();
height_ = bottom[0]->height();
width_ = bottom[0]->width();
top[0]->Reshape(bottom[1]->num(), channels_, pooled_height_,
pooled_width_);
max_idx.Reshape(bottom[1]->num(), channels_, pooled_height_,
pooled_width_);
}
template <typename Dtype>
void RotateROIAlignLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
NOT_IMPLEMENTED;
}
template <typename Dtype>
void RotateROIAlignLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {
NOT_IMPLEMENTED;
}
#ifdef CPU_ONLY
STUB_GPU(RotateROIAlignLayer);
#endif
INSTANTIATE_CLASS(RotateROIAlignLayer);
REGISTER_LAYER_CLASS(RotateROIAlign);
} // namespace caffe