raghakot / keras-resnet

Residual networks implementation using Keras-1.0 functional API
Other
1.39k stars 617 forks source link

the pool mode issue in the last pool layer #9

Closed GeorgeXia1828 closed 7 years ago

GeorgeXia1828 commented 8 years ago

I noticed that the last layer pool in your network: pool2 = AveragePooling2D(pool_size=(7, 7), strides=(1, 1), border_mode="same")(block4) and I check then the output size will be still 7*7 for the reason mode = "same", However, the output size in the paper is told to be 1, should here to modify the mode = "valid"?

junfenglx commented 8 years ago

Yes, you are right. See the implementation of Keras example: https://github.com/fchollet/keras/blob/master/examples/resnet_50.py#L195

Also the doc says that border_mode="same" only works for TF.

And the visualization of the input_shape of the last dense layer is not correct. It should be (None, 2048), not (None, 100352 = 2048 * 49)

kaonashi-tyc commented 7 years ago

Agree with using VALID in the averaging pooling layer. It seems that this is the default behavior in the CNTK implementation:

https://github.com/Microsoft/CNTK/blob/9d6345b2fa794c38b4f02f71631ea71401b97362/Tests/EndToEndTests/Examples/Image/Miscellaneous/CIFAR-10/03_ResNet/baseline.linux.gpu.txt#L773

raghakot commented 7 years ago

Thanks for pointing that out. fixed