1
votes

I have been reading this article: https://dhruvs.space/posts/understanding-resnets/ to understand how ResNet50 is built.

I have seen people implementing ResNet50 using the Basic block alone. Like here: https://analyticsindiamag.com/hands-on-guide-to-implement-resnet50-in-pytorch-with-tpu/

However, pytorch implements the ResNet50 using the Bottleneck block (different than the second link but similar to the first link above) https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py is different than what is cited in the article.

Can you build a ResNet50 using pytorch Basic block alone?

1

1 Answers

0
votes

Well, yes you can but I don't think you should or you really need to.

The name ResNet50 means it's a ResNet model with 50 weighted layers.

So from this line of the last link you attached you should have already seen that you can change Bottleneck to BasicBlock.

But it'll be only ResNet34 as the BasicBlock has less layers than Bottleneck so to get an actual ResNet50 you'll need to add 16 more layers which is 8 BasicBlock like [3, 4, 14, 3].

You can even change the number of other stages, as long as the numbers add up to 24 it'll be Resnet50.

But this means you can't use the existing pretrained weights and unless your data is as big as Imagenet it's always better to transfer learning, even if you don't freeze the weights.