gpt4 book ai didi

swift - CICoreMLModelFilter 抛出 "Unsupported engine type"

转载 作者:搜寻专家 更新时间:2023-10-31 22:54:19 26 4
gpt4 key购买 nike

CoreImage 中有这个新的但仍未记录的 CICoreMLModelFilter。它有两个参数:

inputImage - The image to use as an input image. For filters that also use a background image, this is the foreground image.

inputModel - The CoreML model to be used for applying effect on the image.

这个想法非常简单 - 拍摄一张图片,应用风格转换,然后生成风格化的图片。

所以我将 CoreML 模型加载到我的测试应用程序中并尝试将此模型作为 inputModel 键传递:

guard
let mlFilter = CIFilter(name: "CICoreMLModelFilter")
else {
return nil
}

let model = StarryStyle().model

mlFilter.setValue(workingImage, forKey: "inputImage")
mlFilter.setValue(model, forKey: "inputModel")

guard
let mlResult = mlFilter.outputImage
else {
return nil
}

每当我尝试运行这个非常简单的代码时,我都会遇到以下异常:

[Espresso::handle_ex_] exception=Unsupported engine type

无论我尝试加载什么 MLModel,它总是抛出上述异常。我在 Mojave (10.14) 上运行 Swift 4.2。

有人试过 CoreImage 和 CoreML 吗?

最佳答案

我在 Mac OS 10.14 上遇到此错误 - 在 iOS 12 sans 错误和早期版本的 Mac OS - 10.13 上运行良好的模型上。最初我认为这与浮点量化有关,但我在非量化 float 32 模型和不同设备上尝试过这个,并为以下模型获取它:

  • 输出/运行推理良好
  • 使用标准的 CoreML/Vision API
  • 在集成或独立 GPU 上运行
  • 在 iMac Pro AMD GPU 上
  • 在 MBP Nvidia GPU 上

我不确定这是否只是处理的一些内部异常 - 在 AMD 上,我得到一个稍微不同的错误;

[Espresso:handle_ex_] exception=<private>

我开始认为它是无害的?

关于swift - CICoreMLModelFilter 抛出 "Unsupported engine type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52576753/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com