以下方法之间的调用不明确训练神经网络 [英] The call is ambiguous between the followings methods Train Neural network

查看:66
本文介绍了以下方法之间的调用不明确训练神经网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个错误说:以下方法之间的调用是模棱两可的.这是我的代码

Hello everybody I have the error that said:The call is ambiguous between the followings method. This is my code

      Matrix<int> layerSize = new Matrix<int>(new int[] { 400, 200,2  });

      MCvANN_MLP_TrainParams parameters = new MCvANN_MLP_TrainParams();
      parameters.term_crit = new MCvTermCriteria(10, 1.0e-8);
      parameters.train_method = Emgu.CV.ML.MlEnum.ANN_MLP_TRAIN_METHOD.BACKPROP;
      parameters.bp_dw_scale = 0.1;
      parameters.bp_moment_scale = 0.1;

      using (ANN_MLP network = new ANN_MLP(layerSize,   Emgu.CV.ML.MlEnum.ANN_MLP_ACTIVATION_FUNCTION.SIGMOID_SYM, 1.0, 1.0))
      {
          network.Train(train, clases, null, null, parameters, Emgu.CV.ML.MlEnum.ANN_MLP_TRAINING_FLAG.DEFAULT);


      }

我知道问题是编译器不了解我想使用哪种属性方法,但是使用network.train()我有3个选项,问题是:

I know that problem is that the compiler do not understand what method of property I want to use but using network.train() I have 3 options and the problem is that:

火车(矩阵trainData矩阵响应矩阵样本权重,矩阵sampleIdx,MCvANN_MLP_TrainParams参数,ANN_MLP_TRAINING_FLAG标志)

Train( Matrix trainData, Matrix responses, Matrix sampleWeights, Matrix sampleIdx, MCvANN_MLP_TrainParams parameters, ANN_MLP_TRAINING_FLAG flag )

火车(矩阵trainData矩阵响应矩阵样本权重,矩阵sampleMask,MCvANN_MLP_TrainParams参数,ANN_MLP_TRAINING_FLAG标志)

Train( Matrix trainData, Matrix responses, Matrix sampleWeights, Matrix sampleMask, MCvANN_MLP_TrainParams parameters, ANN_MLP_TRAINING_FLAG flag )

由于这个原因,我不想同时使用Matrix sampleWeights和Matrix sampleMask,因此编译器不知道我要使用什么构造函数.您对此有什么解决方案吗?

I don't want to use Matrix sampleWeights,Matrix sampleMask for that reason I put null in both and so compiler do not know what constructor I want to use. Do you have any solution for that?

推荐答案

您提到的两个方法都具有完全相同的签名,因此它们不能在第一位重载.我认为您打错了字(在 Matrix sampleMask ).

Both methods you mentioned have exact same signature due to which they cannot be overloaded at first place. I think you made a typo (at Matrix sampleMask).

但是,为了避免在要传递NULL或对象类型时出现这种歧义,需要对参数进行类型转换.对于当前方案,您可能需要如下修改代码.

However, to avoid such ambigous situation when you want to pass NULL or object type, you would need to typecast the parameters. For the current scenario you may have to modify the code as below.

network.Train(train, clases, (Matrix) null, (Matrix) null, parameters, Emgu.CV.ML.MlEnum.ANN_MLP_TRAINING_FLAG.DEFAULT);

这篇关于以下方法之间的调用不明确训练神经网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆