Sakib1263 / TF-1D-2D-ResNetV1-2-SEResNet-ResNeXt-SEResNeXt

Models supported: ResNet, ResNetV2, SE-ResNet, ResNeXt, SE-ResNeXt [layers: 18, 34, 50, 101, 152] (1D and 2D versions with DEMO for Classification and Regression).
MIT License
42 stars 8 forks source link

conv_block in resnets implementation #2

Closed Pagey closed 2 years ago

Pagey commented 2 years ago

Hey- kudos for the elegant implementation!- I'm having trouble understanding the purpose of these two functions:

def conv_block(inputs, num_filters):

Construct Block of Convolutions without Pooling

# x        : input into the block
# n_filters: number of filters
conv = Conv_1D_Block(inputs, num_filters, 3, 2)
conv = Conv_1D_Block(conv, num_filters, 3, 2)
return conv

def conv_block_bottleneck(inputs, num_filters):

Construct Block of Convolutions without Pooling

# x        : input into the block
# n_filters: number of filters
conv = Conv_1D_Block(inputs, num_filters, 3, 2)
conv = Conv_1D_Block(conv, num_filters, 3, 2)
conv = Conv_1D_Block(conv, num_filters, 3, 2)
return conv

which seem to add 2 or 3 consecutive convolutions with strides of 2 (i.e. they enforce a reduction of 4 or 8 in map sizes) after each block- i don't see evidence to this in the original resnet/resnext papers- which i believe only mentioned that the first convolutions of each blocks be with stride of 2- can you please elaborate on their purpose?

Thanks!

Sakib1263 commented 2 years ago

Hi Pagey,

Yes, your concern is correct, stride length except the first conv block should be equal to 1. All codes have been updated and some new codes have been added.

Regards, Sakib