FritzVisionStylePredictor

@available(iOS 11.0, *)
@objc(FritzVisionStylePredictor)
public class FritzVisionStylePredictor : NSObject, CoreMLOrVisionPredictor, FritzMLModelInitializable

Construct a Flexible Style Transfer model and run on any FritzVisionImage. Produces stylized images with customizable output sizes.

  • Declaration

    Swift

    public typealias PredictionInput = FritzVisionImage
  • Declaration

    Swift

    public typealias ModelOptions = FritzVisionStyleModelOptions
  • Declaration

    Swift

    public typealias PredictionResult = CVPixelBuffer
  • Declaration

    Swift

    @objc
    public let managedModel: FritzManagedModel
  • Initialize FritzStyleTransferModel with your own trained style model.

    Declaration

    Swift

    @objc(initWithIdentifiedModel:)
    convenience public required init(model: SwiftIdentifiedModel)

    Parameters

    model

    Fritz model to use.

  • Initialize FritzVisionStylePredictor with your own trained style model.

    Declaration

    Swift

    @objc(initWithFritzMLModel:error:)
    required public init(model: FritzMLModel) throws

    Parameters

    model

    Fritz model to use.

  • Initialize FritzVisionStylePredictor with your own trained style model.

    Declaration

    Swift

    @objc(initWithFritzMLModel:managedModel:error:)
    required public init(model: FritzMLModel, managedModel: FritzManagedModel) throws

    Parameters

    model

    Fritz model to use.

    managedModel

    FritzManagedModel to use.

  • Run Style Transfer on a FritzVisionImage.

    Declaration

    Swift

    @objc(predict:options:completion:)
    public func predict(
      _ input: FritzVisionImage,
      options: FritzVisionStyleModelOptions = .init(),
      completion: (CVPixelBuffer?, Error?) -> Void
    )

    Parameters

    input

    Image or buffer to run model on.

    options

    Options for model execution.

    completion

    The block to invoke after the prediction request. Contains a FritzVisionSegmentationResult or error message.