以 CSV 的形式为 Conv 神经网络解析修改后的 MNIST

Parsing modified MNIST in the form of CSV for Conv Neural Network

我打算使用这个 modified version of MNIST 进行基准研究,但它们目前是 .mat 格式。所以,我在 Whosebug 上读到 MatlabRecordReader 实际上并不是那么可靠,将数据更改为 CSV 格式要聪明得多。 我已经下载了 Matlab 并将 .mat 文件更改为具有 60000(用于测试数据)行的 .csv 文件,每行的前 784 个值是图像本身的像素值,最后 10 个值是标签(虽然我相信我可以很容易地将标签压缩为前 784 个值末尾的一个值)。

既然我有了这些数据,我不确定我应该如何将它正确地传递给我的 Conv 神经网络 IteratorRecordReaderDatasetIteratorI've looked up the documentation, but this isn't exactly what I need, and looking up the examples in the the docs 也差点错过,因为它将 CSV 文件的行视为一维向量(与矩阵并列)或格式化数据以进行线性回归。

我希望这已经足够清楚了。有人可以帮助我吗?


使用 CSVRecordReader,并将标签作为 0 到 9 的整数附加到每行的末尾。

在底部使用 convolutionalFlat 作为 setInputType。 示例片段: .setInputType(InputType.convolutionalFlat(28,28,1)) .backprop(true).pretrain(false).build();

神经网络配置的完整代码示例: https://github.com/deeplearning4j/dl4j-examples/blob/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/convolution/LenetMnistExample.java