C++版DNN最简主体框架
附属代码:
基本代码:
将要学习的图片,手写数字1
下面是演示代码:
int main() { string labelpath="D:/Qt/MyImage/MNIST/train-labels.idx1-ubyte"; string imgpath="D:/Qt/MyImage/MNIST/train-images.idx3-ubyte"; //构建神经网络 DNN dnn; dnn.readImgLib(labelpath,imgpath); // 下面是230次循环训练所有权重 for(int i=0;i<1;i++) { dnn.calcForeward(); dnn.calcBackward(0.01); } cout<<"the real output of dnn!"<<endl; cout<<dnn.nnet.out_a<<endl; cout<<"the expected output of dnn!"<<endl; cout<<dnn.nnet.expect_a<<endl; waitKey(); return 0; }
下面是输出结果: