bubbliiiing / yolov4-tiny-pytorch

这是一个YoloV4-tiny-pytorch的源码,可以用于训练自己的模型。
MIT License
787 stars 184 forks source link

RuntimeError: Error(s) in loading state_dict for YoloBody: #34

Closed julingers closed 3 years ago

julingers commented 3 years ago

/home/juling/anaconda3/envs/pythonProject/bin/python /home/juling/PycharmProjects/pythonProject/yolov4-tiny/predict.py Loading weights into state dict... Traceback (most recent call last): File "/home/juling/PycharmProjects/pythonProject/yolov4-tiny/predict.py", line 16, in yolo = YOLO() File "/home/juling/PycharmProjects/pythonProject/yolov4-tiny/yolo.py", line 56, in init self.generate() File "/home/juling/PycharmProjects/pythonProject/yolov4-tiny/yolo.py", line 94, in generate self.net.load_state_dict(state_dict) File "/home/juling/anaconda3/envs/pythonProject/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1223, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for YoloBody: Unexpected key(s) in state_dict: "backbone.resblock_body2.conv1.conv.weight", "backbone.resblock_body2.conv1.bn.weight", "backbone.resblock_body2.conv1.bn.bias", "backbone.resblock_body2.conv1.bn.running_mean", "backbone.resblock_body2.conv1.bn.running_var", "backbone.resblock_body2.conv1.bn.num_batches_tracked", "backbone.resblock_body2.conv2.conv.weight", "backbone.resblock_body2.conv2.bn.weight", "backbone.resblock_body2.conv2.bn.bias", "backbone.resblock_body2.conv2.bn.running_mean", "backbone.resblock_body2.conv2.bn.running_var", "backbone.resblock_body2.conv2.bn.num_batches_tracked", "backbone.resblock_body2.conv3.conv.weight", "backbone.resblock_body2.conv3.bn.weight", "backbone.resblock_body2.conv3.bn.bias", "backbone.resblock_body2.conv3.bn.running_mean", "backbone.resblock_body2.conv3.bn.running_var", "backbone.resblock_body2.conv3.bn.num_batches_tracked", "backbone.resblock_body2.conv4.conv.weight", "backbone.resblock_body2.conv4.bn.weight", "backbone.resblock_body2.conv4.bn.bias", "backbone.resblock_body2.conv4.bn.running_mean", "backbone.resblock_body2.conv4.bn.running_var", "backbone.resblock_body2.conv4.bn.num_batches_tracked".

Process finished with exit code 1 请问博主知道这个是为啥么,卡住半天了。。。

bubbliiiing commented 3 years ago

你是不是不小心删了resblock_body2这行啊。

julingers commented 3 years ago

你是不是不小心删了resblock_body2这行啊。

啊博主我太崇拜你了!

bubbliiiing commented 3 years ago

啊着