qfgaohao / pytorch-ssd

MobileNetV1, MobileNetV2, VGG based SSD/SSD-lite implementation in Pytorch 1.0 / Pytorch 0.4. Out-of-box support for retraining on Open Images dataset. ONNX and Caffe2 support. Experiment Ideas like CoordConv.
https://medium.com/@smallfishbigsea/understand-ssd-and-implement-your-own-caa3232cd6ad
MIT License
1.39k stars 529 forks source link

RuntimeError: Error(s) in loading state_dict for SSD: #153

Open ingbeeedd opened 3 years ago

ingbeeedd commented 3 years ago

I tried to train the raccoon dataset using the pytorch-ssd project. There is only one class in that raccoon dataset, train_ssd.py program's parameter are simply trained with mb1-ssd and so have only '--datasets data/raccon_dataset'

Screenshot from 2021-03-16 12-26-05 Screenshot from 2021-03-16 12-27-52

However, when I tried to make an evaluation with trained model, I had the same problem as above. The parameters of eval_ssd.py are as follows: --net mb1-ssd --dataset data/raccoon_dataset --trained_model models/mb1-ssd-Epoch-29-Loss-2.82726310599934.pth --label_file data/raccoon_dataset/labels.txt

But I finally solved the problem, and found the data label was one raccoonn in program, and I added background to it, and I am wondering if it's right or the underlying cause.

# eval_ssd.py: line 128
class_names = [name.strip() for name in open(args.label_file).readlines()]
class_names.insert(0, 'background')