【问题标题】:Character Recognizing using Aforge.net Nural network使用 Aforge.net 神经网络进行字符识别
【发布时间】:2014-06-07 14:56:49
【问题描述】:

我正在尝试使用 Aforge.net 识别 0 到 9 位数字。我尝试了所有方法,但仍然无法获得结果,请查看我的程序以及为什么我无法识别数字。问题可能出在隐藏层数、学习率或输入数据上,我通过更改隐藏层数和学习率进行了尝试。请提出想法。

// opening file
OpenFileDialog open = new OpenFileDialog();
ActivationNetwork enactivation = new ActivationNetwork(new BipolarSigmoidFunction(1),  3886,10, 10);
double[][] input = new double[10][];
double[][] output = new double[10][];
//generating input data using Feature class -- which code is given below

Feature feature = new Feature();

//iterating for all 10 digits. 
for (int i = 0; i < 10; i++)
        {
           open.ShowDialog();
           Bitmap bitmap = new Bitmap(open.FileName);
          double[] features = feature.features(bitmap);
            input[i] = features;
             features = feature.features(bitmap);
            output[i] = feature.features(bitmap);
         }

enactivation.Randomize();
        BackPropagationLearning learn = new BackPropagationLearning(enactivation);
//learning 
        learn.LearningRate = 0.005f;
        learn.Momentum = 0.005f;
        double errora;
        int iteration = 0;

        while (true)
        {
            errora = learn.RunEpoch(input, output);
            if (errora < 0.0006)
                break;
            else if (iteration > 23000)
               break;
            iteration++;
           // Console.WriteLine("error {0} {1} ", errora, iteration);
       }
       double[] sample;
        open.ShowDialog();
        Bitmap temp = new Bitmap(open.FileName);
       // providing input for computation using feature class
        sample = feature.features(temp);
        foreach (double daa in enactivation.Compute(sample))
        {
            Console.WriteLine(daa);
        }

为训练神经网络提供输入的类特征 类特征 {

    public double[] features(Bitmap bitmap)
    {
        //feature 
        double[] feature = new double[bitmap.Width * bitmap.Height];
       int featurec = 0;
        for (int vert = 0; vert < bitmap.Height; vert++)
        {
            for (int horizantal = 0; horizantal < bitmap.Width; horizantal++)
            {
                feature[featurec] = bitmap.GetPixel(horizantal, vert).ToArgb();
                if (feature[featurec] < 1)
                {
                    feature[featurec] = -0.5;
                }
                else
                {
                    feature[featurec] = 0.5;
                }
                featurec++;
            }
        }
        return feature;
    }

}

【问题讨论】:

  • 我建议你看一下Accord.NET,它实际上是 AForge.NET Framework 的扩展。在Samples Gallery你还会发现一些手写字符识别应用程序和类似的。

标签: c# .net artificial-intelligence aforge


【解决方案1】:

我没有用过 aforge,但是 re.使用反向传播神经网络解决这个问题:

  1. 您需要一个 10x10 的输入网格,网格中的每个单元格占图像的 1/100

  2. 您至少需要一个,可能是 2 个隐藏层

  3. 使用偏差输入(即固定值的来源)对每个单元格网络将训练得更快(这让单元格训练得更快:Role of Bias in Neural Networks

  4. 我永远不会在 bp 模式下启动,但总是先运行一些统计退火。 Bp 用于在找到一个局部最小值后下降

还有:

  • 您是否成功使用 aforge 解决了其他问题?

  • 当您尝试训练网络时会发生什么?

【讨论】:

  • 您好,感谢您的回答。是的,我已经用于计算机视觉。我第一次使用神经网络,当我训练输入和输出数据,然后尝试识别它给出错误答案的任何字符时。假设我喂它 1 并且它识别它 8 。你能测试一下上面的代码,请告诉我问题出在哪里。
猜你喜欢
  • 2017-01-30
  • 2011-12-12
  • 2015-12-31
  • 2011-09-18
  • 2016-09-15
  • 2012-03-31
  • 2014-03-15
  • 1970-01-01
  • 2017-12-03
相关资源
最近更新 更多