Can we fine tune Segmentation Anything Model (SAM) in MATLAB?

26 views (last 30 days)
Bo
Bo on 17 Oct 2025 at 19:54
Commented: Bo on 24 Oct 2025 at 19:36
I want to fine tune SAM using our own datasets. I know we can do it in Python. But is there any way to allow me to fine tune it in Matlab? Thanks,
  3 Comments
Bo
Bo about 1 hour ago
Thanks, Sam! I will collect our new dataset with segementation masks, e.g., medical images. Can we in Matlab finetune the existing SAM model by adjusting its model weights? Currently, Matlab only provides SAM as a class object with two functions. Is it possible to allow Matlab users to open it up and fine tune it like other deep neural networks in Matlab?
Sam Chak
Sam Chak about 2 hours ago
Hi @Bo
Since a MathWorks staff member has clarified this matter, you could submit enhancement suggestions on the Product Usage page regarding the aspects or features you would like to see in the Segment Anything Model (SAM).

Sign in to comment.

Answers (1)

Birju Patel
Birju Patel on 24 Oct 2025 at 17:14
As of R2025b, finetuning SAM is not supported. This will be considered for future releases.
You mentioned you were interested in medical images. Try out MedSAM in the Medical Imaging Toolbox as it may work on your images out-of-the-box:
  1 Comment
Bo
Bo 22 minutes ago
Yes, we have tried MedSAM. Thanks for the clarification. Hopefully the funetuning SAM will be available soon. Thanks.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!