C++读取MINIST数据集

注意:必须考虑大端小端对齐的问题,我的电脑就是大端对齐的,但是我只对图片数量的读数做了处理,

#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
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值