Tensorflow/Rust and using pretrained model for prediction

So I have a pretrained model that I would like to load in a program written in Rust for prediction/ image classification. I will not be training anything, I just need it for prediction, so the task should be simple, I think. However, I looked into Tensorflow for Rust and the document is just overwhelming. Is there anyone having some kind of sample code that would load a model into Rust, take in some parameter and provide a prediction?
Thank you.

2 Likes

A quick search in the docs for the world load shows that there's a function SavedModelBundle::load(). Does this seem useful?

Instead of using TensorFlow to evaluate the model you can export the model to a format such as ONNX, TensorFlow, TensorFlow lite or NNEF and then use the tract library to do inferrence:

I don't have a small example myself, but there are some examples in the tract repo.