将数据集拆分为训练和测试

Splitting dataset into train and test

我下载了这个包含数字和其他数学符号的数据集,其中包含大约 380 000 张图像,分为 80 个不同的文件夹,每个文件夹都以其代表的符号命名。对于这个机器学习项目,我需要得到 traintest 集,它们同样代表每个符号。例如之前数据集中符号文件夹的1/3进入测试目录2/3进入 train dir。我尝试了很多次,但我总是得到一个无效的代码,遍历每个项目,持续了很长时间,甚至没有完成。

数据集: https://www.kaggle.com/xainano/handwrittenmathsymbols/

您正在使用的数据集有 extractor.py 自动为您执行此操作的脚本

Scripts info

extract.py

  • Extracts trace groups from inkml files.
  • Converts extracted trace groups into images. Images are square shaped bitmaps > with only black (value 0) and white (value 1) pixels. Black color denotes patterns (ROI).
  • Labels those images (according to inkml files).
  • Flattens images to one-dimensional vectors.
  • Converts labels to one-hot format.
  • Dumps training and testing sets separately into outputs folder.

在此处访问其 github:https://github.com/ThomasLech/CROHME_extractor