Detects faces in the input image and outputs boxes; enabling output_landmarks adds 478-point landmarks (mediapipe_478 scheme, unified across backends). With backend = auto, MediaPipe runs first and MNN takes over when unavailable; the backend actually used is observable in the result.

Module:Face detection · Task type:face_detect

Ports

Inputs

PortTypeRequired
inImage / cv::Mat✓

Outputs

PortTypeRequired
outImage / cv::Mat—

Parameters

参数类型默认值范围 / 选项说明
backendenum0Auto / MediaPipe / MNNinference backend; Auto degrades gracefully (MediaPipe → MNN)
model_pathstring(空)*shown conditionally on backend。*MNN detector model path (empty = built-in search path)
landmark_model_pathstring(空)*shown conditionally on backend。*landmark model path (used with output_landmarks)
output_landmarksboolfalseemit 478-point landmarks
max_facesint5[1, 10]maximum faces kept
score_thresholdfloat0.5[0, 1]confidence threshold
nms_thresholdfloat0.3[0, 1]NMS overlap threshold
delegateenum0CPU / GPU*shown conditionally on backend。*MediaPipe inference delegate (CPU / GPU)
deviceenum2CPU / Metal / Auto*shown conditionally on backend。*MNN device (CPU / Metal / Auto)
threadsint4[1, 16]*shown conditionally on backend。*CPU inference threads

Example graph

A minimal runnable pipeline (read → process → write). Drag it into GraphStudio or open via --open; replace data/test.png with a real path.

{
  "version": "2.0",
  "tasks": [
    {
      "id": "read",
      "type": "opencv_image_read",
      "params": {
        "file_path": "data/test.png"
      }
    },
    {
      "id": "node",
      "type": "face_detect",
      "params": {
        "backend": 0,
        "output_landmarks": false,
        "max_faces": 5,
        "score_threshold": 0.5,
        "nms_threshold": 0.3,
        "delegate": 0,
        "device": 2,
        "threads": 4
      }
    },
    {
      "id": "save",
      "type": "opencv_image_write",
      "params": {
        "file_path": "out_out.png"
      }
    }
  ],
  "edges": [
    {
      "from": "read",
      "from_port": "out",
      "to": "node",
      "to_port": "in"
    },
    {
      "from": "node",
      "from_port": "out",
      "to": "save",
      "to_port": "in"
    }
  ]
}

Notes

  • Missing model assets fail the task with a pointer to the download script — never silent empty results.
  • TG_FACE_DEBUG=1 enables backend diagnostics.

Part of the GraphStudio node guide series; parameters reflect the latest release.