sunggukcha / deeplabs

Deeplabv3(+) for BDD100k drivable area
MIT License
44 stars 5 forks source link

RuntimeError: Error(s) in loading state_dict for DeepLab: Unexpected key(s) #7

Open SAIVENKATARAJU opened 4 years ago

SAIVENKATARAJU commented 4 years ago

Hi i am getting unexpected keys(s) while running the below command.

bs=1 backbone='resnet' dataset='bdd' model='deeplabv3+' norm='gn' save_dir='./prd' resume='/home/ubuntu/deeplabs/resenet152.h5' rm -rf $save_dir mkdir $save_dir python evaluate.py --backbone $backbone --dataset $dataset --model $model --norm $norm --save-dir $save_dir --batch-size $bs --resume $resume --test

``Unexpected key(s) in state_dict: "backbone.layer2.4.conv1.weight", "backbone.layer2.4.bn1.weight", "backbone.layer2.4.bn1.bias", "backbone.layer2.4.conv2.weight", "backbone.layer2.4.bn2.weight", "backbone.layer2.4.bn2.bias", "backbone.layer2.4.conv3.weight", "backbone.layer2.4.bn3.weight", "backbone.layer2.4.bn3.bias", "backbone.layer2.5.conv1.weight", "backbone.layer2.5.bn1.weight", "backbone.layer2.5.bn1.bias", "backbone.layer2.5.conv2.weight", "backbone.layer2.5.bn2.weight", "backbone.layer2.5.bn2.bias", "backbone.layer2.5.conv3.weight", "backbone.layer2.5.bn3.weight", "backbone.layer2.5.bn3.bias", "backbone.layer2.6.conv1.weight", "backbone.layer2.6.bn1.weight", "backbone.layer2.6.bn1.bias", "backbone.layer2.6.conv2.weight", "backbone.layer2.6.bn2.weight", "backbone.layer2.6.bn2.bias", "backbone.layer2.6.conv3.weight", "backbone.layer2.6.bn3.weight", "backbone.layer2.6.bn3.bias", "backbone.layer2.7.conv1.weight", "backbone.layer2.7.bn1.weight", "backbone.layer2.7.bn1.bias", "backbone.layer2.7.conv2.weight", "backbone.layer2.7.bn2.weight", "backbone.layer2.7.bn2.bias", "backbone.layer2.7.conv3.weight", "backbone.layer2.7.bn3.weight", "backbone.layer2.7.bn3.bias", "backbone.layer3.23.conv1.weight", "backbone.layer3.23.bn1.weight", "backbone.layer3.23.bn1.bias", "backbone.layer3.23.conv2.weight", "backbone.layer3.23.bn2.weight", "backbone.layer3.23.bn2.bias", "backbone.layer3.23.conv3.weight", "backbone.layer3.23.bn3.weight", "backbone.layer3.23.bn3.bias", "backbone.layer3.24.conv1.weight", "backbone.layer3.24.bn1.weight", "backbone.layer3.24.bn1.bias", "backbone.layer3.24.conv2.weight", "backbone.layer3.24.bn2.weight", "backbone.layer3.24.bn2.bias", "backbone.layer3.24.conv3.weight", "backbone.layer3.24.bn3.weight", "backbone.layer3.24.bn3.bias", "backbone.layer3.25.conv1.weight", "backbone.layer3.25.bn1.weight", "backbone.layer3.25.bn1.bias", "backbone.layer3.25.conv2.weight", "backbone.layer3.25.bn2.weight", "backbone.layer3.25.bn2.bias", "backbone.layer3.25.conv3.weight", "backbone.layer3.25.bn3.weight", "backbone.layer3.25.bn3.bias", "backbone.layer3.26.conv1.weight", "backbone.layer3.26.bn1.weight", "backbone.layer3.26.bn1.bias", "backbone.layer3.26.conv2.weight", "backbone.layer3.26.bn2.weight", "backbone.layer3.26.bn2.bias", "backbone.layer3.26.conv3.weight", "backbone.layer3.26.bn3.weight", "backbone.layer3.26.bn3.bias", "backbone.layer3.27.conv1.weight", "backbone.layer3.27.bn1.weight", "backbone.layer3.27.bn1.bias", "backbone.layer3.27.conv2.weight", "backbone.layer3.27.bn2.weight", "backbone.layer3.27.bn2.bias", "backbone.layer3.27.conv3.weight", "backbone.layer3.27.bn3.weight", "backbone.layer3.27.bn3.bias", "backbone.layer3.28.conv1.weight", "backbone.layer3.28.bn1.weight", "backbone.layer3.28.bn1.bias", "backbone.layer3.28.conv2.weight", "backbone.layer3.28.bn2.weight", "backbone.layer3.28.bn2.bias", "backbone.layer3.28.conv3.weight", "backbone.layer3.28.bn3.weight", "backbone.layer3.28.bn3.bias", "backbone.layer3.29.conv1.weight", "backbone.layer3.29.bn1.weight", "backbone.layer3.29.bn1.bias", "backbone.layer3.29.conv2.weight", "backbone.layer3.29.bn2.weight", "backbone.layer3.29.bn2.bias", "backbone.layer3.29.conv3.weight", "backbone.layer3.29.bn3.weight", "backbone.layer3.29.bn3.bias", "backbone.layer3.30.conv1.weight", "backbone.layer3.30.bn1.weight", "backbone.layer3.30.bn1.bias", "backbone.layer3.30.conv2.weight", "backbone.layer3.30.bn2.weight", "backbone.layer3.30.bn2.bias", "backbone.layer3.30.conv3.weight", "backbone.layer3.30.bn3.weight", "backbone.layer3.30.bn3.bias", "backbone.layer3.31.conv1.weight", "backbone.layer3.31.bn1.weight", "backbone.layer3.31.bn1.bias", "backbone.layer3.31.conv2.weight", "backbone.layer3.31.bn2.weight", "backbone.layer3.31.bn2.bias", "backbone.layer3.31.conv3.weight", "backbone.layer3.31.bn3.weight", "backbone.layer3.31.bn3.bias", "backbone.layer3.32.conv1.weight", "backbone.layer3.32.bn1.weight", "backbone.layer3.32.bn1.bias", "backbone.layer3.32.conv2.weight", "backbone.layer3.32.bn2.weight", "backbone.layer3.32.bn2.bias", "backbone.layer3.32.conv3.weight", "backbone.layer3.32.bn3.weight", "backbone.layer3.32.bn3.bias", "backbone.layer3.33.conv1.weight", "backbone.layer3.33.bn1.weight", "backbone.layer3.33.bn1.bias", "backbone.layer3.33.conv2.weight", "backbone.layer3.33.bn2.weight", "backbone.layer3.33.bn2.bias", "backbone.layer3.33.conv3.weight", "backbone.layer3.33.bn3.weight", "backbone.layer3.33.bn3.bias", "backbone.layer3.34.conv1.weight", "backbone.layer3.34.bn1.weight", "backbone.layer3.34.bn1.bias", "backbone.layer3.34.conv2.weight", "backbone.layer3.34.bn2.weight", "backbone.layer3.34.bn2.bias", "backbone.layer3.34.conv3.weight", "backbone.layer3.34.bn3.weight", "backbone.layer3.34.bn3.bias", "backbone.layer3.35.conv1.weight", "backbone.layer3.35.bn1.weight", "backbone.layer3.35.bn1.bias", "backbone.layer3.35.conv2.weight", "backbone.layer3.35.bn2.weight", "backbone.layer3.35.bn2.bias", "backbone.layer3.35.conv3.weight", "backbone.layer3.35.bn3.weight", "backbone.layer3.35.bn3.bias". ```

SAIVENKATARAJU commented 4 years ago

If i use strict=False, in self.model.module.load_state_dict i am getting completely blank images in prd folder.

sunggukcha commented 4 years ago

Try to use --color argument as well. You may see coloured (image + prediction combined) image.

SAIVENKATARAJU commented 4 years ago

Hi Thanks for Your reply.

I am getting the following error if i used --color argument

Traceback (most recent call last): File "evaluate.py", line 307, in <module> main() File "evaluate.py", line 302, in main trainer.test() File "evaluate.py", line 144, in test self.vs.predict_color(preds, images, names, self.args.save_dir) File "/home/ubuntu/deeplabs/utils/visualize.py", line 107, in predict_color result[pred==0] = origin[pred==0] IndexError: boolean index did not match indexed array along dimension 0; dimension is 168 but corresponding boolean dimension is 300