我刚刚升级到 Xcode 10.0,这似乎破坏了 CoreML 自动生成的网络类代码。在构建项目时,我收到错误:
reg_net.m:94:50:“reg_netInput”没有可见的@interface 声明选择器“initWith0:”
在类内部,自动生成的 reg_netInput 初始化程序具有 initWith_0 形式,但在预测函数的主体中,代码调用 initWith0 。我尝试将初始化程序名称更改为一致,但每当我构建时,代码似乎会再次自动生成并恢复为冲突的名称。
我还尝试删除并重新导入 .mlmodel 文件,但均未成功。有关如何解决此问题的任何想法?
Best Answer-推荐答案 strong>
尝试通过不同于数字 "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.
见:MLFeatureDescription和 MLFeatureDescription name
关于ios - 自动生成的 CoreML 类使用冲突的初始化程序,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/52447905/
|