Skip to content

mobilenetv2

sngyo edited this page Nov 4, 2019 · 2 revisions
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable

from models.imagenet import mobilenetv2

net = mobilenetv2()
net.load_state_dict(torch.load('pretrained/mobilenetv2_1.0-0c6065bc.pth',map_location=torch.device('cpu')))

x = Variable(torch.randn(1, 3, 224, 224))
torch.onnx.export(net, x, 'mobilenetv2_1.0.onnx', verbose=True, opset_version=10)
Clone this wiki locally