Gaurav Gupta
Gaurav Gupta

Reputation: 1925

differences between Caffe and Keras when applying MAX pooling

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

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

from https://github.com/MarcBS/keras/blob/master/keras/caffe/README.md

Given the differences between Caffe and Keras when applying the MAX pooling opperation, in some occasions the MAX pooling layers must include a pad: 1 value even if they did not include them in their original .prototxt

What exactly is the difference the implementation of MAX pooling between these two frameworks?

Upvotes: 4

Views: 1052

Answers (1)

Gaurav Gupta
Gaurav Gupta

Reputation: 1925

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.

Upvotes: 1

Related Questions