Skip to content
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

似乎可以通过修改caffe代码来支持maxpool层(size=2,stride=1) #31

Closed
MRRRKING opened this issue Mar 15, 2019 · 0 comments
Closed

Comments

@MRRRKING
Copy link

MRRRKING commented Mar 15, 2019

switch (round_mode_) {
case PoolingParameter_RoundMode_CEIL:
pooled_height_ = static_cast(ceil(static_cast(
height_ + 2 * pad_h_ - kernel_h_) / stride_h_)) + 1;
pooled_width_ = static_cast(ceil(static_cast(
width_ + 2 * pad_w_ - kernel_w_) / stride_w_)) + 1;
if (height_ % 2 == 1) {
pooled_height_ += 1;
}
if (width_ % 2 == 1) {
pooled_width_ += 1;
}

break;
case PoolingParameter_RoundMode_FLOOR:
pooled_height_ = static_cast(floor(static_cast(
height_ + 2 * pad_h_ - kernel_h_) / stride_h_)) + 1;
pooled_width_ = static_cast(floor(static_cast(
width_ + 2 * pad_w_ - kernel_w_) / stride_w_)) + 1;
if (height_ % 2 == 1) {
pooled_height_ += 1;
}
if (width_ % 2 == 1) {
pooled_width_ += 1;
}

break;
}

可以在pooling_layer.cpp的Reshape函数中加入几行代码,来对最大池化后map的宽度和高度进行调整以支持yolov3-tiny中的maxpool层(size=2,stride=1)。当然,这样可能只对这种特殊情况有效。
另外,需要对模型转换代码和检测代码做修改。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants