zylo117 / Yet-Another-EfficientDet-Pytorch

The pytorch re-implement of the official efficientdet with SOTA performance in real time and pretrained weights.
GNU Lesser General Public License v3.0
5.2k stars 1.27k forks source link

I just encountered a problem when pulling the code and running the test file. #751

Closed freedomspiritJohn closed 8 months ago

freedomspiritJohn commented 8 months ago
D:\DEV\Anaconda3\envs\ef2\python.exe D:\DEV\PythonProgram\Yet-Another-EfficientDet-Pytorch\efficientdet_test.py 
Traceback (most recent call last):
  File "D:\DEV\PythonProgram\Yet-Another-EfficientDet-Pytorch\efficientdet_test.py", line 61, in <module>
    model.load_state_dict(torch.load(f'weights/efficientdet-d{compound_coef}.pth', map_location='cpu'))
  File "D:\DEV\Anaconda3\envs\ef2\Lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for EfficientDetBackbone:
    size mismatch for classifier.header.pointwise_conv.conv.weight: copying a param with shape torch.Size([18, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([810, 64, 1, 1]).
    size mismatch for classifier.header.pointwise_conv.conv.bias: copying a param with shape torch.Size([18]) from checkpoint, the shape in current model is torch.Size([810]).

Process finished with exit code 1

I don't know what to modify, can someone tell me where I went wrong?

freedomspiritJohn commented 8 months ago

Pretrained weight file download error