anilsathyan7 / Portrait-Segmentation

Real-time portrait segmentation for mobile devices
MIT License
638 stars 133 forks source link

How are the SINet.onnx and SINet_Softmax.onnx files created? #39

Closed Ajay-Reva closed 3 years ago

Ajay-Reva commented 3 years ago

I am working on model conversion for different platforms using your repository. This exact SINet.onnx version works (and SINet_Softmax.onnx also works!). The SINet_ONNX.ipynb script exports onnx which I am not able to convert.

How exactly did you create SINet.onnx and SINet_Softmax.onnx?

anilsathyan7 commented 3 years ago

What is the error? I hope you read the note section in the ipynb

Note: The original SINet class file was modified at line 116, i.e x.size() to [int(s) for s in x.size()] . This makes the size value static and prevents error during onnx conversion. Also, some layers like ReduceMax may not be fully supported in opencv onnx runtime, so replace this operation with appropriate reshape and maxpool layers.

Ajay-Reva commented 3 years ago

There was a simple problem of ONNX compatibility with pytorch model. Thanks, it works now.