Reputation: 2572
I ran into a bug using ML.NET Transforms.
The pipeline is set up by declaring a Transform and then appending more transforms to it, like so:
var pipeline = mlContext.Transforms.ResizeImages(outputColumnName: "image",
imageWidth: imageWidth,
imageHeight: imageHeight,
inputColumnName: nameof(ImageNetData.Image)) // Resizes the image
.Append(mlContext.Transforms.ExtractPixels(outputColumnName: "image",
inputColumnName: "image")) //Transforms the image to floats
.Append(mlContext.Transforms.ApplyOnnxModel(modelFile: modelLocation,
outputColumnNames: new[] { TinyYoloModelSettings.ModelOutput},
inputColumnNames: new[] { TinyYoloModelSettings.ModelInput }));// Runs the image through the network
//Output: An EstimatorChain that runs ALL THREE above steps
But running the same code without method-chaining produces a different output.
var pipeline = mlContext.Transforms.ResizeImages(outputColumnName: "image",
imageWidth: imageWidth,
imageHeight: imageHeight,
inputColumnName: nameof(ImageNetData.Image)); // Resizes the image
pipeline.Append(mlContext.Transforms.ExtractPixels(outputColumnName: "image",
inputColumnName: "image")); //Transforms the image to floats
pipeline.Append(mlContext.Transforms.ApplyOnnxModel(modelFile: modelLocation,
outputColumnNames: new[] { TinyYoloModelSettings.ModelOutput},
inputColumnNames: new[] { TinyYoloModelSettings.ModelInput }));// Runs the image through the network
//Output: An EstimatorChain that runs only the first step
What is it about method chaining that produces a different output?
Upvotes: 2
Views: 200