keras-applications icon indicating copy to clipboard operation
keras-applications copied to clipboard

The stride position in resnet_common.py / resnet50.py

Open lucienne999 opened this issue 4 years ago • 1 comments

Summary

Environment

  • Python version: 3.6.9
  • Keras version: 2.2.4-tf
  • Keras-applications version:1.0.8
  • Keras backend with version: TF 2.0

Logs or source codes for reproduction

https://github.com/keras-team/keras-applications/blob/976050c468ff949bcbd9b9cf64fe1d5c81db3f3a/keras_applications/resnet_common.py#L90 This means you are using the first conv(kernel size=1) to upsample, resulting in large information loss. And the better method is implemented in pytorch: https://pytorch.org/docs/stable/_modules/torchvision/models/resnet.html. Hoping it can be improved or explained in codes.

lucienne999 avatar Dec 10 '19 07:12 lucienne999

Hi there, The link provided by @LicharYuan seems to be revoked, but the following link is the PyTorch implementation of ResNet https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py

Although the original paper of ResNet was the same as Keras implementation (applying stride=2 for the first Conv1x1), PyTorch implementation sound more reasonable.

Best Regards, Sajjad Rahmani

SajjadRahmani avatar Dec 07 '21 11:12 SajjadRahmani