问题描述
我正在使用Inception v3机器学习模型在Swift中构建一个基本的图像识别应用程序.我将Inceptionv3.ml模型拖放到项目文件夹中,并确保选中了如果需要复制项目"选项.
I am building a basic image recognition app in Swift using the Inception v3 Machine Learning model.I dragged and dropped the Inceptionv3.mlmodel inside my project folder and made sure the "Copy items if needed" option was ticked.
在检测功能内:
func detect(image: CIImage) {
guard let model = try? VNCoreMLModel(for: Inceptionv3().model) else {
fatalError("Loading CoreML Model Failed!")
}
let request = VNCoreMLRequest(model: model) { (request, error) in
guard let results = request.results as? [VNClassificationObservation] else {
fatalError("Model failed to process")
}
if let firstResult = results.first {
self.navigationItem.title = firstResult.identifier
}
}
我收到以下消息:
当我在项目浏览器中单击Inceptionv3.mlmodel文件时,也会收到此消息:
Also when I click on the Inceptionv3.mlmodel file on my project browser I get this message:
但是我知道它应该显示为:
But I know it should read something like:
旁边有一个小箭头,您可以通过它访问课程.
With a small arrow next to it that allow you to access the class.
有什么想法吗?
推荐答案
我遇到了同样的问题.我通过在桥接标头中添加inceptionv3来解决.
I had the same problem. I solved by add inceptionv3 in bridging header.
这篇关于为什么在我的项目中无法识别Inceptionv3机器学习模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!