CoreML 错误:导入时源文件无效 mymodel.mlmodel
error with CoreML: source file is not valid , when importing mymodel.mlmodel
我在使用 CoreML 模型构建 ios 应用程序时遇到问题。
我在我的项目中使用了 this 示例代码来实现 coreML。
我可以 运行 使用回购中的给定模型从 github 克隆示例代码时,但是当我粘贴到我自己的模型时,我得到一个错误:
lexical preprocessor issue
source file is not valid UTF-8
SSD_model.mlmodel
我的模型是一个用于生成边界框的 SSD 模型(而不仅仅是像 repo 模型那样的对象检测),所以这可能会产生问题。我使用 tensorflow 对象检测 API 对其进行了训练,并使用为 SSD 模型制作的 this helpful blog post . I've verified that my model works well by testing it in another script 将其导出到 coreML。这是我现在如何导入模型的第一个示例的片段:
#import <CoreML/CoreML.h>
#import <Vision/Vision.h>
#import "SSD_model.mlmodel"
- (void)viewDidLoad {
[super viewDidLoad];
model = [[[SSD_model alloc] init] model]
m = [VNCoreMLModel modelForMLModel: model error:nil];
我需要更改此 objective C 代码才能使其正常工作吗?或者我可能忘记的任何项目设置?谢谢!
我在使用 CoreML 模型构建 ios 应用程序时遇到问题。 我在我的项目中使用了 this 示例代码来实现 coreML。 我可以 运行 使用回购中的给定模型从 github 克隆示例代码时,但是当我粘贴到我自己的模型时,我得到一个错误:
lexical preprocessor issue
source file is not valid UTF-8
SSD_model.mlmodel
我的模型是一个用于生成边界框的 SSD 模型(而不仅仅是像 repo 模型那样的对象检测),所以这可能会产生问题。我使用 tensorflow 对象检测 API 对其进行了训练,并使用为 SSD 模型制作的 this helpful blog post . I've verified that my model works well by testing it in another script 将其导出到 coreML。这是我现在如何导入模型的第一个示例的片段:
#import <CoreML/CoreML.h>
#import <Vision/Vision.h>
#import "SSD_model.mlmodel"
- (void)viewDidLoad {
[super viewDidLoad];
model = [[[SSD_model alloc] init] model]
m = [VNCoreMLModel modelForMLModel: model error:nil];
我需要更改此 objective C 代码才能使其正常工作吗?或者我可能忘记的任何项目设置?谢谢!