In the Multi Classes Classification problem, we will introduce how to divide your own image data into Training, Validation, and Test.
Suppose that the image data you have is in the input folder as shown in the figure below.
<img width="300", alt="image.png " src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/208980/bf6cf0ab-9452-272d-bfe8-8f0981b9182e.png "> I would like to divide the image data into training, validation, and test folders as shown in the figure below. <img width="300", alt="image.png ", src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/208980/7c1eae06-3cfd-8b31-7f0c-1ba898b1315b.png ">
pip install split-folders
Create a Python program. Import the split-folders
module and execute the code below.
import split_folders
# Split with a ratio.
# To only split into training and validation set, set a tuple to `ratio`, i.e, `(.8, .2)`.
split_folders.ratio('input_folder', output="output", seed=1337, ratio=(.8, .1, .1)) # default values
Recommended Posts