Open BaiCHao12 opened 3 months ago
how to convert model to onnx or trt?
me too,i need .onnx to use onnxruntime on c++ :-)
I have only converted the image predictor, but here is a Colab notebook with the conversion script: https://colab.research.google.com/drive/1tqdYbjmFq4PK3Di7sLONd0RkKS0hBgId?usp=sharing
And here repository to test the converted models: https://github.com/ibaiGorordo/ONNX-SAM2-Segment-Anything
Thank you,I want to input box
There are some issues converting the video version. More details at https://github.com/facebookresearch/segment-anything-2/issues/186
I am learning how to convert pt models to onnx and trt models, but I don't know where to start and how to dissect the model structure. Can anyone teach me?
I am learning how to convert pt models to onnx and trt models, but I don't know where to start and how to dissect the model structure. Can anyone teach me?
.pt is essentially a dict, and you can read all the keys of the dict, which are usually the modules used. for instance: Sam_2hiera_tiny. pt contains "image_decoder", "memory_attention", "memory_decoder", "prompt_decoder",“Mask_decoder "," obj_ptr_dej "," mask_downsample ". You can export these modules as separate .pt files and export them independently as onnx, or you can directly use sam_2hiera_tiny. pt to export onnx for different modules Please refer to it later https://github.com/Aimol-l/SAM2Export.git (Although memory'attention. onnx cannot be successfully exported, the export process is similar) or https://github.com/vietanhdev/samexporter
For the onnx video export see: https://github.com/axinc-ai/segment-anything-2
Can you provide an onnx model