# Face detection The **gst-ai-face-detection** application collects the live video input from a camera, file, or an RTSP stream and uses the Qualcomm AI Engine direct and LiteRT face detection models to produce a preview with the overlaid AI model output on the HDMI display. The following figure shows the pipeline, which receives the input, preprocesses it, runs inferences on AI hardware, and displays the results on the screen. For information about the plugins used in the pipeline flow, see [Pipeline flow](https://docs.qualcomm.com/doc/80-80021-50/topic/gst-ai-face-detection.html#section-kjz-ll3-4dc). Qualcomm Open source tee qtimetamux Waylandsink qtivoverlay qtimlvconverter qtimlqnn qtimlpostprocess sink_1 sink_0 qtimlvconverter qtimlqnn qtimlpostprocess sink_1 sink_0 qtimlvconverter qtimlqnn qtimlpostprocess sink_1 sink_0 rtspsrc rtph264 depay h264parse V4l2h264dec filesrc qtdemux h264parse V4l2h264dec File (default) qtiqmmfsrc Camera (optional) RTSP (optional) **Figure : gst-ai-face-detection pipeline** ## Input and output capabilities The following table summarizes the input and output capabilities supported by the sample application: | Config | Input | Input | Input | Input | Output | Output | Output | | --- | --- | --- | --- | --- | --- | --- | --- | | Config | File src | RTSP | USB camera | MIPI camera | File | Display | RTSP | | Config #1 | Yes | Yes | No | No | No | Yes | Yes | | Config #2 | Yes | Yes | No | Yes | No | Yes | No | | | | | | | | | | ## Sample model and label files | Runtime | Model files | Label files | | --- | --- | --- | | LiteRT | *face\_det\_lite\_quantized.tflite* | *face\_detection.json* | | Qualcomm AI Engine direct | *face\_det\_lite\_quantized.bin* | *face\_detection.json* | | | | | ## Run the application on the target device The sample application uses the `/etc/configs/config_face_detection.json` file to read the input parameters. To create your own config JSON file, use [config_face_detection.json](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-sample-apps/gst-ai-face-detection/config_face_detection.json?ref_type=heads) as a reference. 1. Ensure that you complete the [Prerequisites](https://docs.qualcomm.com/doc/80-80021-50/topic/download-model-and-label-files.html). 2. Update the config JSON file based on the model, input stream, and other properties. For more information, see [Config JSON field description](https://docs.qualcomm.com/doc/80-80021-50/topic/gst-ai-face-detection.html#section-txh-cm4-q2c). 3. Use the following format of the `config_face_detection.json` file: { "file-path": "", "ml-framework": "", "model": ", "runtime": """ } Copy to clipboard An example format file for Config #2 and Config #1 is as follows: Tab Config #2 Tab Config #1 For example, run the application using LiteRT, input video file, custom model, custom label file, DSP runtime, and custom threshold: { "file-path": "/etc/media/video.mp4", "ml-framework": "tflite", "model":"/etc/models/face_det_lite_quantized.tflite", "labels": "/etc/labels/face_detection.json", "threshold": 51, "runtime": "dsp" } Copy to clipboard For example, run the application using LiteRT, input video file, custom model, custom label file, CPU runtime, and custom threshold: { "file-path": "/etc/media/video.mp4", "ml-framework": "tflite", "model":"/etc/models/face_det_lite_quantized.tflite", "labels": "/etc/labels/face_detection.json", "threshold": 51, "runtime": "cpu" } Copy to clipboard Note Config #1 supports only LiteRT models and the CPU runtime. 4. Run the gst-ai-face-detection application: gst-ai-face-detection --config-file=/etc/configs/config_face_detection.json Copy to clipboard 5. To display the available help options, run the following commands in the SSH shell: gst-ai-face-detection -h Copy to clipboard 6. To stop the use case, use **CTRL + C**. ## Pipeline flow The following table lists the plugins used in the face detection pipeline: | Plugin | Description | | --- | --- | | Camera source: [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-80021-50/topic/qtiqmmfsrc.html) |

  • Captures the live stream from camera.


  • Uses tee to split the stream for inferencing.


| | RTSP source: rtspsrc |

  • Captures the RTSP stream using rtspsrc, followed by rtph264depay for video extraction.


  • Uses tee to split the stream for inferencing.


| | h264parse | Parses the H.264 video. | | [v4l2h264dec](https://docs.qualcomm.com/doc/80-80021-50/topic/v4l2h264dec.html) | Decodes the video. | | [qtimlvconverter](https://docs.qualcomm.com/doc/80-80021-50/topic/qtimlvconverter.html) |

  1. Receives the video stream on its sink pad.


  2. Performs the following preprocessing on the stream data. This preprocessing is done when the model expects floating-point values as input.


    1. Color conversion


    2. Scaling (up or down)


    3. Normalization




  3. Converts the preprocessed video stream to a tensor stream on its source pad.




The tensor stream is used for inferencing in the later stages of the pipeline. | | | Acts as the inferencing plugin.

  1. After the inference runtime receives the tensor stream on its sink pad, the plugin runs the inference.


  2. Produces a tensor stream with the inference results on its source pad.


| | qtimlpostprocess |

  • Handles inference results from any face detection model.


  • Applies a threshold to the chosen number of results.


| | [qtimetamux](https://docs.qualcomm.com/doc/80-80021-50/topic/qtimetamux.html) | Receives string-based postprocessing output text with video frame and multiplexes it. | | [qtivoverlay](https://docs.qualcomm.com/doc/80-80021-50/topic/qtioverlay.html) |

  1. Receives the multiplexed stream.


  2. Overlays the bounding boxes on the stream.


| | [Waylandsink](https://docs.qualcomm.com/doc/80-80021-50/topic/waylandsink.html) |

  1. Waylandsink submits the video stream received on its sink pad to Weston.


  2. Weston renders the video stream on a local display.


| ## Config JSON field description The different parameters available to configure the JSON file and run the use case are as follows: Table : Field description–gst-ai-face-detection file | Field | Values/description | | --- | --- | | **ml-framework** | Use one of the following models:

  • tflite: LiteRT


  • qnn: Qualcomm AI Engine direct


| | **runtime** | Use one of the following runtimes:

  • cpu


  • gpu


  • dsp


| | **Input source** | Use one of the following input sources:

  • camera: Primary (0) or secondary (1).


  • file-path: The directory path to the video file.


  • rtsp-ip-port: The address of the RTSP stream: rtsp://<ip>:<port>/<stream>


| ## Known issues The following known issues are observed in the Config #2: - Lag is observed in face detection with camera source and file source as quantized models aren't supported in the TFlite IM SDK framework. - The application may intermittently hang during the `gst_deinit` phase. - The GPU delegate doesn't function in the QNN and TFLite IM SDK frameworks. ## Related information [Object detection](https://docs.qualcomm.com/doc/80-80021-50/topic/gst-ai-object-detection.html) Last Published: Mar 26, 2026 [Previous Topic AI smart codec](https://docs.qualcomm.com/bundle/publicresource/80-80021-50/topics/ai-smart-codec.md) [Next Topic Face recognition](https://docs.qualcomm.com/bundle/publicresource/80-80021-50/topics/gst-ai-face-recognition.md) Source: [https://docs.qualcomm.com/doc/80-80021-50/topic/gst-ai-face-detection.html](https://docs.qualcomm.com/doc/80-80021-50/topic/gst-ai-face-detection.html)