toandaominh1997 / EfficientDet.Pytorch

Implementation EfficientDet: Scalable and Efficient Object Detection in PyTorch
MIT License
1.44k stars 306 forks source link

When i load pretrained weights to run demo.py,something went wrong. #127

Open frederichen01 opened 4 years ago

frederichen01 commented 4 years ago

I load the efficientnet-b0-355c32eb.pth or efficientnet-b7-dcc49843.pth, the command line print KeyError: 'parser'.More details as fellow, could you help me? Load pretrained Model Traceback (most recent call last): File "demo.py", line 174, in detect = Detect(weights=args.weight) File "demo.py", line 52, in init params = checkpoint['parser'] KeyError: 'parser'

m-petuhov commented 4 years ago

It work for me: just change this lines

params = checkpoint['parser'] 
num_class = params.num_class
network = params.network

to

num_class = checkpoint['num_class']
network = checkpoint['network']

But you can't run efficientnet-b7 with checkpoint_VOC_efficientdet-d1_97.pth, maybe you have checkpoints for efficientdet-d7? If yes, can you share them here?

R4ZZ3 commented 4 years ago

@m-petuhov Can you give example. If I want to run efficientdet-d6 what arguments should I use. I made the replacements you mentioned but still get error:

Traceback (most recent call last): File "demo.py", line 180, in detect = Detect(weights=args.weight) File "demo.py", line 52, in init num_class = checkpoint['num_class'] KeyError: 'num_class'

I tried this: python demo.py --network efficientdet-d6 --weight ./efficientnet-b0-355c32eb.pth --iou_threshold 0.5 --threshold 0.5 --cam ./test_racing.mp4