machinelearning: Can't make image classification prediction on MacOS using a Tensorflow model
System Information (please complete the following information):
- OS & Version: MacOS 12.4
- ML.NET Version: Microsoft.ML 1.7.1
- .NET Version: NET 6.0
Describe the bug It seems impossible to make prediction based on images using a Tensorflow model on Mac. I’m always getting this error:
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array. at Microsoft.ML.Transforms.Image.ImagePixelExtractingTransformer.Mapper.<>c__DisplayClass5_01.<GetGetterCore>b__1(VBuffer1& dst) at Microsoft.ML.Transforms.TensorFlowTransformer.TensorValueGetterVec1.GetTensor()
at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.UpdateCacheIfNeeded(Int64 position, ITensorValueGetter[] srcTensorGetters, String[] activeOutputColNames, OutputCache outputCache)
at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.<>c__DisplayClass11_01.<MakeGetter>b__4(VBuffer1& dst)
at Microsoft.ML.Data.TypedCursorable1.TypedRowBase.<>c__DisplayClass8_01.<CreateDirectVBufferSetter>b__0(TRow row)
at 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)
The exact same code with same model and same images to predict works flawlessly on Windows 10.
To Reproduce Steps to reproduce the behavior:
- Train a Tensorflow Model (I trained the model using Python)
- Import the trained model in ML.NET
- Try to make a prediction starting from an image
- See error
Expected behavior Make predictions without exceptions.
Screenshots, Code, Sample Projects If applicable, add screenshots, code snippets, or sample projects to help explain your problem.
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (11 by maintainers)
I’m using the new package and it is indeed working on Mac and on Ubuntu Focal Docker containers. Thanks!