Inception 设置已更改:计算的输出大小将为负:-4 [input_size: 2, effective_filter_size: 7, stride: 1]
Inception settings changed: Computed output size would be negative: -4 [input_size: 2, effective_filter_size: 7, stride: 1]
我在 https://docs.microsoft.com/en-US/dotnet/machine-learning/tutorials/image-classification
上使用图像分类器 ML.net 示例代码
那里的分类使用以下初始设置
private struct InceptionSettings
{
public const int ImageHeight = 224;
public const int ImageWidth = 224;
public const float Mean = 117;
public const float Scale = 1;
public const bool ChannelsLast = true;
}
同时使用 tensorflow inception5h 模型。
它似乎在工作。然而,我不清楚,当我将 Height
和 Width
从 224 更改为 64 以减少预测的负载和精度 reuse and tune inception model
部分几乎立即崩溃
System.InvalidOperationException: Splitter/consolidator worker encountered exception while consuming source data ---> Microsoft.ML.Transforms.TensorFlow.TFException: Computed output size would be negative: -4 [input_size: 2, effective_filter_size: 7, stride: 1]
[[{{node avgpool0}}]]
at Microsoft.ML.Transforms.TensorFlow.TFStatus.CheckMaybeRaise(TFStatus incomingStatus, Boolean last)
at Microsoft.ML.Transforms.TensorFlow.TFSession.Run(TFOutput[] inputs, TFTensor[] inputValues, TFOutput[] outputs, TFOperation[] targetOpers, TFBuffer runMetadata, TFBuffer runOptions, TFStatus status)
at Microsoft.ML.Transforms.TensorFlow.TFSession.Runner.Run(TFStatus status)
at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.UpdateCacheIfNeeded(Int64 position, ITensorValueGetter[] srcTensorGetters, String[] activeOutputColNames, OutputCache outputCache)
at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.<>c__DisplayClass8_0`1.<MakeGetter>b__3(VBuffer`1& dst)
at Microsoft.ML.Data.DataViewUtils.Splitter.InPipe.Impl`1.Fill()
at Microsoft.ML.Data.DataViewUtils.Splitter.<>c__DisplayClass5_1.<ConsolidateCore>b__2()
--- End of inner exception stack trace ---
at Microsoft.ML.Data.DataViewUtils.Splitter.Batch.SetAll(OutPipe[] pipes)
at Microsoft.ML.Data.DataViewUtils.Splitter.Cursor.MoveNextCore()
at Microsoft.ML.Data.RootCursorBase.MoveNext()
at Microsoft.ML.Trainers.TrainingCursorBase.MoveNext()
at Microsoft.ML.Trainers.LbfgsTrainerBase`3.TrainCore(IChannel ch, RoleMappedData data)
at Microsoft.ML.Trainers.LbfgsTrainerBase`3.TrainModelCore(TrainContext context)
at Microsoft.ML.Trainers.TrainerEstimatorBase`2.TrainTransformer(IDataView trainSet, IDataView validationSet, IPredictor initPredictor)
at Microsoft.ML.Data.EstimatorChain`1.Fit(IDataView input)
at D:\My\MLTrainer.Program.ReuseAndTuneInceptionModel(MLContext mlContext, TrainerData trainerData, String dataLocation, String inputModelLocation, String outputModelLocation) in MLTrainer\Program.cs:line 66
at MLTrainer.Program.Main(String[] args) in D:\My\MLTrainer\Program.cs:line 29
现在我不知道我能做什么,也不知道问题隐藏在细节中的什么地方。预训练模型是否已经固定到这个有点奇怪的分辨率?分辨率本身似乎没有用在其他地方,我也不明白分离器为什么不喜欢它。
我是否遇到了某种我不知道的最小尺寸条件?如果是这样,界限是什么?例如,我尝试了 1024x1024,但因另一个错误而失败。
如有任何提示,我们将不胜感激:)
您可以安装 Netron 来查看您的模型。
你会看到在第一层会站着类似 Nx224x224x3 的东西。
该模型固定为此输入分辨率,因为它是用正好是此分辨率的大型数据集训练的。您可以使用例如更改输入层喀拉斯。
但我从未尝试更改 ML.NET.
中的输入层
我在 https://docs.microsoft.com/en-US/dotnet/machine-learning/tutorials/image-classification
上使用图像分类器 ML.net 示例代码那里的分类使用以下初始设置
private struct InceptionSettings
{
public const int ImageHeight = 224;
public const int ImageWidth = 224;
public const float Mean = 117;
public const float Scale = 1;
public const bool ChannelsLast = true;
}
同时使用 tensorflow inception5h 模型。
它似乎在工作。然而,我不清楚,当我将 Height
和 Width
从 224 更改为 64 以减少预测的负载和精度 reuse and tune inception model
部分几乎立即崩溃
System.InvalidOperationException: Splitter/consolidator worker encountered exception while consuming source data ---> Microsoft.ML.Transforms.TensorFlow.TFException: Computed output size would be negative: -4 [input_size: 2, effective_filter_size: 7, stride: 1]
[[{{node avgpool0}}]]
at Microsoft.ML.Transforms.TensorFlow.TFStatus.CheckMaybeRaise(TFStatus incomingStatus, Boolean last)
at Microsoft.ML.Transforms.TensorFlow.TFSession.Run(TFOutput[] inputs, TFTensor[] inputValues, TFOutput[] outputs, TFOperation[] targetOpers, TFBuffer runMetadata, TFBuffer runOptions, TFStatus status)
at Microsoft.ML.Transforms.TensorFlow.TFSession.Runner.Run(TFStatus status)
at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.UpdateCacheIfNeeded(Int64 position, ITensorValueGetter[] srcTensorGetters, String[] activeOutputColNames, OutputCache outputCache)
at Microsoft.ML.Transforms.TensorFlowTransformer.Mapper.<>c__DisplayClass8_0`1.<MakeGetter>b__3(VBuffer`1& dst)
at Microsoft.ML.Data.DataViewUtils.Splitter.InPipe.Impl`1.Fill()
at Microsoft.ML.Data.DataViewUtils.Splitter.<>c__DisplayClass5_1.<ConsolidateCore>b__2()
--- End of inner exception stack trace ---
at Microsoft.ML.Data.DataViewUtils.Splitter.Batch.SetAll(OutPipe[] pipes)
at Microsoft.ML.Data.DataViewUtils.Splitter.Cursor.MoveNextCore()
at Microsoft.ML.Data.RootCursorBase.MoveNext()
at Microsoft.ML.Trainers.TrainingCursorBase.MoveNext()
at Microsoft.ML.Trainers.LbfgsTrainerBase`3.TrainCore(IChannel ch, RoleMappedData data)
at Microsoft.ML.Trainers.LbfgsTrainerBase`3.TrainModelCore(TrainContext context)
at Microsoft.ML.Trainers.TrainerEstimatorBase`2.TrainTransformer(IDataView trainSet, IDataView validationSet, IPredictor initPredictor)
at Microsoft.ML.Data.EstimatorChain`1.Fit(IDataView input)
at D:\My\MLTrainer.Program.ReuseAndTuneInceptionModel(MLContext mlContext, TrainerData trainerData, String dataLocation, String inputModelLocation, String outputModelLocation) in MLTrainer\Program.cs:line 66
at MLTrainer.Program.Main(String[] args) in D:\My\MLTrainer\Program.cs:line 29
现在我不知道我能做什么,也不知道问题隐藏在细节中的什么地方。预训练模型是否已经固定到这个有点奇怪的分辨率?分辨率本身似乎没有用在其他地方,我也不明白分离器为什么不喜欢它。
我是否遇到了某种我不知道的最小尺寸条件?如果是这样,界限是什么?例如,我尝试了 1024x1024,但因另一个错误而失败。
如有任何提示,我们将不胜感激:)
您可以安装 Netron 来查看您的模型。
你会看到在第一层会站着类似 Nx224x224x3 的东西。
该模型固定为此输入分辨率,因为它是用正好是此分辨率的大型数据集训练的。您可以使用例如更改输入层喀拉斯。 但我从未尝试更改 ML.NET.
中的输入层