mazurowski-lab / finetune-SAM

This is an official repo for fine-tuning SAM to customized medical images.
https://arxiv.org/abs/2404.09957
Apache License 2.0
114 stars 17 forks source link

I don't find the args.encoder_adapter_depths to be used in the all projects? #3

Closed ShChen233 closed 4 months ago

ShChen233 commented 4 months ago
args.if_mask_decoder_adapter=True
args.if_encoder_adapter=True
# You can pick the image encoder blocks by adding adapters
args.encoder_adapter_depths = range(0,12)
Guhanxue commented 4 months ago

Hi, i might not fully understand your question here. if you are using encoder_adapter_depth, it means you would like to use Adapter for fine-tune the model; thus for the other fine-tune methods such as only update decoder/ or use LoRA; this args.encoder_adapter_depths is not used.

Also, for different Encoder architecture, you need to edit the args.encoder_adapter_depths accordingly, such as for vit-h, you need to do range(0,32).

If you are asking where in my piece of code i am referring to this args to add Adapters, it is in sam/modeling/image_encoder.py.

image

Generally, it refers to the args.if_encoder_adapter and (self.depth in self.args.encoder_adapter_depths).

Please let me know if this answers your question, and feel free to add additional comments!!

ShChen233 commented 4 months ago

Thank you very much!