openmedlab / MedLSAM

MedLSAM: Localize and Segment Anything Model for 3D Medical Images
Apache License 2.0
472 stars 18 forks source link

Pretraining checkpoint #17

Open s1054020 opened 3 months ago

s1054020 commented 3 months ago

After i trained,i put the .tar at vit_load_path.But i get the missing key error when i want to segment other data(like this:Missing key(s) in state_dict: "image_encoder.pos_embed", "image_encoder.patch_embed.proj.weight").Did i forget anything to do?thanks.

LWHYC commented 3 months ago

After i trained,i put the .tar at vit_load_path.But i get the missing key error when i want to segment other data(like this:Missing key(s) in state_dict: "image_encoder.pos_embed", "image_encoder.patch_embed.proj.weight").Did i forget anything to do?thanks. Sorry for the late reply. It seems like you need to extract the medlam weight from tar checkpoint and save it as pth. Then place them at medlam_load_path rather than the vit_load_path. I add a script python train/extract_weights.py -p train/checkpoint/your.tar to do this (change the tar path to your file). It will automatically extract the network weights from the checkpoint and save them as checkpoint/medlam.pth.