Pre-Trained Resnet

I’m a newbie looking to run a prediction on a pre-trained resnet50 model like this example in the PyTorch docs. Can be done with fastai’s built in models? For example, can I call xresnet50() followed by model(input_batch)? I did not find any examples in the book.

model = xresnet50(pretrained=True)
output = model(input_batch)

Thanks,
bkoz

Only XResNet50 has a pretrained model, the other XResNets do not have pretrained models yet. Your usage is correct.

Thanks. My code runs w/o errors but the output is not correct for a dog input image. Do I have to somehow disable the gradient function to prevent a model update? Code is at https://colab.research.google.com/github/bkoz/sandbox/blob/main/05-fastai-resnet.ipynb

bkoz

Tyr the resnet50 to be sure. I will not use the xresnet anyway, we are moving to timm models anyway, and you will get pretrained weights for all image models available.