# Image segmentation and display with LiteRT The use case implements the `deeplabv3_resnet50` LiteRT model to identify semantic segmentations in a scene from a camera stream. The use case is to compose the semantics and original video stream using qtivcomposer, and then display the results. Run the 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::alpha=0.5 ! queue ! waylandsink fullscreen=true sync=false \ split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \ external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/deeplabv3_plus_mobilenet_quantized.tflite ! queue ! \ qtimlpostprocess module=deeplab-argmax labels=/etc/labels/deeplabv3_resnet50.json ! \ video/x-raw,width=256,height=144 ! queue ! mixer. Copy to clipboard To stop the use case, use **CTRL + C**. The following figure shows the flow of the use case execution: 1. Identify scenes from a video stream coming through a camera source. 2. Compose semantic segmentation and video stream using qtivcomposer. 3. Display the results. **Figure : Pipeline for segmentation with qtivcomposer** The following table provides the sequential processing stages of the pipeline execution: | Process | Description | | --- | --- | | [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-80021-50/topic/qtiqmmfsrc.html) |
Collects the video stream (source) and creates two copies of the source:
One stream is sent to the qtivcomposer plugin to retain the video stream.
The other stream is sent to the ML inferencing branch in the pipeline.
Receives the video stream on its sink pad.
Color conversion
Scaling down/up
Normalization on the stream data when the model expects the floating point values as input
Converts the video stream to a tensor stream on its source pad.
Loads the segmentation model.
Modifies the graph for the chosen delegate.
Receives the tensor stream on its sinkpad.
Runs the inference and produces a tensor stream with the segmentation results on its source pad.
Receives the inference tensors on its sinkpad.
Converts the inference tensors into video formats that the multimedia plugins can process later.
Produces the semantic segmentations for the frame.
Loads the corresponding modules for the segmentation models.
In this use case, qtimlpostprocess does the following:
Loads the deeplab-argmax submodule.
Produces video frames with segmentation masks.
Sends them to the sinkpad of qtivcomposer.
Receives the original video stream with segmentation mask on its sinkpads.
On its sourcepad, produces GST buffers with contents composed of video streams from its sinkpads.
Receives the video stream on its sinkpad.
Submits the video stream to Weston.
Weston displays the following on the local display device:
The video stream that's captured from the camera.
The segmentation masks that are drawn over objects/components in that scene.