Im trying to convert the pretrained model to a onnx model with the following script. However, when i try to import the weights from pretrained pth file i get the following error.
Conversion Script:
import torch
import torch.onnx
from models import resnet
# A model class instance (class not shown)
model = resnet.generate_model(model_depth=18,
n_classes=700,
n_input_channels=3,
shortcut_type="B",
conv1_t_size=7,
conv1_t_stride=1,
no_max_pool=False,
widen_factor=1.0)
# Load the weights from a file (.pth usually)
state_dict = torch.load("r3d18_K_200ep.pth")
# Load the weights now into a model net architecture defined by our class
model.load_state_dict(state_dict)
Im trying to convert the pretrained model to a onnx model with the following script. However, when i try to import the weights from pretrained pth file i get the following error.
Conversion Script:
Error: