为什么在我的项目中无法识别Inceptionv3机器学习模型? [英] Why is Inceptionv3 Machine Learning model not recognized on my project?

查看:181
本文介绍了为什么在我的项目中无法识别Inceptionv3机器学习模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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'

Use of unresolved identifier 'Inceptionv3'

当我在项目浏览器中单击Inceptionv3.mlmodel文件时,也会收到此消息:

Also when I click on the Inceptionv3.mlmodel file on my project browser I get this message:

仅适用于有效目标的界面生成

Interface generation only available with valid target

但是我知道它应该显示为:

But I know it should read something like:

Inceptionv3(快速生成的源代码)

Inceptionv3 (Swift generated source)

旁边有一个小箭头,您可以通过它访问课程.

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机器学习模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆