【问题标题】:ML.Net Image classification Error: Invalid argument: input must be 4-dimensional[224,224,3]ML.Net 图像分类错误:无效参数:输入必须是 4 维[224,224,3]
【发布时间】:2020-10-06 11:59:52
【问题描述】:

我收到此错误,我使用的是 ML.Net 1.5.2。我对 ML.Net 0.10.0 没有任何问题,但我最近升级了。

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}}]]

我的管道在下面,

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"));

【问题讨论】:

    标签: ml.net


    【解决方案1】:

    找到了解决办法。

    我需要在ScoreTensorFlowModel中设置addBatchDimensionInput = true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-12
      • 1970-01-01
      • 1970-01-01
      • 2020-02-17
      • 2016-12-11
      • 2016-10-14
      • 1970-01-01
      相关资源
      最近更新 更多