C# 使用FORGE.net Nural网络进行字符识别
我正在尝试使用forge.net识别0到9个数字。我尝试了一切,但我仍然无法得到结果请看我的程序,为什么我无法识别数字。问题可能在于隐藏层的数量、学习速度或输入数据,我尝试过通过改变隐藏层的数量和学习速度。请提出建议C# 使用FORGE.net Nural网络进行字符识别,c#,.net,artificial-intelligence,aforge,C#,.net,Artificial Intelligence,Aforge,我正在尝试使用forge.net识别0到9个数字。我尝试了一切,但我仍然无法得到结果请看我的程序,为什么我无法识别数字。问题可能在于隐藏层的数量、学习速度或输入数据,我尝试过通过改变隐藏层的数量和学习速度。请提出建议 // opening file OpenFileDialog open = new OpenFileDialog(); ActivationNetwork enactivation = new ActivationNetwork(new BipolarSigmoidFunction
// 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);
}
用于为训练神经网络提供输入的类功能
类特征
{
}我没有用过一个单词,但用了re。使用backprop神经网络解决此问题: 您需要一个10x10的输入网格,网格中的每个单元格获得图像的1/100 您需要至少一个(可能是两个)隐藏层 对于每个单元,网络将通过偏置输入(即固定值的来源)更快地训练,这使单元训练更快: 我从不在bp模式下启动,但总是先运行一些统计退火。Bp用于在找到一个局部最小值后,在该最小值内下降 此外: 您是否成功地使用了Forge解决其他问题 当你尝试训练网时会发生什么
我建议您看看这实际上是一个org.NET框架的扩展。在中,您还会发现一些手写字符识别应用程序和类似的应用程序。您好,谢谢您的回答。是的,我用过电脑视觉。我第一次使用nural网络,当我训练输入和输出数据,然后尝试识别任何给出错误答案的字符时。假设我喂它1,它认出它8。你们能测试上面的代码吗?请告诉我问题出在哪里。
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;
}