Segformer checkpoint loading error
BhJia opened this issue · 1 comments
Hi, I have encoutered a problem while loading the checkpoint of Segformer
model. Specifically, the model and loaded state dict do not match exactly. The error messages are as below:
Loads checkpoint by local backend from path: checkpoints/mit_b5_20220624-658746d9.pth
The model and loaded state dict do not match exactly
unexpected key in source state_dict:.....
missing keys in source state_dict:...
Traceback (most recent call last):
File "demo/artifact_detection.py", line 320, in
main()
File "demo/artifact_detection.py", line 215, in main
model = init_model(args.config, args.checkpoint, device=args.device)
File "mmsegmentation/mmseg/apis/inference.py", line 62, in init_model
dataset_meta = checkpoint['meta'].get('dataset_meta', None)
KeyError: 'meta'
Would you please provide the exact Segformer
checkpoint that works? Thanks a lot!
I have fixed the problem. The reason of it is that the checkpoint provided by the link in the config file may be of another version which is incompatible with the config file. Simply downloading the one provided in the Readme
file in mmsegmentation/configs/segformer
works.