ios - 自动生成的 CoreML 类使用了冲突的初始值设定项

标签 ios objective-c coreml xcode10

我刚刚升级到 Xcode 10.0,它似乎破坏了 CoreML 自动生成的网络类代码。构建项目时,我收到错误:

reg_net.m:94:50:“reg_netInput”没有可见的@interface 声明选择器“initWith0:”

在类内部,自动生成的 reg_netInput 初始化器具有 initWith_0 的形式,但在预测函数的主体中,代码调用 initWith0。我试图将初始化程序名称更改为一致,但每当我构建时,代码似乎会再次自动生成并恢复为冲突的名称。

我也曾尝试删除并重新导入 .mlmodel 文件,但没有成功。关于如何解决此问题的任何想法?

最佳答案

尝试通过不同于数字“0”有效标识符更改模型的输入名称。

Overview

In Core ML, a feature is a single input or output of a model. A model can have any number of input features or output features. Each feature has a name and a value type, which are defined in the feature's MLFeatureDescription. Model authors use feature descriptions to help developers integrate their model properly. Each MLFeatureDescription instance has read-only properties that indicate the feature's name, its type, and whether it's optional.

For examples of features, see Integrating a Core ML Model into Your App. Note the three input features named solarPanels, greenhouses, and size, and the output feature is named price. All four features are of type Double.

An MLFeatureDescription may also include constraints, which specify the limitations of the model's input and output features. For each input feature, the constraints describe what values the model expects from your app. For each output feature, the constraints describe what values your app should expect from the model. You can also write code to inspect these descriptions before using the model in your app.

Topics Inspecting a Feature var name: String

The name of this feature.

参见:MLFeatureDescriptionMLFeatureDescription name

关于ios - 自动生成的 CoreML 类使用了冲突的初始值设定项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52447905/

相关文章:

ios - UIButtons 数组返回错误

ios - CoreML/MLModelConfig 首选MetalDevice - 了解设备放置启发式

ios - 如何将CoreMl模型包含到cocoa pod框架中?

ios - [tableview reloadData] 未调用 numberofSections 方法

ios - 在 Parse.com iOS 上上传的文件为空

ios - 使用 AVCaptureSession 和 AVAssetWriter 在翻转相机的同时进行无缝录音

iphone - NSDictionary 拒绝为其键设置值。

ios - 仅从表行弹出 Watchkit 上下文菜单?

ios - 静态库无法初始化 mlmodel

ios - 给定文本和字体,如何计算 UIButton 的宽度和高度?