# Run a TensorFlow Lite model using a native TensorFlow Lite sample application

Source: [https://docs.qualcomm.com/doc/80-70014-54/topic/run-a-tensorflow-lite-model-using-a-native-tensorflow-lite-sample-application.html](https://docs.qualcomm.com/doc/80-70014-54/topic/run-a-tensorflow-lite-model-using-a-native-tensorflow-lite-sample-application.html)

You can run TensorFlow Lite models using a sample TensorFlow Lite tool called Label
        Image, which is a part of the TensorFlow repository.

The Label Image tool is cross-compiled as part of Qualcomm® Linux® along with the
            TensorFlow Lite Runtime library, and these artifacts are installed on the target device.

The Label Image tool does the following:

1. Loads a classification TensorFlow Lite model.
2. Performs inference on an image using a delegate to accelerate the model on the
                Qualcomm hardware.

To run a model using the Label Image tool, do the following:

1. To download a sample model, associated labels, and an example image to use with the
                Label Image tool, run the following
                commands:

        ssh root@[ip-addr]
        setenforce 0
        cd /opt/Copy to clipboard

        curl http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz --output /opt/mobilenet_v1_1.0_224_quant.tgzCopy to clipboard

        tar -xvf /opt/mobilenet_v1_1.0_224_quant.tgzCopy to clipboard

        curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz --output  /opt/mobilenet_v1_1.0_224_frozen.tgzCopy to clipboard

        tar -xzf /opt/mobilenet_v1_1.0_224_frozen.tgzCopy to clipboard

        curl https://github.com/sourcecode369/tensorflow-1/tree/master/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp > /opt/grace_hopper.bmpCopy to clipboard
2. To run inference using one of the following delegates, do the following:
    - To run the model on the Arm CPU using the XNNPACK delegate, run the
                        following
                        command:

            label_image -l /opt/mobilenet_v1_1.0_224/labels.txt -I /opt/grace_hopper.bmp -m /opt/mobilenet_v1_1.0_224_quant.tflite -c 10 -p 1 – xnnpack_delegate Copy to clipboard
    - To run the model on the Qualcomm® Adreno™ GPU using the GPU delegate, run
                        the following
                        command:

            label_image -l /opt/mobilenet_v1_1.0_224/labels.txt -I /opt/grace_hopper.bmp -m /opt/mobilenet_v1_1.0_224.tflite -c 10 -p 1 –gl_backend 1Copy to clipboard

**Parent Topic:** Getting started

Last Published: Jul 12, 2024

Previous Topic
 
Run a TensorFlow Lite model using the Gstreamer-based Qualcomm® Intelligent Multimedia SDK (IM SDK) Next Topic

Architecture