dinglufe / segment-anything-cpp-wrapper

MIT License
221 stars 34 forks source link

MobileSAM onnx model input type? #9

Closed OroChippw closed 1 year ago

OroChippw commented 1 year ago

Thank you for providing such good learning materials. I tried to use the export_pre_model.py file you provided to export the onnx model, and found that the input tensor format is uint8 instead of float32. Use the same method to convert the encoder on the official SAM model. , the input format of the obtained onnx model is float32, is this correct? image

dinglufe commented 1 year ago

There are two ONNX models: one for preprocessing (embedding) and one for inference. The preprocessing model takes input images of type uint8, while the inference model takes the float matrix obtained from preprocessing.

OroChippw commented 1 year ago

There are two ONNX models: one for preprocessing (embedding) and one for inference. The preprocessing model takes input images of type uint8, while the inference model takes the float matrix obtained from preprocessing.

I get it~ I have decoupled the model while converting the input type to float32,But I found that the inference result of mobileSAM is not very well

dinglufe commented 1 year ago

But I found that the inference result of mobileSAM is not very well

Yes, I have noticed that too. I initially thought it was a trade-off for lightweight implementation. However, it might be worth conducting a more detailed comparison using the official test data.