ImageSegmenterOptions
struct ImageSegmenterOptions: SendableOptions for configuring an ImageSegmenter task.
Not Equatable or Hashable because liveStreamResultHandler is a closure.
-
init(baseOptions:runningMode:displayNamesLocale:outputConfidenceMasks:outputCategoryMask:liveStreamResultHandler:)
Creates options for single-image segmentation that output confidence masks only.
Declaration
Swift
init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, displayNamesLocale: String = "en", outputConfidenceMasks: Bool = true, outputCategoryMask: Bool = false, liveStreamResultHandler: ImageSegmenterOptions.LiveStreamResultHandler? = nil) -
Base options for model loading and hardware acceleration delegation.
Declaration
Swift
var baseOptions: BaseOptions -
Locale used for display names from the TFLite Model Metadata.
Declaration
Swift
var displayNamesLocale: String -
Handler for
.liveStreamresults. Must benilin.imageand.videomodes.Declaration
Swift
var liveStreamResultHandler: ImageSegmenterOptions.LiveStreamResultHandler? -
Whether to output a
UInt8category mask.Declaration
Swift
var outputCategoryMask: Bool -
Whether to output per-category
Float32confidence masks.Declaration
Swift
var outputConfidenceMasks: Bool -
Execution mode of the segmenter.
.liveStreamrequiresliveStreamResultHandler.Declaration
Swift
var runningMode: VisionRunningMode -
Receives asynchronous
.liveStreamsegmentation results (or errors) with their input timestamp on a private serial queue.Declaration
Swift
typealias LiveStreamResultHandler = @Sendable (Result<ImageSegmenterResult, any Error>, Int) -> Void