Search code examples
pythonconv-neural-networkpytorchpre-trained-modeltorchvision

How to load pretrained googlenet model in pytorch


I'm trying to finetune a GoogleNet network over a specific dataset but I'm having trouble loading it. What I try now is:

model = torchvision.models.googlenet(pretrained=True)

However I get an error:

AttributeError: module 'torchvision.models' has no attribute 'googlenet'

I have the latest version of torchvision but reinstalled just to be sure, the error is still there.


Solution

  • You can instead use the GoogLeNet inception_v3 model ("Rethinking the Inception Architecture for Computer Vision"):

    import torchvision
    google_net = torchvision.models.inception_v3(pretrained=True)