如何解决我的程序无法正确访问来自 MNIST 的日期集
晚上好,我想创建一个能够检测图像中数字的小型神经网络。我正在使用来自 MNIST 的数据集。
我已经使用 this code 和 this code 进行测试,但解压肯定有问题。存储的图像和标签值始终为空。下面是我自己的代码,它也不起作用。
extern const string mnist_img = "ressources/train-images.idx3-ubyte";
extern const string mnist_lab = "ressources/train-labels.idx1-ubyte";
void firstRead(){
image.open(mnist_img,ios::in | ios::binary );
label.open(mnist_lab,ios::in | ios::binary );
char *number;
for (int i = 1; i <= 16; ++i) {
image.read(reinterpret_cast<char*>(number),sizeof(4));
cout << number << endl;
}
for (int i = 1; i <= 8; ++i) {
label.read(reinterpret_cast<char*>(number),sizeof(4));
cout << number << endl;
}
}
这些文件被 gunzip 破坏了,我确实使用了 winrar 来解压它们,并且文件大小也与 MNIST 网站上的未破坏文件相匹配。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。