ios - CoreML : "Unexpected error processing model" error sometimes occurring

标签 ios swift coreml

上下文: 我正在使用数据科学家制作的自定义 CoreML 模型。 该模型是一个使用 Apple SoundAnalysisPreprocessing 模型作为第一个模型的管道。 SoundAnalysisPreprocessing 模型后跟包含不同卷积层和 softmax 的自定义模型。

问题: 启动预测时,我有时会得到 Unexpected error processing model。使用完全相同的输入,我有时会得到正确的结果,有时会出现此错误。

问题:我不知道如何处理这个错误。输入分配不当是内存问题吗?是模型本身的问题吗? 您知道我可以做些什么来了解正在发生的事情吗?

完整的错误日志:

[DSPGraph] throwing DSPGraph::Exception with backtrace:
0       0x7fff2bcf5df9  DSPGraph::Graph::processMultiple(DSPGraph::GraphIOData*, DSPGraph::GraphIOData*) + 249
1       0x7fff2bc3b570  processThroughGraph(id<MLFeatureProvider>, MLMultiArrayConstraint*, MLMultiArray*, NSString*, DSPGraph::Graph&, std::__1::vector<float, DSPGraph::Graph&::allocator<float> >&, void (DSPGraph::Graph, NSString*::GraphIOData&) block_pointer, NSError* __autoreleasing*) + 979
2       0x7fff2bc3c573  -[SNDSPGraphCustomModel predictionFromFeatures:options:error:] + 195
3       0x7fff2bc3ca49  -[_SNVGGishFrontEndProcessingCustomModel predictionFromFeatures:options:error:] + 98
4       0x7fff2496ac30  -[MLAppleSoundAnalysisPreprocessing predictionFromFeatures:options:error:] + 132
5       0x7fff248d345c  -[MLPipeline predictionFromFeatures:options:error:] + 178
6       0x7fff24923f76  -[MLModel predictionFromFeatures:error:] + 92
7          0x104b89a68  $s10TestCoreML17AudioFileAnalyzerC019previsionWithManualD3Cut33_1966162A0510E69792A8D979B37CC177LL3for10completiony10Foundation3URLV_ySo12MLMultiArrayCSgXEtF + 5992
8          0x104b87850  $s10TestCoreML17AudioFileAnalyzerC05startF03for10completiony10Foundation3URLV_yyXEtF + 80
9          0x104bb360c  $s10TestCoreML23ClassificationViewModelC14startRecognize4word8mockData11resultBlock06finishM0ySS_SbySb_SaySo16SNClassificationCGSgtcSgyyctF + 3436
10         0x104bad21c  $s10TestCoreML18ReadViewControllerC010collectionE0_15didSelectItemAtySo012UICollectionE0C_10Foundation9IndexPathVtFyycfU_ + 220
11         0x104b923fd  $sIeg_IeyB_TR + 45
12         0x104f79d64  _dispatch_client_callout + 8
13         0x104f7c6d6  _dispatch_continuation_pop + 552
14         0x104f8fa8f  _dispatch_source_invoke + 2205
15         0x104f87c53  _dispatch_main_queue_callback_4CF + 1043
[truncated?]
2019-10-30 20:33:04.209693+0100 TestCoreML[5024:191792] [] Caught graph exception 1718775073 !mrf fromBytePos (0) + numBytesToCopy (61440) > mABL->mBuffers[0].mDataByteSize (2112) in /BuildRoot/Library/Caches/com.apple.xbs/Sources/Listen_Sim/Listen-35/CoreAudioUtility/Source/CADSP/DSPGraph/DSPGraph_Utils.cpp:742

最佳答案

我相信您需要更新代码中的一些库。基于与您的错误相关的此 GitHub。

Github

图形异常 1718775073 是关键。

在论坛中,他们说这是解决方法,因为传入调用变量与传出调用变量之间存在奇怪的差异。

if (-0.01f <= hw_srate || hw_srate >= 0.1.f)
{
fmt.mSampleRate = prm->state;
fat->sample_rate = 1.0f;
}

关于ios - CoreML : "Unexpected error processing model" error sometimes occurring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58632695/

相关文章:

ios - InfoPlist.strings 与常量的 global.h

ios - UITableView 导航后滚动到选定的单元格

ios - 静态库无法初始化 mlmodel

ios - 将对象检测模型嵌入到 iOS 应用程序中,并将其部署在 UIView 的内容而不是相机流上?

swift - 准备更新 Core ML 模型

iphone - 是否可以为 iOS 创建一个小部件?

ios - 设置 UIScrollview 和自动布局

ios - 如何在UIButton上放置图像/在哪里可以找到好的图标?

ios - 在 Swift 的几个字典中访问一个键的值

json - 使用 JSON-API 获取的字符串在 Swift 中从 base64 转换为 UTF8