Neural
mnist.h
Go to the documentation of this file.
1 #ifndef MNIST_H
2 #define MNIST_H
3 
4 #include <vector>
5 #include <string>
6 #include <eigen3/Eigen/Dense>
7 
8 class mnist {
9 private:
10  std::vector<std::vector<double>> m_images;
11  std::vector<int> m_labels;
12  int m_size;
13  int m_rows;
14  int m_cols;
15 
16  void load_images(std::string file, int num=0);
17  void load_labels(std::string file, int num=0);
18  int to_int(char* p);
19 
20 
21 public:
22  mnist(std::string image_file, std::string label_file, int num);
23  mnist(std::string image_file, std::string label_file);
24  ~mnist();
25 
26  int size() { return m_size; }
27  int rows() { return m_rows; }
28  int cols() { return m_cols; }
29 
30  std::vector<double> images(int id) { return m_images[id]; }
31  int labels(int id) { return m_labels[id]; }
32 
33  struct {
34  Eigen::MatrixXd images;
35  Eigen::MatrixXd labels;
36  } data;
37 
38 };
39 
40 #endif
mnist::cols
int cols()
Definition: mnist.h:28
mnist::rows
int rows()
Definition: mnist.h:27
mnist::size
int size()
Definition: mnist.h:26
mnist::mnist
mnist(std::string image_file, std::string label_file, int num)
Definition: mnist.cpp:19
mnist::images
std::vector< double > images(int id)
Definition: mnist.h:30
mnist
Definition: mnist.h:8
mnist::data
struct mnist::@0 data
mnist::~mnist
~mnist()
Definition: mnist.cpp:37
mnist::images
Eigen::MatrixXd images
Definition: mnist.h:34
mnist::labels
int labels(int id)
Definition: mnist.h:31
mnist::labels
Eigen::MatrixXd labels
Definition: mnist.h:35