MediaPipeTasksVision Framework Reference

FaceDetectorOptions

struct FaceDetectorOptions: Sendable

Configuration options for initializing a MediaPipe FaceDetector task.

Does not conform to Equatable or Hashable because liveStreamResultHandler is a closure.

  • Creates FaceDetectorOptions with default or custom detection thresholds and running mode.

    Declaration

    Swift

    init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, minDetectionConfidence: Float = 0.5, minSuppressionThreshold: Float = 0.3, liveStreamResultHandler: FaceDetectorOptions.LiveStreamResultHandler? = nil)
  • Shared options for loading the model asset and configuring the hardware delegate.

    Declaration

    Swift

    var baseOptions: BaseOptions
  • Handler invoked asynchronously with detection results when runningMode == .liveStream.

    Declaration

    Swift

    var liveStreamResultHandler: FaceDetectorOptions.LiveStreamResultHandler?
  • Minimum confidence score in [0.0, 1.0] required for a face detection to be retained.

    Declaration

    Swift

    var minDetectionConfidence: Float
  • Minimum non-maximum-suppression IoU threshold in [0.0, 1.0] for overlapping detections.

    Declaration

    Swift

    var minSuppressionThreshold: Float
  • Execution mode (.image, .video, or .liveStream) for the detector.

    Declaration

    Swift

    var runningMode: VisionRunningMode
  • Asynchronous callback invoked on a serial background queue for .liveStream face detection.

    Declaration

    Swift

    typealias LiveStreamResultHandler = @Sendable (Result<FaceDetectorResult, any Error>, Int) -> Void