【发布时间】:2021-12-08 23:45:53
【问题描述】:
我正在尝试使用 python split-folders 将一组图像(.bmp 格式)数据集拆分为训练和测试文件夹。为此,我使用了以下代码。代码块执行成功,没有任何错误,但没有将图像文件夹拆分为测试和训练文件夹。 我的数据集在“ZZ”文件夹中,我想将数据集拆分到“Res”文件夹中。我在 anaconda 环境中使用 python 3.7.11。我该如何解决这个问题。帮助欣赏。
import os
import splitfolders
input_folder = "zz/"
output = "res" #where you want the split datasets saved. one will be created if none is set
# ratio of split are in order of train/val/test.
#You can change to whatever you want. For train/val sets only, you could do .75, .25 for example.
splitfolders.ratio(input_folder, output, seed=1337, ratio=(.75, .25))
【问题讨论】:
标签: python-3.x jupyter-notebook miniconda