I have a .NET Core 3 app for image classification, using Microsoft's ML.NET framework.
On my development machine, I can run the code and it all works fine.
However, when I deploy it to my staging server, I get this error at runtime:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. System.DllNotFoundException: Unable to load DLL 'tensorflow' or one of its dependencies: The specified module could not be found. (0x8007007E) at Tensorflow.c_api.TF_NewGraph() at Tensorflow.Graph..ctor() at Microsoft.ML.Transforms.Dnn.DnnUtils.LoadTFSession(IExceptionContext ectx, Byte modelBytes, String modelFile) ...
I've tried copying tensorflow.dll into the bin folder during deployment; I've tried building as x64, x86, or AnyCPU. I've verified that the SciSharp.TensorFlow.Redist and Microsoft.ML.Tensorflow.Redist NuGet packages are included. Nothing so far has worked.
Any idea why it can't find the DLL file, or how I can get it to work?
I've figured out the root cause.
Reason 1: Microsoft.ML works on x64 only
Reason 2: Latest stable version (1.4.0) of below packages is throwing error. Below v1.3.1 packages are working fine.
Reason 3: ML.NET and Tensor flow works fine only in .NET CORE not in .NET framework.
Hope this works for you too ! Happy Coding !
User contributions licensed under CC BY-SA 3.0