Qsingle / LearnablePromptSAM

Try to use the SAM-ViT as the backbone to create the learnable prompt for semantic segmentation
Apache License 2.0
77 stars 13 forks source link

The role of variables in code #2

Open SZU-YoonAyU opened 1 year ago

SZU-YoonAyU commented 1 year ago

I'm glad you can open source your code for me to refer to, but I have some questions about variables in the code that I hope you can answer The variable is' checkpoint ', why is it' path to the pre trained weights', and does its role refer to punctuation in the image? If I now have a fundus image and its label, how should I determine 'checkpoint'? Thank you for giving me the opportunity to ask questions. I hope you can reply promptly when you see it. Your sincerely, SY C

Qsingle commented 1 year ago

Thank you for your question, the checkpoint means the state of the model at one specific iteration or epoch. The weights of the SAM can be seen as the checkpoint, and at the inference time, you do not need to give the checkpoint. You only need to load the weights for the model. The following code is one sample for it.

model = PromptSAM("vit_h", checkpoint=None, num_classes=12)
weights = "./sam_vit_h_prompt.pth"
model.load_state_dict(torch.load(weights, map_location="cpu"))