dotnet / dotnet/machinelearning
Using Onnx trained on Keras with PreprocessInput
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
I have issue when i using onnx model trained with keras and _preprocess_input_, is ResNet50 model,
if i training without _preprocess_input_ on keras it work on ml.net but when i use _preprocess_input_ will not work, according documentation preprocess_input will process image with caffe style that mean:
_The images are converted from RGB to BGR, then each color channel is zero-centered with respect to the ImageNet dataset, without scaling._
this work without _preprocess_input_
```
var dataschema = mlContext.Data.LoadFromEnumerable(new List());
var transformer =
mlContext.Transforms.ExtractPixels(outputColumnName: "input_1", nameof(ImageNetData.BitImage), interleavePixelColors: true)
.Append(mlContext.Transforms.ApplyOnnxModel(modelFile: path, outputColumnNames: new[] { "fc360" }, inputColumnNames: new[] { "input_1" })) //gpuDeviceId:0
.Fit(dataschema);
```
i tried this convert from RGB to BGR but i dont see any parameter for zero-centered color mode
`mlContext.Transforms.ExtractPixels(outputColumnName: "input_1", nameof(ImageNetData.BitImage), orderOfExtraction: ImagePixelExtractingEstimator.ColorsOrder.ABGR, interleavePixelColors: true)`
Maybe i miss something ???
Contributor guide
Assessment
This issue has not been assessed yet.