pytorch collections.OrderedDict';对象没有属性';至';

pytorch collections.OrderedDict';对象没有属性';至';,pytorch,Pytorch,这是我的主要代码,但我不知道如何解决这个问题 device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') model = torch.load('./checkpoints/fcn_model_5.pth') # 加载模型 model = model.to(device) 您正在将检查点作为状态dict加载,它不是nn.module对象 checkpoint='./checkpoints/fcn_model_5.

这是我的主要代码,但我不知道如何解决这个问题

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = torch.load('./checkpoints/fcn_model_5.pth')  # 加载模型
model = model.to(device)

您正在将检查点作为状态dict加载,它不是nn.module对象

checkpoint='./checkpoints/fcn_model_5.pth'
model=您的_model()#torch.nn.Module对象
模型加载\状态指令(火炬加载(检查点))
模型=模型到(设备)

您正在将检查点作为状态dict加载,它不是nn.module对象

checkpoint='./checkpoints/fcn_model_5.pth'
model=您的_model()#torch.nn.Module对象
模型加载\状态指令(火炬加载(检查点))
模型=模型到(设备)

您将检查点作为状态项加载,它不是
nn.module
对象。您将检查点作为状态项加载,它不是
nn.module
对象。