# ObjectDetectorOptions

    struct ObjectDetectorOptions: Sendable

Configuration options for the MediaPipe `ObjectDetector` task.

Conforms to `Sendable` (`Equatable` and `Hashable` are omitted because `liveStreamResultHandler` is an escaping closure).
- `
  ### [init(baseOptions:runningMode:displayNamesLocale:maxResults:scoreThreshold:categoryAllowlist:categoryDenylist:liveStreamResultHandler:)](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV04baseG011runningMode18displayNamesLocale10maxResults14scoreThreshold17categoryAllowlist0R8Denylist23liveStreamResultHandlerAC0abC6Common04BaseG0V_AL0d7RunningJ0OSSSiSfSaySSGAQys0W0OyAA0efW0Vs5Error_pG_SitYbcSgtcfc)

  ` Creates `ObjectDetectorOptions` with the specified configuration.

  #### Declaration

  Swift

      init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, displayNamesLocale: String = "en", maxResults: Int = -1, scoreThreshold: Float = 0.0, categoryAllowlist: [String] = [], categoryDenylist: [String] = [], liveStreamResultHandler: ObjectDetectorOptions.LiveStreamResultHandler? = nil)

- `
  ### [baseOptions](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV04baseG00abC6Common04BaseG0Vvp)

  ` Model asset and hardware delegate configuration.

  #### Declaration

  Swift

      var baseOptions: BaseOptions

- `
  ### [categoryAllowlist](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV17categoryAllowlistSaySSGvp)

  ` Category names to include exclusively (mutually exclusive with `categoryDenylist`).

  #### Declaration

  Swift

      var categoryAllowlist: [String]

- `
  ### [categoryDenylist](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV16categoryDenylistSaySSGvp)

  ` Category names to exclude (mutually exclusive with `categoryAllowlist`).

  #### Declaration

  Swift

      var categoryDenylist: [String]

- `
  ### [displayNamesLocale](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV18displayNamesLocaleSSvp)

  ` BCP-47 locale for localized category display names in model metadata.

  #### Declaration

  Swift

      var displayNamesLocale: String

- `
  ### [liveStreamResultHandler](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV23liveStreamResultHandlerys0J0OyAA0efJ0Vs5Error_pG_SitYbcSgvp)

  ` Asynchronous delivery closure required when `runningMode` is `.liveStream`.

  #### Declaration

  Swift

      var liveStreamResultHandler: ObjectDetectorOptions.LiveStreamResultHandler?

- `
  ### [maxResults](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV10maxResultsSivp)

  ` Maximum number of top-scored detections to return (`< 0` returns all; `0` is invalid).

  #### Declaration

  Swift

      var maxResults: Int

- `
  ### [runningMode](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV11runningMode0abC6Common0d7RunningI0Ovp)

  ` Execution mode (`image`, `video`, or `liveStream`).

  #### Declaration

  Swift

      var runningMode: VisionRunningMode

- `
  ### [scoreThreshold](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV14scoreThresholdSfvp)

  ` Minimum confidence score threshold overriding model metadata.

  #### Declaration

  Swift

      var scoreThreshold: Float

- `
  ### [LiveStreamResultHandler](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ObjectDetectorOptions.md.txt#/s:20MediaPipeTasksVision21ObjectDetectorOptionsV23LiveStreamResultHandlera)

  ` Asynchronous callback invoked on a serial queue with live-stream detection results.

  #### Declaration

  Swift

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