0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Python】多重分類問題のTraining, Validation, Testフォルダーを簡単に作る方法

Last updated at Posted at 2020-03-27

#はじめに

多重分類問題(Multi Classes Classification)において、自前の画像データをTraining, Validation, Testに分ける方法を紹介します。

#やりたいこと

自分が持っている画像データが下記の図のようにinputフォルダーにあるとします。

image.png
その画像データを下記の図のようにtraining, Validation, Testフォルダーに分けたいと思います。
image.png

#インストール方法
pip install split-folders

#使い方
Pythonプログラムを作成します。split-foldersモジュールをインポートして、下記のコードを実行します。

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


#関連資料

  1. [Split Folders]https://github.com/jfilter/split-folders
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?