Skip to content

Instantly share code, notes, and snippets.

View zobeirraisi's full-sized avatar
😀

Zobeir Raisi zobeirraisi

😀
View GitHub Profile
@RamonYeung
RamonYeung / loading_pretrained_models
Created July 12, 2018 07:46
PyTorch Loading Pre-trained Models
# 1. Directly Load a Pre-trained Model
# https://github.com/pytorch/vision/tree/master/torchvision/models
import torchvision.models as models
resnet50 = models.resnet50(pretrained=True)
# or
model = models.resnet50(pretrained=False)
# Maybe you want to modify the last fc layer?
resnet.fc = nn.Linear(2048, 2)