Exporting model to resnet and then loading it back into the onnx tuntime

 

Sample for the code can be found here. It has code to export resnet50 into an onnx output. Then reloading it back in. When it is reloaded, please note that the input to the model will no longer be pytorch tensor. Instead it will be array. 

https://github.com/mitzen/pytorch_restnet_flask_app

More reference 

If you're curious how 3 x 224 x 244 is obtained, well that's the standard input size for resnet50. You can find references here 

https://www.tensorflow.org/api_docs/python/tf/keras/applications/resnet50/ResNet50

And it is even documented in the paper 

https://arxiv.org/pdf/1512.03385.pdf

If you wanted to have a play with the code here, please refer to this Colab.  You will be able to see how to work with existing model - loaded by pytorch vs loaded by onnx.


https://colab.research.google.com/drive/1o4MmuJBMKZEMWiFY42cz8anW9urKN295#scrollTo=L1BWXN2UDgD1


Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm