# Four stream batching with LiteRT This command line shows a four stream batched AI inference, that is, object detection use case from a video file. Note This use case isn't supported in the QLI 2.0 RC2 release. Run the use case on the target device gst-launch-1.0 qtivcomposer sink_0::position="<0, 0>" sink_0::dimensions="<640, 360>" name=mixer \ sink_1::position="<640, 0>" sink_1::dimensions="<640, 360>" \ sink_2::position="<0, 360>" sink_2::dimensions="<640, 360>" \ sink_3::position="<640, 360>" sink_3::dimensions="<640, 360>" \ sink_4::position="<0, 0>" sink_4::dimensions="<640, 360>" sink_4::alpha=0.5 \ sink_5::position="<640, 0>" sink_5::dimensions="<640, 360>" sink_5::alpha=0.5 \ sink_6::position="<0, 360>" sink_6::dimensions="<640, 360>" sink_6::alpha=0.5 \ sink_7::position="<640, 360>" sink_7::dimensions="<640, 360>" sink_7::alpha=0.5 \ mixer. ! queue name=vcompsrcq ! fpsdisplaysink signal-fps-measurements=true text-overlay=true sync=false video-sink="waylandsink fullscreen=true sync=true" \ qtimltflite name=tflite_bs4_1 delegate=external external-delegate-path=libQnnTFLiteDelegate.so external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/opt/yolo_batch4.tflite \ qtibatch name=batch_1 ! queue name=batchsrcq ! qtimlvconverter ! tflite_bs4_1. tflite_bs4_1. ! qtimldemux name=mldemux_1 \ filesrc location=/etc/media/video.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! tee name=split_1 ! queue name=batch_sink1 ! batch_1. split_1. ! queue name=vcomp_sink1 ! mixer. \ filesrc location=/etc/media/video.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! tee name=split_2 ! queue name=batch_sink2 ! batch_1. split_2. ! queue name=vcomp_sink2 ! mixer. \ filesrc location=/etc/media/video.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! tee name=split_3 ! queue name=batch_sink3 ! batch_1. split_3. ! queue name=vcomp_sink3 ! mixer. \ filesrc location=/etc/media/video.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! tee name=split_4 ! queue name=batch_sink4 ! batch_1. split_4. ! queue name=vcomp_sink4 ! mixer. \ mldemux_1. ! queue name=dq_0 ! qtimlpostprocess settings="{\"confidence\": 75.0}" results=10 module=yolov8 labels=/etc/labels/yolov8.json ! video/x-raw,width=640,height=360 ! mixer. \ mldemux_1. ! queue name=dq_1 ! qtimlpostprocess settings="{\"confidence\": 75.0}" results=10 module=yolov8 labels=/etc/labels/yolov8.json ! video/x-raw,width=640,height=360 ! mixer. \ mldemux_1. ! queue name=dq_2 ! qtimlpostprocess settings="{\"confidence\": 75.0}" results=10 module=yolov8 labels=/etc/labels/yolov8.json ! video/x-raw,width=640,height=360 ! mixer. \ mldemux_1. ! queue name=dq_3 ! qtimlpostprocess settings="{\"confidence\": 75.0}" results=10 module=yolov8 labels=/etc/labels/yolov8.json ! video/x-raw,width=640,height=360 ! mixer. Copy to clipboard To stop the use case, use **CTRL + C**. The following figure shows the flow of the use case execution: 1. Identifies object scenes in the scene from a video stream, which is coming through a camera source. 2. Composes the following using qtivcomposer: 1. Bounding boxes over objects detected. 2. Original video stream. 3. Displays the results. **Figure : Pipeline for four stream batching use case with LiteRT** The following table provides the sequential processing stages of the pipeline execution: | Plugin | Description | | --- | --- | | File source: filesrc |
Captures the video stream using filesrc, followed by qtdemux, which demultiplexes the stream.
Uses tee to split the stream for inferencing.
Reads input from the streams on its sink pad.
Batches the streams for preprocessing.
Receives the batched video streams on its sink pad.
Performs the following preprocessing on the stream data. This preprocessing is done when the model expects floating-point values as input.
Color conversion
Scaling (up or down)
Normalization
After the inference runtime receives the tensor stream on its sink pad, it runs the inference.
Produces a tensor stream with the inference results on its source pad.
Demultiplexes the batched output.
Splits the output corresponding to the input streams.