main.cpp 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <iomanip>
  2. #include "layers/layers.hpp"
  3. #include "network.hpp"
  4. #include "mnist/mnist.hpp"
  5. #include <chrono>
  6. #include "avx.hpp"
  7. using namespace Layer;
  8. int main(int argc,char** argv){
  9. size_t nf=4;
  10. ConvolutionLayer L(1,28,28,5,5,nf);
  11. L.init(0,1);
  12. Mnist dataset;
  13. pair<Vector,Vector> data=dataset.get_train(0);
  14. Vector y=L.feed_forward(data.first);
  15. exit(0);
  16. Network N;
  17. //size_t nf=4;
  18. ConvolutionLayer L1(1,28,28,5,5,nf);
  19. L1.init(0,1);
  20. ActivationLayer<Sigmoid> L2(nf*24*24);
  21. //Layer::Pooling L3(nf,24,24,2,2);
  22. FullConnectedLayer L4(nf*24*24,10);
  23. L4.init_standard();
  24. ActivationLayer<Sigmoid> L5(10);
  25. L1.name="[Convolutionnal]";
  26. L2.name="[Sigmoid of convolutionnal]";
  27. //L3.name="[Pooling]";
  28. L4.name="[Full connected]";
  29. L5.name="[Sigmoid of full]";
  30. N.push_layer(L1);
  31. N.push_layer(L2);
  32. // N.push_layer(&L3);
  33. N.push_layer(L4);
  34. N.push_layer(L5);
  35. N.is_done();
  36. //Mnist dataset;
  37. N.train(&dataset,1,10,0.1);
  38. }