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

wrong checkpoint #18

Open
waner1998 opened this issue Oct 1, 2024 · 2 comments
Open

wrong checkpoint #18

waner1998 opened this issue Oct 1, 2024 · 2 comments

Comments

@waner1998
Copy link

Thank you for your wonderful work.
'Encoder. SAM2-UNet applys the Hiera [38] backbone pretrained by SAM2.'
However, I download the checkpoint from 'https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt' in 'https://github.com/facebookresearch/sam2/tree/main/checkpoints', but failed to init the model, can you send me the checkpoint you use in the paper?
My e-mail adress is: [email protected]
Sincerely,

File "F:\seg\SAM2-UNet-main\SAM2-UNet-main\untils.py", line 55, in init_net
return SAM2UNet(checkpoint_path=path)
File "F:\seg\SAM2-UNet-main\SAM2-UNet-main\SAM2UNet.py", line 129, in init
model = build_sam2(model_cfg, checkpoint_path)
File "F:\seg\SAM2-UNet-main\SAM2-UNet-main\sam2\build_sam.py", line 36, in build_sam2
_load_checkpoint(model, ckpt_path)
File "F:\seg\SAM2-UNet-main\SAM2-UNet-main\sam2\build_sam.py", line 82, in _load_checkpoint
missing_keys, unexpected_keys = model.load_state_dict(sd)
File "C:\Users\user.conda\envs\torch\lib\site-packages\torch\nn\modules\module.py", line 2189, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for SAM2Base:
Unexpected key(s) in state_dict: "no_obj_embed_spatial", "obj_ptr_tpos_proj.weight", "obj_ptr_tpos_proj.bias".

@xiongxyowo
Copy link
Collaborator

Hi, it seems that you downloaded the checkpoint of just released SAM2.1 rather than SAM2. Currently, SAM2.1 is not fully compatible with SAM2. You can download the SAM2 checkpoint from here.

@waner1998
Copy link
Author

Thank you for your efficient response, the problem has been solved, thanks! Looking forward to your new contributions in China.

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

2 participants