dinglufe / segment-anything-cpp-wrapper

MIT License
221 stars 34 forks source link

mobile sam onnx model does not work #11

Closed julinfn closed 1 year ago

julinfn commented 1 year ago

I've export onnx model ''mobile_sam.onnx" use script provided in mobile sam project,call it use v1.4.1,error msg as follows:

Now click on the image (press q/esc to quit; press c to clear selection; press a to run automatic segmentation) Ctrl+Left click to select foreground, Ctrl+Right click to select background, Middle click and drag to select a region 2023-07-12 10:52:46.2316412 [E:onnxruntime:, sequential_executor.cc:368 onnxruntime::SequentialExecutor::Execute] Non-zero status code returned while running Reshape node. Name:'Reshape_197' Status Message: D:\a\_work\1\s\onnxruntime\core\providers\cpu\tensor\reshape_helper.h:41 onnxruntime::ReshapeHelper::ReshapeHelper gsl::narrow_cast<int64_t>(input_shape.Size()) == size was false. The input tensor cannot be reshaped to the requested shape. Input shape:{1,6,256}, requested shape:{1,10,8,32}

dinglufe commented 1 year ago

Have you tried using the mobile_sam.onnx included in the releases of this project? It is also exported using the official scripts.

julinfn commented 1 year ago

Have you tried using the mobile_sam.onnx included in the releases of this project? It is also exported using the official scripts.

it's ok using the model provided in this project, the model exported by myself is smaller than yours, about 15970KB. i compared the difference between two models in netron, is not complete identical. maybe a problem about pytorch version or other aspect?

julinfn commented 1 year ago

Have you tried using the mobile_sam.onnx included in the releases of this project? It is also exported using the official scripts.

it's ok using the model provided in this project, the model exported by myself is smaller than yours, about 15970KB. i compared the difference between two models in netron, is not complete identical. maybe a problem about pytorch version or other aspect?

it's a problem about pytorch version ,it's ok now,thanks.