我试图读取一个.mlmodel文件来编译并在我们的库中使用它。我正在测试库,但我不能读取文件和编译它。。。我不知道为什么。我正在使用这两个函数(都不起作用)
-(NSString*) FilePathForResourceName:(NSString*) name forExtension:(NSString*) extension {
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString* file_path = [bundle pathForResource:name ofType:extension];
return file_path;
}
-(NSString*) FilePathForMainBundleResourceName:(NSString*) name forExtension:(NSString*) extension {
NSBundle *main = [NSBundle mainBundle];
NSString* file_path = [main pathForResource:name ofType:extension];
return file_path;
}
- (void)testShouldAnalyseCorrectlyWithDetectionBicycles {
NSString* image_path = [self FilePathForResourceName:@"bicycles" forExtension:@"jpg"];
NSString* labels_path = [self FilePathForResourceName:@"coco_labels_list" forExtension:@"txt"];
NSString* network_path = [self FilePathForResourceName:@"ssd_mobilenet_feature_extractor" forExtension:@"mlmodel"];
CoreMLLib* lib = [[CoreMLLib alloc] init:network_path forLabel:labels_path];
[lib run:image_path];
}
我认为,它正确地添加到了项目中的文件中(对于目标测试和库):
中的值参数
FilePathForResourceName文件路径
-
名称->ssd\u mobilenet\u feature\u extractor
-
-
文件路径->无
-
“/Users/joan/Library/Developer/Xcode/DerivedData/draagu ios tensorflow lib hglbppvrarumdfwgjoebcuesar/Build/Products/Debug iphonesimulator/draagu ios tensorflow-libTests.xctest测试“0x00007f7f1fc2cb40