Jena43
Jena43

Reputation: 85

How to use Tensorflow for Android in Qt (QML) app?

Context

I work on an app for Android which should analyse in real time the camera input. I chose Qt to develop the user interface, for portability reasons (the app may evolve to support other platforms than Android).

For image processing, my colleague is working on it using TensorFlow.

So I want to know how could I use TensorFlow for Android in Qt ?

What I've done :

But for now I'm confused. How should I call it in my Qt App ?

Note : I just noticed that TensorFlow Android interface is aimed only at inference, so no training would be available. (source)

Upvotes: 2

Views: 583

Answers (1)

Jena43
Jena43

Reputation: 85

Well, I think I figured it out !

The QAndroidJniEnvironment & QAndroidJniObject classes from Qt AndroidExtras seems to do all the big work.

Sample instanciation code:

QAndroidJniObject graph ("org/tensorflow/Graph");
QAndroidJniObject inferenceInterface("org/tensorflow/contrib/android/TensorFlowInferenceInterface", "(Lorg/tensorflow/Graph;)V", graph.object());

I know this works because tensorflow now logs data to the Qt console.

Upvotes: 1

Related Questions