注意:必须考虑大端小端对齐的问题,我的电脑就是大端对齐的,但是我只对图片数量的读数做了处理,
#include <vector>
#include <iostream>
#define TEST_LIUKE0 10
#define TEST_LIUKE1 1
const char* train_images_idx3_ubyte_file = "MNIST_data/train-images.idx3-ubyte";
const char* train_labels_idx1_ubyte_file = "MNIST_data/train-labels.idx1-ubyte";
const char* test_images_idx3_ubyte_file = "MNIST_data/t10k-images.idx3-ubyte";
const char* test_labels_idx1_ubyte_file = "MNIST_data/t10k-labels.idx1-ubyte";
void read_data_train_image(std::vector<double>& Train_Data)
{
char32_t MAGIC_NUMBER = 0;
char32_t NUM_OF_IMAGES = 0;
char32_t NUM_OF_ROWS = 0;
char32_t NUM_OF_COLS = 0;
FILE* fp = fopen(train_images_idx3_ubyte_file, "rb");
if (fp == NULL)
{
printf("unable open MNIST_data/train-im