更详细的参数解释查阅interp_layer.cpp。
prototxt中的用法:
layer{
bottom:"input"
top:"output"
name:"interp_layer"
type:"Interp"
interp_param{
shrink_factor:4
zoom_factor:3
pad_beg:0
pad_end:0
}
interp_layer.cpp相关片段
#读入图片的高度和宽度
height_in_ = bottom[0]->height();
width_in_ = bottom[0]->width();
#根据设定参数调整后的高度,pad_beg,pad_end只能设置成0及0以下。
height_in_eff_ = height_in_ + pad_beg_ + pad_end_;
width_in_eff_ = width_in_ + pad_beg_ + pad_end_;
#interp的顺序是先缩小,再放大
height_out_ = (height_in_eff_ - 1) / shrink_factor + 1;
width_out_ = (width_in_eff_ - 1) / shrink_factor + 1;
height_out_ = height_out_ + (height_out_ - 1) * (zoom_factor - 1);
width_out_ = width_out_ + (width_out_ - 1) * (zoom_factor - 1);