# Image classification and display with LiteRT

The use cases use the Inceptionv3 LiteRT model to classify scenes from a single camera stream and either overlay or compose the classification labels.

## Use qtivoverlay plugin to apply classification overlay

Run this use case on the target device:

gst-launch-1.0 -e --gst-debug=2 qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! \
    tee name=split split. ! queue ! qtimetamux name=metamux ! queue ! qtivoverlay ! queue ! waylandsink fullscreen=true \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/inception_v3_quantized.tflite ! queue ! \
    qtimlpostprocess settings="{\"confidence\": 40.0}" results=2 module=mobilenet-softmax labels=/etc/labels/classification.json ! text/x-raw ! queue ! metamux.
    Copy to clipboard

To stop the use case, use **CTRL + C**.

The following figure shows the flow of the use case execution:

1. Classify scenes from a video stream coming through a camera source.
2. Overlay the classification labels using overlaylib.
3. Display the results.

<!--?xml version="1.0" encoding="UTF-8"?-->
<svg xmlns="http://www.w3.org/2000/svg" width="755" height="349.974605560302734" viewbox="0 0 755 349.974605560302734" aria-label="../../_images/pipeline_classification_overlay.svg">
  <g id="Layer_1" data-name="Layer 1">
    <g>
      <rect x=".5" y=".499782562255859" width="754" height="348.974609375" rx="7.499999999999944" ry="7.499999999999944" style="fill: #fafafa;"></rect>
      <path d="M747,1c3.85980224609375,0,7,3.140201568603516,7,7v333.974605560302734c0,3.85980224609375-3.14019775390625,7-7,7H8c-3.85980224609375,0-7-3.14019775390625-7-7V8c0-3.859798431396484,3.14019775390625-7,7-7h739M747,0H8C3.581695556640625,0,0,3.581701278686523,0,8v333.974605560302734c0,4.418304443359375,3.581695556640625,8,8,8h739c4.41827392578125,0,8-3.581695556640625,8-8V8c0-4.418298721313477-3.58172607421875-8-8-8h0Z" style="fill: #d2d7e1;"></path>
    </g>
    <g>
      <g>
        <text transform="translate(565.492919921875 326.066066741943359)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Qualcomm </tspan></text>
        <rect x="545.241901596624302" y="313.974590301513672" width="16" height="16" rx="2" ry="2" style="fill: #2a2aea;"></rect>
      </g>
      <g>
        <text transform="translate(664.07470703125 326.066066741943359)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Open source</tspan></text>
        <rect x="643.823683009481101" y="313.974590301513672" width="16" height="16" rx="2" ry="2" style="fill: #007884;"></rect>
      </g>
    </g>
  </g>
  <g id="Layer_2" data-name="Layer 2">
    <g>
      <g>
        <g>
          <rect x="20" y="20.000013072996808" width="160" height="50" rx="4" ry="4" style="fill: #007884;"></rect>
          <text transform="translate(73.429725646972656 48.506713390350342)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">camsrc</tspan></text>
        </g>
        <g>
          <line x1="180" y1="45.000011444091797" x2="199.976654052734375" y2="45.000011444091797" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
          <polygon points="198.955352783203125 48.490444183349609 205 45.000011444091797 198.955352783203125 41.50958251953125 198.955352783203125 48.490444183349609"></polygon>
        </g>
        <g>
          <line x1="285" y1="68.974590301513672" x2="285" y2="88.951229095458984" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
          <polygon points="281.50958251953125 87.929935455322266 285 93.974590301513672 288.49041748046875 87.929935455322266 281.50958251953125 87.929935455322266"></polygon>
        </g>
        <g>
          <rect x="205" y="20.000013072996808" width="160" height="50" rx="4" ry="4" style="fill: #007884;"></rect>
          <text transform="translate(273.910198211669922 48.506713390350342)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">tee</tspan></text>
        </g>
        <g>
          <rect x="205" y="93.97458867261048" width="160" height="50" rx="4" ry="4" style="fill: #2a2aea;"></rect>
          <text transform="translate(229.527484893798828 123.650547027587891)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtimlvconverter</tspan></text>
        </g>
        <g>
          <line x1="285" y1="143.974590301513672" x2="285" y2="163.951229095458984" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
          <polygon points="281.50958251953125 162.929927825927734 285 168.974590301513672 288.49041748046875 162.929927825927734 281.50958251953125 162.929927825927734"></polygon>
        </g>
        <g>
          <rect x="205" y="168.97458867261048" width="160" height="50" rx="4" ry="4" style="fill: #2a2aea;"></rect>
          <text transform="translate(250.820453643798828 198.650554656982422)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtimltflite</tspan></text>
        </g>
        <g>
          <line x1="285" y1="218.974590301513672" x2="285" y2="238.951229095458984" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
          <polygon points="281.50958251953125 237.929927825927734 285 243.974575042724609 288.49041748046875 237.929927825927734 281.50958251953125 237.929927825927734"></polygon>
        </g>
        <g>
          <rect x="205" y="243.97458867261048" width="160" height="49.999999999998181" rx="4" ry="4" style="fill: #2a2aea;"></rect>
          <text transform="translate(222.722797393798828 273.650554656982422)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
        </g>
        <g>
          <line x1="365" y1="45.000011444091797" x2="384.97662353515625" y2="45.000011444091797" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
          <polygon points="383.955322265625 48.490444183349609 390 45.000011444091797 383.955322265625 41.50958251953125 383.955322265625 48.490444183349609"></polygon>
        </g>
        <g>
          <rect x="390" y="20.000013072996808" width="160" height="50" rx="4" ry="4" style="fill: #2a2aea;"></rect>
          <text transform="translate(421.140655517578125 49.675893306732178)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtivcomposer</tspan></text>
        </g>
        <g>
          <line x1="550" y1="45.000011444091797" x2="569.97662353515625" y2="45.000011444091797" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
          <polygon points="568.955322265625 48.490444183349609 575 45.000011444091797 568.955322265625 41.50958251953125 568.955322265625 48.490444183349609"></polygon>
        </g>
        <g>
          <rect x="575" y="20.000013072996808" width="160" height="50" rx="4" ry="4" style="fill: #007884;"></rect>
          <text transform="translate(611.09771728515625 48.506713390350342)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">waylandsink</tspan></text>
        </g>
      </g>
      <g>
        <polyline points="365 271.338314056396484 470 271.338314056396484 470 74.922954559326172" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></polyline>
        <polygon points="473.49041748046875 75.944248199462891 470 69.899593353271484 466.50958251953125 75.944248199462891 473.49041748046875 75.944248199462891"></polygon>
      </g>
    </g>
  </g>
</svg>
**Figure : Pipeline for classification overlay**

The following table provides the sequential processing stages of the pipeline execution:

| Process | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70029-50/topic/qtiqmmfsrc.html) | <ol class="arabic"><br><li><p>Collects the video stream (source) and creates two copies of the source:</p><br><blockquote><br><div><ul class="simple"><br><li><p>One stream is sent to the qtimetamux plugin to retain the video stream.</p></li><br><li><p>The other stream is sent to an ML inferencing pipeline.</p></li><br></ul><br></div></blockquote><br></li><br></ol> |
| **Preprocessing** | **Preprocessing** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70029-50/topic/qtimlvconverter.html) | <ol class="arabic"><br><li><p>Receives the video stream on its sink pad.</p></li><br><li><p>Performs preprocessing:</p><br><blockquote><br><div><ul class="simple"><br><li><p>Color conversion</p></li><br><li><p>Scaling down/up</p></li><br><li><p>Normalization on the stream data when the model expects the floating point values as an input</p></li><br></ul><br></div></blockquote><br></li><br><li><p>Converts the video stream to a tensor stream on its source pad.</p><br><p>The classification model uses this tensor stream for inferencing.</p><br></li><br></ol> |
| **Inferencing** | **Inferencing** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70029-50/topic/qtimltflite.html) | <ol class="arabic simple"><br><li><p>Loads the model.</p></li><br><li><p>Modifies the graph for the chosen delegate.</p></li><br><li><p>Receives the tensor stream on its sinkpad.</p></li><br><li><p>Runs the inference and produces a tensor stream with the inference results on its source pad.</p></li><br></ol> |
| **Postprocessing** | **Postprocessing** |
| qtimlpostprocess | <ol class="arabic"><br><li><p>Receives the inference tensors from a classification model on its sinkpad.</p></li><br><li><p>Converts the tensors into formats such as video or text that the multimedia plugins can process later.</p></li><br><li><p>Applies the threshold to the chosen number of results.</p></li><br><li><p>Loads the corresponding modules of the classification models.</p><br><p>In this use case, qtimlpostprocess does the following:</p><br><blockquote><br><div><ol class="loweralpha simple"><br><li><p>Loads the submodule of the model.</p></li><br><li><p>Produces results as structures of text.</p></li><br><li><p>Sends them to the sinkpad of qtimetamux.</p></li><br></ol><br></div></blockquote><br></li><br></ol> |
| [qtimetamux](https://docs.qualcomm.com/doc/80-70029-50/topic/qtimetamux.html) | <ol class="arabic simple"><br><li><p>Receives the video stream and text stream with classification results corresponding to the video stream on its sinkpads.</p></li><br><li><p>Produces GST buffers with the contents of video stream on its sink pad.</p></li><br><li><p>Adds classification result from data sinkpad to GST buffer meta (meta muxing) on its source pad.</p></li><br></ol> |
| qtivoverlay | <ol class="arabic simple"><br><li><p>Receives the multiplexed stream.</p></li><br><li><p>Overlays the classification labels on the VideoFrame using CL.</p></li><br><li><p>Produces GST buffers with overlays in its source pad.</p></li><br></ol> |
| **Output** | **Output** |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70029-50/topic/waylandsink.html) | <ol class="arabic simple"><br><li><p>Receives the video stream on its sinkpad.</p></li><br><li><p>Submits the video stream to Weston.</p></li><br><li><p>Weston renders the video stream and possible classifications generated for that scene on a local display device.</p></li><br></ol> |

## Use qtivcomposer to mix original frame with classification mask

Run this use case on the target device:

gst-launch-1.0 -e --gst-debug=2 qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! \
    tee name=split split. ! queue ! qtivcomposer name=mixer sink_1::position="<30, 30>" sink_1::dimensions="<480, 480>" ! queue ! waylandsink fullscreen=true \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/inception_v3_quantized.tflite ! queue ! \
    qtimlpostprocess settings="{\"confidence\": 40.0}" results=2 module=mobilenet-softmax labels=/etc/labels/classification.json ! \
    video/x-raw,format=BGRA,width=640,height=480 ! queue ! mixer.
    Copy to clipboard

To stop the use case, select **CTRL + C**.

The following figure shows the flow of the use case execution:

1. Classify scenes from a video stream coming through a camera source.
2. Compose classification labels and video stream using qtivcomposer.
3. Display the results.

<!--?xml version="1.0" encoding="UTF-8"?-->
<svg xmlns="http://www.w3.org/2000/svg" width="755" height="349.974590301513672" viewbox="0 0 755 349.974590301513672" aria-label="../../_images/pipeline_classification_with_qtivecomposer.svg">
  <g id="Layer_1" data-name="Layer 1">
    <g>
      <rect x=".5" y=".499797821044922" width="754" height="348.974609375" rx="7.499999999999944" ry="7.499999999999944" style="fill: #fafafa;"></rect>
      <path d="M747,1c3.85980224609375,0,7,3.140201568603516,7,7v333.974590301513672c0,3.85980224609375-3.14019775390625,7-7,7H8c-3.85980224609375,0-7-3.14019775390625-7-7V8c0-3.859798431396484,3.14019775390625-7,7-7h739M747,0H8C3.581695556640625,0,0,3.581701278686523,0,8v333.974590301513672c0,4.418304443359375,3.581695556640625,8,8,8h739c4.41827392578125,0,8-3.581695556640625,8-8V8c0-4.418298721313477-3.58172607421875-8-8-8h0Z" style="fill: #d2d7e1;"></path>
    </g>
    <g>
      <g>
        <text transform="translate(565.4921875 326.066097259521484)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Qualcomm </tspan></text>
        <rect x="545.241151182821341" y="313.974590301513672" width="16" height="16" rx="2" ry="2" style="fill: #2a2aea;"></rect>
      </g>
      <g>
        <text transform="translate(664.073974609375 326.066097259521484)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Open source</tspan></text>
        <rect x="643.822932595674501" y="313.974590301513672" width="16" height="16" rx="2" ry="2" style="fill: #007884;"></rect>
      </g>
    </g>
  </g>
  <g id="Layer_2" data-name="Layer 2">
    <g>
      <g>
        <rect x="20" y="20.000014873722648" width="160" height="50" rx="4" ry="4" style="fill: #007884;"></rect>
        <text transform="translate(73.429729461669922 48.506718635559082)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">camsrc</tspan></text>
      </g>
      <g>
        <line x1="180" y1="45.000011444091797" x2="199.976654052734375" y2="45.000011444091797" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="198.955352783203125 48.490444183349609 205 45.000011444091797 198.955352783203125 41.50958251953125 198.955352783203125 48.490444183349609"></polygon>
      </g>
      <g>
        <line x1="285" y1="68.974590301513672" x2="285" y2="88.951229095458984" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="281.50958251953125 87.929935455322266 285 93.974590301513672 288.49041748046875 87.929935455322266 281.50958251953125 87.929935455322266"></polygon>
      </g>
      <g>
        <rect x="205" y="20.000014873722648" width="160" height="50" rx="4" ry="4" style="fill: #007884;"></rect>
        <text transform="translate(273.910202026367188 48.506718635559082)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">tee</tspan></text>
      </g>
      <g>
        <rect x="205" y="93.97459047333632" width="160" height="50" rx="4" ry="4" style="fill: #2a2aea;"></rect>
        <text transform="translate(229.527496337890625 123.650547027587891)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtimlvconverter</tspan></text>
      </g>
      <g>
        <line x1="285" y1="143.974590301513672" x2="285" y2="163.951229095458984" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="281.50958251953125 162.929943084716797 285 168.974590301513672 288.49041748046875 162.929943084716797 281.50958251953125 162.929943084716797"></polygon>
      </g>
      <g>
        <rect x="205" y="168.97459047333632" width="160" height="50" rx="4" ry="4" style="fill: #2a2aea;"></rect>
        <text transform="translate(250.820465087890625 198.650554656982422)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtimltflite</tspan></text>
      </g>
      <g>
        <line x1="285" y1="218.974590301513672" x2="285" y2="238.951244354248047" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="281.50958251953125 237.929943084716797 285 243.974590301513672 288.49041748046875 237.929943084716797 281.50958251953125 237.929943084716797"></polygon>
      </g>
      <g>
        <rect x="205" y="243.97459047333632" width="160" height="49.999999999999091" rx="4" ry="4" style="fill: #2a2aea;"></rect>
        <text transform="translate(222.722808837890625 273.650554656982422)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      </g>
      <g>
        <line x1="365" y1="45.000011444091797" x2="384.97662353515625" y2="45.000011444091797" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="383.955322265625 48.490444183349609 390 45.000011444091797 383.955322265625 41.50958251953125 383.955322265625 48.490444183349609"></polygon>
      </g>
      <g>
        <rect x="390" y="20.000014873722648" width="160" height="50" rx="4" ry="4" style="fill: #2a2aea;"></rect>
        <text transform="translate(421.140655517578125 48.506718635559082)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtivcomposer</tspan></text>
      </g>
      <g>
        <line x1="550" y1="45.000011444091797" x2="569.97662353515625" y2="45.000011444091797" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="568.955322265625 48.490444183349609 575 45.000011444091797 568.955322265625 41.50958251953125 568.955322265625 48.490444183349609"></polygon>
      </g>
      <g>
        <rect x="575" y="20.000014873722648" width="160" height="50" rx="4.000000000000019" ry="4.000000000000019" style="fill: #007884;"></rect>
        <text transform="translate(611.09771728515625 48.506718635559082)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">waylandsink</tspan></text>
      </g>
    </g>
    <g>
      <polyline points="365 268.974590301513672 470 268.974590301513672 470 75.847972869873047" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></polyline>
      <polygon points="473.49041748046875 76.869258880615234 470 70.824611663818359 466.50958251953125 76.869258880615234 473.49041748046875 76.869258880615234"></polygon>
    </g>
  </g>
</svg>
**Figure : Pipeline for classification with qtivcomposer**

The following table provides the sequential processing stages of the pipeline execution:

| Process | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70029-50/topic/qtiqmmfsrc.html) | <ol class="arabic"><br><li><p>Collects the video stream (source) and creates two copies of the source:</p><br><blockquote><br><div><ul class="simple"><br><li><p>One stream is sent to the qtivcomposer plugin to retain the video stream.</p></li><br><li><p>The other stream is sent to the ML inferencing branch in the pipeline.</p></li><br></ul><br></div></blockquote><br></li><br></ol> |
| **Preprocessing** | **Preprocessing** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70029-50/topic/qtimlvconverter.html) | <ol class="arabic"><br><li><p>Receives the video stream on its sink pad.</p></li><br><li><dl class="simple"><br><dt>Performs preprocessing:</dt><dd><ul class="simple"><br><li><p>Color conversion</p></li><br><li><p>Scaling down/up</p></li><br><li><p>Normalization on the stream data when the model expects the floating point values as an input</p></li><br></ul><br></dd><br></dl><br></li><br><li><p>Converts the video stream to a tensor stream on its source pad.</p><br><p>The classification model uses this tensor stream for inferencing.</p><br></li><br></ol> |
| **Inferencing** | **Inferencing** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70029-50/topic/qtimltflite.html) | <ol class="arabic simple"><br><li><p>Loads the model.</p></li><br><li><p>Modifies the graph for the chosen delegate.</p></li><br><li><p>Receives the tensor stream on its sinkpad.</p></li><br><li><p>Runs the inference and produces a tensor stream with the inference results on its source pad.</p></li><br></ol> |
| **Postprocessing** | **Postprocessing** |
| qtimlpostprocess | <ol class="arabic"><br><li><p>Receives the inference results from a classification model on its sinkpad.</p></li><br><li><p>Converts the inference tensors into formats like video or text that the multimedia plugins can process later.</p></li><br><li><p>Applies the threshold to the chosen number of results.</p></li><br><li><p>Loads the corresponding modules for the classification models.</p><br><p>In this use case, qtimlpostprocess does the following:</p><br><blockquote><br><div><ol class="loweralpha simple"><br><li><p>Loads the submodule of the model.</p></li><br><li><p>Produces results as video frames with classification labels.</p></li><br><li><p>Sends them to the sinkpad of qtivcomposer.</p></li><br></ol><br></div></blockquote><br></li><br></ol> |
| [qtivcomposer](https://docs.qualcomm.com/doc/80-70029-50/topic/qtivcomposer.html) | <ol class="arabic simple"><br><li><p>Receives the original video stream with classification results on its sinkpads.</p></li><br><li><p>On its sourcepad, produces GST buffers with contents composed of video streams from its sinkpads.</p></li><br></ol> |
| **Output** | **Output** |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70029-50/topic/waylandsink.html) | <ol class="arabic simple"><br><li><p>Receives the video in its sinkpad</p></li><br><li><p>Submits the video stream to Weston.</p></li><br><li><p>Weston renders the video stream and possible classifications generated for that scene on a local display device.</p></li><br></ol> |

Last Published: Apr 02, 2026

[Previous Topic
LiteRT use cases](https://docs.qualcomm.com/bundle/publicresource/80-70029-50/topics/tensorflow-lite-use-cases.md) [Next Topic
Image classification and encode with LiteRT](https://docs.qualcomm.com/bundle/publicresource/80-70029-50/topics/single-camera-stream-with-image-classification-and-encode.md)

Source: [https://docs.qualcomm.com/doc/80-70029-50/topic/single-camera-stream-with-image-classification-and-display-with-litert.html](https://docs.qualcomm.com/doc/80-70029-50/topic/single-camera-stream-with-image-classification-and-display-with-litert.html)