Unexpected key(s) in state_dict

训练多层网络后测试

报错.

RuntimeError: Error(s) in loading state_dict for Net_Atv:
	Unexpected key(s) in state_dict: "net.30.conv1.weight",
	 "net.30.conv1.bias", "net.30.conv2.weight", "net.30.conv2.bias", "net.30.conv3.weight", "net.30.conv3.bias", "net.30.conv4.weight",
	  "net.30.conv4.bias", "net.31.conv1.weight", "net.31.conv1.bias", "net.31.conv2.weight", "net.31.conv2.bias", "net.31.conv3.weight", 
	  "net.31.conv3.bias", "net.31.conv4.weight", "net.31.conv4.bias", 
	  "net.32.conv1.weight", "net.32.conv1.bias", "net.32.conv2.weight", "net.32.conv2.bias", "net.32.conv3.weight", "net.32.conv3.bias",
	   "net.32.conv4.weight", "net.32.conv4.bias", "net.33.conv1.weight", 
	  "net.33.conv1.bias", "net.33.conv2.weight", "net.33.conv2.bias", "net.33.conv3.weight", "net.33.conv3.bias", "net.33.conv4.weight", 
	  "net.33.conv4.bias", "net.34.conv1.weight", "net.34.conv1.bias", "net.34.conv2.weight", "net.34.conv2.bias", "net.34.conv3.weight", 
	  "net.34.conv3.bias", "net.34.conv4.weight", "net.34.conv4.bias", "net.35.conv1.weight", "net.35.conv1.bias", "net.35.conv2.weight", 
	  "net.35.conv2.bias", "net.35.conv3.weight", "net.35.conv3.bias", "net.35.conv4.weight", "net.35.conv4.bias", "net.36.conv1.weight",
	   "net.36.conv1.bias", "net.36.conv2.weight", "net.36.conv2.bias", "net.36.conv3.weight", "net.36.conv3.bias", "net.36.conv4.weight", 
	   "net.36.conv4.bias", "net.37.conv1.weight", "net.37.conv1.bias", "net.37.conv2.weight", "net.37.conv2.bias", "net.37.conv3.weight",
	    "net.37.conv3.bias", "net.37.conv4.weight", "net.37.conv4.bias", 
	   "net.38.conv1.weight", "net.38.conv1.bias", "net.38.conv2.weight", "net.38.conv2.bias", "net.38.conv3.weight", "net.38.conv3.bias", 
	   "net.38.conv4.weight", "net.38.conv4.bias", "net.39.conv1.weight", "net.39.conv1.bias", "net.39.conv2.weight", "net.39.conv2.bias", 
	   "net.39.conv3.weight", "net.39.conv3.bias", "net.39.conv4.weight", "net.39.conv4.bias". 

测试层数与训练层数不一致,测试层数修改为与模型层数相同,解决。
测试时网络结构与模型结构保持一致。

你可能感兴趣的:(bug记录,Python)