我一直在尝试开始使用 CoreML(Apple 的机器学习库)。我正在按照这些教程开始
1) https://www.appcoda.com/coreml-introduction/
2) https://www.raywenderlich.com/164213/coreml-and-vision-machine-learning-in-ios-11-tutorial
第一个教程使用 Inception V3,第二个教程使用 Places205-GoogLeNet 模型进行解释。
在所有基本设置步骤之后
Places205-GoogLeNet 教程使用如下代码
func detectScene(image: CIImage) {
answerLabel.text = "detecting scene..."
// Load the ML model through its generated class
guard let model = try? VNCoreMLModel(for: GoogLeNetPlaces().model) else {
fatalError("can't load Places ML model")
}
}
第二个代码使用这个
guard let prediction = try? model.prediction(image: pixelBuffer!) else {
return
}
这两种方法有什么区别,哪一种更推荐,因为这两种方法都可以用来传递像素缓冲区并显示结果?