# Bringing up TensorFlow frameworks on the Qualcomm Neural Processing SDK for AI

Source: [https://docs.qualcomm.com/doc/80-63442-4/topic/bringing-up-tensorflow-frameworks.html](https://docs.qualcomm.com/doc/80-63442-4/topic/bringing-up-tensorflow-frameworks.html)

Using MobileNet SSD model for object detection

It is necessary to convert TensorFlow-based models supported by the Snapdragon® Mobile
            Platform .dlc (Deep Learning Container) format before running them on the Qualcomm®
            Neural Processing SDK for AI. To understand some of the issues around that conversion
            process, consider the MobileNet SSD architecture.

## MobileNet SSD and its layers

MobileNet SSD (Single Shot MultiBox Detector) is a small, lightweight neural network
                architecture for object detection. It has already been implemented in both
                TensorFlow and Caffe. Understanding the layers and other features of each framework
                is useful when running them on the Qualcomm Neural Processing SDK.

The Qualcomm® Neural Processing Engine (NPE) in the SDK supports a number of network
                layer types on the CPU, Qualcomm® Adreno™ GPU and Qualcomm® Hexagon™ DSP. Layers
                that are part of the TensorFlow or Caffe frameworks but are not supported by the
                SNPE will cause problems during the attempt to convert them to the .dlc format.

## Bringing up MobileNet SSD on TensorFlow using SNPE

To convert TensorFlow-trained models, SNPE requires three pieces of information:

- Input layer name
- Output layer name
- Input shape

This table provides an example:

| Layers | Shape | Model Size |
| --- | --- | --- |
| **Input Layer:** Preprocessor/sub | 1x300x300x3 | 29.1 MB |
| **Output Layer:**<br>1. detection\_classes<br><br><br>1.<br>                                    detection\_boxes<br><br><br>3. detection\_scores | 1. 1x100<br><br><br>                                <br>2. 1x100<br><br><br>                                <br>3. 1x100 | 29.1 MB |
|  |  |  |

Follow these steps to convert a TensorFlow MobileNet SSD pre-trained model to run on
                SNPE:

1. Run the following commands in the terminal to download and extract the model:
$ wgetCopy to clipboard

    [http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03.tar.gz](http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03.tar.gz)

        $ tar xzvf ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03.tar.gzCopy to clipboard
2. Convert the model to .dlc format, passing the input layer, output layer and
                    input
                    shapes:

        $ snpe-tensorflow-to-dlc –graph /exported/frozen_inference_graph.pb -i Preprocessor/sub 1,300,300,3 –out_node detection_classes –out_node detection_boxes –out_node detection_scores –dlc mobilenet_ssd.dlc –allow_unconsumed_nodesCopy to clipboard

**Parent Topic:** [Artificial Intelligence, Machine Learning, Android and the Qualcomm Neural Processing SDK for AI](https://docs.qualcomm.com/doc/80-63442-4/topic/artificial-qualcomm-neural-processing-sdk.html)

Last Published: Jun 24, 2024

[Previous Topic
Benchmarking the Qualcomm Neural Processing SDK for AI vs. TensorFlow on Android](https://docs.qualcomm.com/bundle/publicresource/80-63442-4/topics/benchmarking-qualcomm-neural-processing-sdk.md) [Next Topic
Setting up the project using the Android Studio IDE and required SDKs](https://docs.qualcomm.com/bundle/publicresource/80-63442-4/topics/setting-up-project-android-studio-ide-and-sdks.md)