Home | Develop | Download | Contact
example_conv2dlayer_predict.cpp

Programa para el testeo de las funciones Fully Connected Layer.Para compilar o código example_conv2dlayer_predict.cpp:

g++ -static -o example_conv2dlayer_predict example_conv2dlayer_predict.cpp -lpdsramm -lpdsnnmm

Para executar o programa:

./example_conv2dlayer_predict

Retornando por consola:

Código example_conv2dlayer_predict.cpp:

#include <Pds/Ra>
#include <Pds/Nn>
int main(void)
{
Pds::SampleBlock Out;
unsigned int L=5;
// Input file
Pds::SampleBlock In=Pds::Matrix::ImportBmpFile("../manual/imagenes/pimienta-gray3.bmp");
//Pds::Matrix::ExportBmpFile(In[0],In[1],In[2],"in.bmp");
// Filtro Gabor
Pds::Matrix Gabor=Pds::Kernel2D::Gabor(L,6.0,5.5,Pds::Ra::Pi/4,8.0,0.0)/3;
Pds::Octave::Plot::ImageSc(Gabor,"testando.m","gabor5.png");
// Filtro Mean
Pds::Matrix Mean=Pds::Kernel2D::Mean(L)/3;
// Tensor con 2 filtros de 3 capas.
Pds::TensorBlock W={{Gabor,Gabor,Gabor},{Mean,Mean,Mean}};
Pds::Conv2DLayer Conv(W,Pds::Identity,Pds::DIdentity,{1, 1},Pds::Ra::Same);
Out=Conv.Predict(In);
for(unsigned int n=0;n<Out.size();n++)
Out[n].ExportBmpFile(Pds::Colormap::Gray,"out"+std::to_string(n)+".bmp");
return 0;
}
La clase tipo Pds::Conv2DLayer . Esta clase genera un objeto con parametros. Para usar incluir <Pds/C...
Definition: Conv2DLayer.hpp:61
std::vector< Pds::Matrix > Predict(const std::vector< Pds::Matrix > &Input) const
Evalua la capa de la Conv2D.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed