Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segformer checkpoint loading error #3558

Open
BhJia opened this issue Feb 12, 2024 · 1 comment
Open

Segformer checkpoint loading error #3558

BhJia opened this issue Feb 12, 2024 · 1 comment

Comments

@BhJia
Copy link

BhJia commented Feb 12, 2024

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'

I have searched the previous issues and found issue #1303 which fixed the similar problem by uploading the modified models. Would you please checking the checkpoints of Segformer and fix the problem? Thanks a lot!

@BhJia
Copy link
Author

BhJia commented Feb 12, 2024

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.

Joris-Kuehl-TU-Berlin added a commit to Joris-Kuehl-TU-Berlin/mmsegmentation that referenced this issue Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant