TencentARC / DeSRA

Official codes for DeSRA (ICML 2023)
126 stars 0 forks source link

Segformer checkpoint loading error #13

Closed BhJia closed 9 months ago

BhJia commented 9 months ago

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!

BhJia commented 9 months ago

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.