Follow up post after yesterday post on Lobe, and today focusing on ONNX and C# code. And, it all started because someone asked in twitter about an ETA to export the model to ONNX
I decided to give a try to the TensorFlow to Onnx tool, and it worked great ! (see references). I use the following command to convert my model
python -m tf2onnx.convert --saved-model model --output model.onnx
From the PB exported model from yesterday, and I got my 2 models
And, here I got an amazing surprise. Before I started to write some C# code, I found some NuGet packages available to use
And, after a quick search I found some sample code in GitHub about how to use these packages. So, I pickup the original Code and make a few changes to perform estimations on 2 manual drawings.
Remember my model was trained to analyze drawings and detect: humans, fish and flowers.
I created a new C# Console App and
- copy the generated [model.onnx]
- copy the 2 test files: [fishy.png] and [human.png]
- copy the original [signature.json] file generated on the Lobe TensorFlow export
I edited the [signature.json] file and change the values
- format to onnx
- filename to the generated exported filename
And I was ready to run my code:
And the output is fast and great, as we are used to do with Onnx
Lobe looks great !
More posts in my blog ElBruno.com.