New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A bug in pooling_layer.cpp? #6881
Comments
caffe/src/caffe/layers/pooling_layer.cpp Lines 107 to 118 in 04ab089
You'll fail at line 116 caffe/src/caffe/layers/pooling_layer.cpp Line 116 in 04ab089
Pleas read the code further: caffe/src/caffe/layers/pooling_layer.cpp Lines 168 to 175 in 04ab089
At line 175, |
“if (pad_h_ || pad_w_) ” should be removed!You'll fail at line 116 At line 175, caffe/src/caffe/layers/pooling_layer.cpp Lines 107 to 118 in 04ab089
In this case, you will find that the data at the boundary(the most right/bottom) are invalid(AVE:0.0; MAX:-FLT_MAX). |
@csukuangfj @Noiredd
Issue summary
A bug in pooling_layer.cpp?
original code:
if (pad_h_ || pad_w_) {
// If we have padding, ensure that the last pooling starts strictly
// inside the image (instead of at the padding); otherwise clip the last.`
if ((pooled_height_ - 1) * stride_h_ >= height_ + pad_h_) {
--pooled_height_;
}
if ((pooled_width_ - 1) * stride_w_ >= width_ + pad_w_) {
--pooled_width_;
}
CHECK_LT((pooled_height_ - 1) * stride_h_, height_ + pad_h_);
CHECK_LT((pooled_width_ - 1) * stride_w_, width_ + pad_w_);
}
I think that “if (pad_h_ || pad_w_) ” should be removed!
For example:
Input feature map = hiwi= 66,kernel=1,stride=2,pad=0,round_mode=CEIL;
ho=ceil_div((6+2*0-1) ,2)+1=4
(ho-1)*stride=(4-1)*2=6=hi+pad=6+0
In this case, the 4th output point is out side of the input map, ho/wo must be decreased by 1!
So, “if (pad_h_ || pad_w_) ” should be removed!
The text was updated successfully, but these errors were encountered: