【发布时间】:2020-07-17 05:25:52
【问题描述】:
我在 asp.net core C# 应用程序中使用 ML.NET tensorflow 来去除图像背景(类似于这里的实现方式https://github.com/susheelsk/image-background-removal、https://github.com/OPHoperHPO/image-background-remove-tool)。
使用的 TensorFlow 模型是 DeepLabV3 xception_model http://download.tensorflow.org/models/deeplabv3_pascal_train_aug_2018_01_04.tar.gz
在本地运行时,它可以正常工作(至少我无法在本地重现它)。
但是在 Azure 中运行应用服务时,有时会在调用 PredictionEnginePool Predict 方法时出现 SEHException 崩溃:
System.Runtime.InteropServices.SEHException (0x80004005):外部组件已引发异常。在 Tensorflow.c_api.TF_SessionRun(IntPtr 会话,TF_Buffer* run_options,TF_Output[] 输入,IntPtr[] input_values,Int32 ninputs,TF_Output[] 输出,IntPtr[] output_values,Int32 noutputs,IntPtr[] target_opers,Int32 ntargets,IntPtr run_metadata , IntPtr status) 在 Microsoft.ML.TensorFlow.TensorFlowUtils.Runner.Run() 在 Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.UpdateCacheIfNeeded(Int64 位置, ITensorValueGetter[] srcTensorGetters, String[] activeOutputColNames, OutputCache outputCache) 在微软。 ML.Transforms.TensorFlowTransformer.Mapper.c__DisplayClass9_01.<MakeGetter>b__4(VBuffer1& dst) 在 Microsoft.ML.Data.TypedCursorable1.TypedRowBase.<>c__DisplayClass8_01.b__0(TRow 行) 在 Microsoft.ML.Data.TypedCursorable1.TypedRowBase.FillValues(TRow row) at Microsoft.ML.Data.TypedCursorable1.RowImplementation。 FillValues(TRow row) at Microsoft.ML.PredictionEngineBase2.FillValues(TDst prediction) at Microsoft.ML.PredictionEngine2.Predict(TSrc example, TDst& prediction) at Microsoft.ML.PredictionEngineBase2.Predict(TSrc example) at Microsoft.Extensions.ML.PredictionEnginePoolExtensions.Predict[TData,TPrediction](PredictionEnginePool2 predictionEnginePool, String modelName, TData example) at...
我怎样才能更深入地调查它以获得更多的见解?
出现此类问题的原因可能是什么?
还有一点需要注意:重启服务及其网络作业后问题消失。
【问题讨论】:
-
托管在云中的 Azure Function 应用发生了同样的异常。提出了关于 dotnet/machinelearning 的问题。 github.com/dotnet/machinelearning/issues/5361
标签: c# tensorflow azure-web-app-service ml.net