keras-team / keras-applications

Reference implementations of popular deep learning models.
Other
2k stars 913 forks source link

The stride position in resnet_common.py / resnet50.py #159

Open lucienne999 opened 4 years ago

lucienne999 commented 4 years ago

Summary

Environment

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.

SajjadRahmani commented 2 years ago

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