Closed MRRRKING closed 4 years ago
switch (roundmode) { case PoolingParameter_RoundMode_CEIL: pooledheight = static_cast(ceil(staticcast( height + 2 padh - kernelh) / strideh)) + 1; pooledwidth = static_cast(ceil(staticcast( width + 2 padw - kernelw) / stridew)) + 1; if (height_ % 2 == 1) { pooledheight += 1; } if (width_ % 2 == 1) { pooledwidth += 1; } break; case PoolingParameter_RoundMode_FLOOR: pooledheight = static_cast(floor(staticcast( height + 2 padh - kernelh) / strideh)) + 1; pooledwidth = static_cast(floor(staticcast( width + 2 padw - kernelw) / stridew)) + 1; if (height_ % 2 == 1) { pooledheight += 1; } if (width_ % 2 == 1) { pooledwidth += 1; } break; }
可以在pooling_layer.cpp的Reshape函数中加入几行代码,来对最大池化后map的宽度和高度进行调整以支持yolov3-tiny中的maxpool层(size=2,stride=1)。当然,这样可能只对这种特殊情况有效。 另外,需要对模型转换代码和检测代码做修改。
switch (roundmode) { case PoolingParameter_RoundMode_CEIL: pooledheight = static_cast(ceil(staticcast(
height + 2 padh - kernelh) / strideh)) + 1;
pooledwidth = static_cast(ceil(staticcast(
width + 2 padw - kernelw) / stridew)) + 1;
if (height_ % 2 == 1) {
pooledheight += 1;
}
if (width_ % 2 == 1) {
pooledwidth += 1;
}
break;
case PoolingParameter_RoundMode_FLOOR:
pooledheight = static_cast(floor(staticcast(
height + 2 padh - kernelh) / strideh)) + 1;
pooledwidth = static_cast(floor(staticcast(
width + 2 padw - kernelw) / stridew)) + 1;
if (height_ % 2 == 1) {
pooledheight += 1;
}
if (width_ % 2 == 1) {
pooledwidth += 1;
}
break;
}
可以在pooling_layer.cpp的Reshape函数中加入几行代码,来对最大池化后map的宽度和高度进行调整以支持yolov3-tiny中的maxpool层(size=2,stride=1)。当然,这样可能只对这种特殊情况有效。 另外,需要对模型转换代码和检测代码做修改。