在 F# 中导入 CIFAR-10 数据集

Importing CIFAR-10 Data set in F#

我尝试在 F# 中导入 CIFAR-10 数据集“https://www.cs.toronto.edu/~kriz/cifar.html”,共有三种格式; python,分别是matlab(MAT)和binary(bin)。请随时评论如何导入数据集?

您将不得不使用数据集的二进制版本。 CIFAR页面上的描述很清楚:

The first byte is the label of the first image, which is a number in the range 0-9. The next 3072 bytes are the values of the pixels of the image. The first 1024 bytes are the red channel values, the next 1024 the green, and the final 1024 the blue. The values are stored in row-major order, so the first 32 bytes are the red channel values of the first row of the image.

您没有以任何方式指定您希望如何导入数据集,以下是我认为有意义的内容:

  • .tar.gz 文件中提取 6 个批次
  • 每批次:
  • 创建一个二进制文件reader
  • 读取包含标签的字节
  • 实例化一个大小为 32 x 32
  • System.Drawing.Bitmap
  • 遍历图像的行和列,从文件中读取一个字节,设置在图像的红色通道中
  • 对绿色和蓝色通道重复该操作。
  • 以您的最终格式存储(例如,包含单个 PNG 文件的目录)