Skip to content

TensorFlow: Unable to find entry point 'TF_StringDecode' #6040

Description

@PMGruber

System information

  • OS version/distro: Win10 x64
  • .NET Version (eg., dotnet --info): .net Core 3.1
  • ML.NET Version: 1.7.0 with SciSharp.TensorFlow.Redist 2.7.0

Issue

  • What did you do?
    I load a pretrained TensorFlow model and execute it.

  • What happened?
    When executing predict method, I receive an exception "System.EntryPointNotFoundException: 'Unable to find an entry point named 'TF_StringDecode' in DLL 'tensorflow'.'"

  • What did you expect?
    Execution without error

Details

I have a simple Tensorflow model that makes a classification. As input the model gets an image (as float array). As output, the model provides a list of probabilities (one entry for each class. Datatype: float array) and a list of classnames (string array).

When I run the prediction, I receive the exception from above with source "TensorFlow.NET" and stack trace

   at Tensorflow.c_api.TF_StringDecode(Byte* src, UInt64 src_len, Byte** dst, UInt64& dst_len, SafeStatusHandle status)
   at Tensorflow.Tensor.StringData()
   at Microsoft.ML.TensorFlow.TensorFlowUtils.FetchStringData[T](Tensor tensor, Span`1 result)
   at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.<>c__DisplayClass11_0`1.<MakeGetter>b__1(VBuffer`1& dst)
   at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.<>c__DisplayClass7_0`2.<CreateConvertingVBufferSetter>b__0(TRow row)
   at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.FillValues(TRow row)
   at Microsoft.ML.Data.TypedCursorable`1.RowImplementation.FillValues(TRow row)
   at Microsoft.ML.PredictionEngineBase`2.FillValues(TDst prediction)
   at Microsoft.ML.PredictionEngine`2.Predict(TSrc example, TDst& prediction)
   at Microsoft.ML.PredictionEngineBase`2.Predict(TSrc example)
   at TensorflowString.Program.Main(String[] args) in 

When I execute the model and just read the column with float array it executes fine (not suprising, since exception states a problem with string type).

Here a code snippet from loading, preparing and executing the model:

            string _assetsPath = Path.Combine(Environment.CurrentDirectory, "assets");
            string _image = Path.Combine(_assetsPath, "input.png");
            string _model = Path.Combine(_assetsPath, "frozen_graph.pb");

            var bitmapImage = new Bitmap(_image);
            var floatImage = VerySlowBitmapTo1dFloatArrayConverter(bitmapImage);

            MLContext mlContext = new MLContext();
            var tensorflowModel = mlContext.Model.LoadTensorFlowModel(_model);

            var inputSchemaDefinition = SchemaDefinition.Create(typeof(ImageData));
            inputSchemaDefinition["Image"].ColumnType = new VectorDataViewType(NumberDataViewType.Single, 750 *500*3);
            inputSchemaDefinition["Image"].ColumnName = "x";

            var outputSchemaDefinition = SchemaDefinition.Create(typeof(ImagePrediction));
            outputSchemaDefinition["Result"].ColumnType = new VectorDataViewType(NumberDataViewType.Single, 15);
            outputSchemaDefinition["Result"].ColumnName = "Identity";
            outputSchemaDefinition["Classnames"].ColumnType = new VectorDataViewType(TextDataViewType.Instance, 15);
            outputSchemaDefinition["Classnames"].ColumnName = "Identity_1";

            var pipeline = tensorflowModel.ScoreTensorFlowModel(outputColumnNames: new[] { "Identity", "Identity_1" }, inputColumnNames: new[] { "x" }, addBatchDimensionInput: false);
            var data = mlContext.Data.LoadFromEnumerable(new List<ImageData>(), inputSchemaDefinition);
            var processingModel = pipeline.Fit(data);

            var imageData = new ImageData()
            {
                Image = floatImage
            };

            var predictor = mlContext.Model.CreatePredictionEngine<ImageData, ImagePrediction>(processingModel, inputSchemaDefinition: inputSchemaDefinition, outputSchemaDefinition: outputSchemaDefinition);
            var prediction = predictor.Predict(imageData);

I uploaded the test project to a private repository (I'm not allowed to make model public). If somebody wants it for a deeper look, I grant access.

I downloaded libtensorflow-cpu-windows-x86_64-2.7.0 from googleapis and had a look at the header files. I just found a comment with "// TF_StringEncode and TF_StringDecode facilitate this encoding." but no definition of "TF_StringDecode".
My C/C++ knowlege is quite low level so I'm stuck at this point.

Therefore I would appreciate any hints or ideas.

Thanks,
Philipp

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions