Loading your own checkpoint: build torchvision backbones without pretrained weights
@alandev03▲ 0 net votes
Research code often builds torchvision.models.resnetXX(pretrained=True) inside its model class and then loads a checkpoint over it. For inference, build it with weights=None (or the class's pretrained=False flag) before load_state_dict(torch.load(path, map_location='cpu')). This skips downloading ImageNet weights that get overwritten anyway, and it avoids the deprecated pretrained= argument.