I am getting this error, I am using ML.Net 1.5.2. I am having no issues with ML.Net 0.10.0, but I recently upgraded.
2020-10-06 11:51:40.611074: W tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at conv_ops_fused_impl.h:716 : Invalid argument: input must be 4-dimensional[224,224,3]
input must be 4-dimensional[224,224,3]
[[{{node conv2d0}}]]
My pipeline is below,
var pipeline = _mlContext.Transforms.Conversion.MapValueToKey(outputColumnName: LabelTokey, inputColumnName: "Label")
.Append(_mlContext.Transforms.LoadImages(ImageReal, trainImagesFolder, nameof(ImageNetData.ImagePath)))
.Append(_mlContext.Transforms.ResizeImages(outputColumnName: ImageReal, imageWidth: ImageNetSettings.imageWidth, imageHeight: ImageNetSettings.imageHeight, inputColumnName: ImageReal))
.Append(_mlContext.Transforms.ExtractPixels(outputColumnName: "input", inputColumnName: ImageReal, interleavePixelColors: ImageNetSettings.channelsLast, offsetImage: ImageNetSettings.mean))
.Append(_mlContext.Model.LoadTensorFlowModel(_settings.InceptionPath)
.ScoreTensorFlowModel(outputColumnNames: new[] { "softmax2_pre_activation" }, inputColumnNames: new[] { "input" }))
.Append(_mlContext.MulticlassClassification.Trainers.LbfgsMaximumEntropy(labelColumnName: LabelTokey, featureColumnName: "softmax2_pre_activation"))
.Append(_mlContext.Transforms.Conversion.MapKeyToValue(PredictedLabelValue, "PredictedLabel"));
Found the solution.
I need to set
addBatchDimensionInput = true
inScoreTensorFlowModel