54 Pds::Matrix IMGA1=Pds::Matrix::ImportBmpFileAsGray(
"../manual/imagenes/happy.bmp");
55 Pds::Matrix IMGA2=Pds::Matrix::ImportBmpFileAsGray(
"../manual/imagenes/sad.bmp");
56 Pds::Matrix IMGB1=Pds::Matrix::ImportBmpFileAsGray(
"../manual/imagenes/self-confidence.bmp");
57 Pds::Matrix IMGB2=Pds::Matrix::ImportBmpFileAsGray(
"../manual/imagenes/fear.bmp");
58 Pds::Matrix IMGC0=Pds::Matrix::ImportBmpFileAsGray(
"../manual/imagenes/pokerface.bmp");
60 unsigned int Nlin=IMGA1.Nlin();
61 unsigned int Ncol=IMGA1.Ncol();
63 Pds::Matrix Y(5,Nlin*Ncol);
64 Y.SetRowVector(0,Pds::Vector(IMGA1));
65 Y.SetRowVector(1,Pds::Vector(IMGA2));
66 Y.SetRowVector(2,Pds::Vector(IMGB1));
67 Y.SetRowVector(3,Pds::Vector(IMGB2));
68 Y.SetRowVector(4,Pds::Vector(IMGC0));
71 Pds::Matrix Ys(Y.Size());
74 Pds::Matrix X=
" 0.0 1.0\n"
80 std::cout<<
"Ninputs:"<<X.Ncol()<<std::endl;
81 std::cout<<
"Noutputs:"<<Y.Ncol()<<std::endl;
84 std::vector<unsigned int> N={X.Ncol(),4096,2048,Y.Ncol()};
87 for(
unsigned int k=0;(k<M)&&(Acc<1.0);k++)
93 Acc=Pds::Accuracy(Ys.Geq(0.5),Y);
94 std::cout<<
"Test["<<std::setw(3)<<k<<
"] ";
95 std::cout<<
"Accuracy %: "<<100.0*Acc<<std::endl;
99 X=Pds::Matrix(1,X.Ncol()); Ys=Pds::Matrix(1,Y.Ncol());
100 std::vector<Pds::Matrix> Block;
103 for(
unsigned int k=0;k<360;k=k+5)
105 X.Set( 0, cos(k*Pds::Ra::Pi/180.0) );
106 X.Set( 1, sin(k*Pds::Ra::Pi/180.0) );
109 IMG=Ys.Remodel(Nlin,Ncol)*255;
110 Block.push_back(IMG);
113 Pds::Matrix::ExportAsGif(Block,
"smiles.gif",20);
La clase tipo Pds::FCNn . Esta clase genera un objeto con dos parametros Nlin y Ncol....
const std::string FCNn
Tag de un objeto de tipo Pds::FCNn.
bool Training(const Pds::Matrix &X, const Pds::Matrix &Y, double alpha, double lambda)
Treina la NN como um bloque de datos entero X para encontrar una variacion de pesos.
Pds::SampleBlock Predict(const Pds::SampleBlock &In) const
Evalua la capa de la CNN.