我正在使用 TensorFlow Lite,我正在尝试将 GPU 处理委托与移动网络多姿势模型一起使用。解释器初始化失败并出现不明确的错误。我正在尝试使用 Core ML GPU 委托,但在下面的代码中。我也尝试过 TFLMetalDelegate,但也失败了。如果任何 GPU 处理都适用于 TFL,我会很高兴。
这是模型的链接: https://tfhub.dev/google/movenet/multipose/lightning/1
NSError* error = nil;
TFLInterpreterOptions* options = [[[TFLInterpreterOptions alloc] init] autorelease];
options.numberOfThreads = 4;
TFLCoreMLDelegateOptions* mlOptions = [[[TFLCoreMLDelegateOptions alloc] init]autorelease];
TFLCoreMLDelegate* coreMLDelegate = [[[TFLCoreMLDelegate alloc] initWithOptions:mlOptions] autorelease];
NSArray* delegates = [NSArray arrayWithObject:coreMLDelegate];
_interpreter = [[TFLInterpreter alloc] initWithModelPath:[NSBundle.mainBundle pathForResource:@"movenet_lightning_multipose" ofType:@"tflite"] options:options delegates:delegates error:&error];
返回的错误说:
Error Domain=org.tensorflow.lite.interpreter Code=4 “无法创建解释器。” UserInfo={NSLocalizedDescription=创建解释器失败。}
使用 CPU 处理效率极低且非常慢。有没有办法在 iPhone 上使用 GPU 处理和 movenet 模型?
感谢您的帮助!