keras-team/keras-applications

The stride position in resnet_common.py / resnet50.py

lucienne999 opened this issue · 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

x = layers.Conv2D(filters, 1, strides=stride, name=name + '_1_conv')(x)

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.

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