How can l initialize my resnet18 and 50 with ImageNet weights?

Hello,

l would like to train resnet18 and 50 for a specific task from scratch. To do so, l want to initialize my network weights using ImgaNet weights.

How can l do that ?

Thank you

There’re already many resnet in torchvision , you can use it out of the box. just do the following

from torchvision import models
resnet50 = models.resnet50(pretrained=True)
resnet18 = models.resnet18(pretrained=True)
1 Like

Hi @chenglu , in this way : resnet50 = models.resnet50(pretrained=True) it allows just to extract features or we can train a model from scratch using as initialization the learnt weight ?