deep-learning-models
deep-learning-models copied to clipboard
Are you sure about your ResNet architecture?
Are you sure about your ResNet architecture? In the document https://arxiv.org/pdf/1512.03385.pdf At the beginning of the network we have
x = identity_block(x, 3, [64, 64, 256], stage=2, block='c')
x = identity_block(x, 3, [64, 64, 256], stage=2, block='b')
x = identity_block(x, 3, [64, 64, 256], stage=2, block='c')
But in the resnet50.py
x = conv_block(x, 3, [64, 64, 256], stage=2, block='a', strides=(1, 1))
x = identity_block(x, 3, [64, 64, 256], stage=2, block='b')
x = identity_block(x, 3, [64, 64, 256], stage=2, block='c')
Please explain why so
The implementation of resnet50 is correct in my opinion, though I use my own implementation instead. Note that if you use identity_block for the first layer, your model won't compile (you can give it a try). The reason is very simple: your input x (the 1st 'x' in your code) has 64 filters, and your output of the first block has 256 filters, this prevents you from adding them together due to dimension mismatch. Note that resnet34 is different, for which your 1st block should be identity_block since its output has the same number of filters as its input.