应用MAX池时Caffe和Keras之间的区别 [英] differences between Caffe and Keras when applying MAX pooling
问题描述
我正在一个项目中,将keras json模型转换为caffe prototxt
caffe支持任意填充值
keras(在tensorflow之上)支持'same'和'valid'值
I was working on a project to convert keras json model to caffe prototxt
caffe supports arbitrary padding values
keras (on top of tensorflow) supports 'same' and 'valid' values
对于caffe中的任何填充值,我们可以在keras中手动添加ZeroPadding图层,然后应用有效"方案以获取相同的输出尺寸
For any padding value in caffe, we can manually add ZeroPadding layers in keras and then apply 'valid' scheme to get the same output dimensions
来自
https://github.com/MarcBS/keras/blob/master/keras/caffe/README.md
鉴于在应用MAX池操作时Caffe和Keras之间的差异,在某些情况下,即使MAX池层未将其包含在原始.prototxt中,它们也必须包含
pad: 1
值
这两个框架之间的MAX池实现到底有什么区别?
What exactly is the difference the implementation of MAX pooling between these two frameworks?
推荐答案
池化的实现差异-在keras中,半窗口被丢弃. Caffe将为半窗口提供额外的输出.
填充方案的差异-喀拉斯语中的相同"填充有时会导致上下(或左右)填充值不同. caffe始终在两侧均匀地填充,因此上下(或左右)填充值始终相等.
Differences in implementation of Pooling - In keras, the half-windows are discarded. Caffe will put additional output for half-windows.
Differences in Padding schemes - The 'same' padding in keras can sometimes result in different padding values for top-bottom (or left-right). caffe always pad evenly on both sides so the top-bottom (or left-right) padding values are always equal.
这篇关于应用MAX池时Caffe和Keras之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!