GithubHelp home page GithubHelp logo

Comments (8)

m43 avatar m43 commented on September 16, 2024 1

Correct, to fine-tune SAM-PT, you'd finetune PIPS or SAM or both

from sam-pt.

m43 avatar m43 commented on September 16, 2024 1

Hej, micro-sam uses the same SAM architecture as the original SAM as it uses SAM directly (see here and here). Thus, it must be possible to load the state directly into an instance of SAM with sam_model.load_state_dict(your_model_state).

However, the training checkpoints in micro-sam might be saved in a peculiar way so that they cannot be directly loaded into SAM. What code have you used to save the checkpoint? You might want to try this short snippet out that could convert the micro-sam training checkpoint to a normal SAM checkpoint. I didn't have a training checkpoint to test it with, perhaps you could test if it works well on your side. The cleaned model_state should look something like odict_keys(['image_encoder.pos_embed', 'image_encoder.patch_embed.proj.weight', ... ]).

from sam-pt.

m43 avatar m43 commented on September 16, 2024 1

On a side note, I'd also suggest you try out different point trackers from the repository for your data. For example, you can try using CoTracker instead of PIPs by adding model/point_tracker=cotracker model.positive_points_per_mask=16 to the command line arguments.

I'd also suggest you try varying the number of iterative refinement iterations to better tune the parameter to your fine-tuned SAM checkpoint. You can do so by adding and varying the model.iterative_refinement_iterations=3 command line argument. Cheers!

from sam-pt.

m43 avatar m43 commented on September 16, 2024

Thank you for your interest in training on a custom dataset.

We utilize pre-trained checkpoints provided by the respective authors for all point trackers and SAM variants. If you're keen on training or fine-tuning the models on a custom point tracking or segmentation dataset, I'd advise delving into PIPS and SAM/HQ-SAM.

To give you a brief overview:

  • PIPS is exclusively trained on the synthetic FlyingThings++, derived from the FlyingThings optical flow dataset.
  • SAM was developed using the expansive SA-1B dataset.
  • HQ-SAM training relied on HQSeg-44K.

I hope this helps guide your efforts!

from sam-pt.

MahdiKoochali avatar MahdiKoochali commented on September 16, 2024

Thanks for the quick response.

Regarding your suggestion, in order to fine-tune the sam-pt model, I have to fine-tune both PIPS and SAM(or HQ-SAM) and at last load the obtained checkpoints from both models to run sam-pt, did I get your point?

from sam-pt.

MahdiKoochali avatar MahdiKoochali commented on September 16, 2024

Thanks for your answer.

Can you also explain which repository did you use to fine-tune the SAM?

from sam-pt.

m43 avatar m43 commented on September 16, 2024

Hej @MahdiKoochali, we rely on the original checkpoints provided by the authors and do not perform additional fine-tuning. For SAM, you can download these checkpoints using the instructions provided here. Let us know if you need further assistance!

from sam-pt.

MahdiKoochali avatar MahdiKoochali commented on September 16, 2024

Thank you so much!

I am trying to use SAM-PT on a custom dataset (in the microscopic image domain). Unfortunately, the results were not satisfying in this domain. Regarding your answer earlier, about fine-tuning, I decided to fine-tune SAM.
I used micro-sam and fine-tuned it, but I got the attached error when I wanted to run SAM-PT with my custom checkpoint.

My suspicion is that this error might stem from an incompatibility issue with the SAM models.

It would be perfect if you help me to solve this error or help me to fine-tune SAM.

image

from sam-pt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.