micro-sam icon indicating copy to clipboard operation
micro-sam copied to clipboard

Exporting to ONNX

Open ShreyasFadnavis opened this issue 5 months ago • 2 comments

First, kudos to everyone for all the great work that has gone into building this!

I want to export the end-to-end instance segmentation model to ONNX. As far as I understand, only the decoder part can be exported to ONNX via bioengine, correct?

If so, do you have any guidance on how I can also export the encoder and the watershed component at the end, so that I can run the complete AIS pipeline via ONNX?

Thanks in advance!

ShreyasFadnavis avatar Jun 11 '25 17:06 ShreyasFadnavis

Hi @ShreyasFadnavis ,

thanks for your interest in micro_sam.

We actually haven't implemented an export of the segmentation decoder to ONNX yet, only for the prompt encoder and mask decoder (= the parts of the original SAM model).

But it should be possible to export the segmentation decoder following the same approach as for the other parts, see here and it would make sense to add this.

We are currently to busy with other things to look into this, but if you're interest we would welcome a contribution. Let me know if you're interested in this, then I can provide a few more details.

constantinpape avatar Jun 18 '25 05:06 constantinpape

Hi @constantinpape, thank you for your response! Apologies for my delayed reply. I’m happy to take a shot at it and contribute if that works for you all. Could you please share the details you mentioned above?

ShreyasFadnavis avatar Jul 07 '25 18:07 ShreyasFadnavis