728x90
    반응형

    import splitfolders
    
    dataset_path = 'D:\\Datasets\\kaggle\\Decks'
    output_path = dataset_path + '_splitted'
    
    print("dataset_path: ",dataset_path)
    print("output_path: ",output_path)
    print("splitfolders: start")
    splitfolders.ratio(dataset_path, output=output_path, seed=1337, ratio=(0.8, 0.2))       # Train / Valid
    #splitfolders.ratio(dataset_path, output=output_path, seed=1337, ratio=(0.8, 0.1, 0.1))  # Train / Valid / Test
    print("splitfolders: end")

     

    이미지 폴더가 아닌, 이미지 폴더가 들어있는 폴더 경로를 잡아줘야 한다. 

    패키지 이름 : splitfolders(x) split-folders(o)

     

    후 (각 폴더마다 클래스별로 분류되어있음)


    https://stackoverflow.com/questions/53074712/how-to-split-folder-of-images-into-test-training-validation-sets-with-stratified

     

    How to split folder of images into test/training/validation sets with stratified sampling?

    I have a very large folder of images, as well as a CSV file containing the class labels for each of those images. Because it's all in one giant folder, I'd like to split them up into training/test/

    stackoverflow.com


    https://pypi.org/project/split-folders/

     

    split-folders

    Split folders with files (e.g. images) into training, validation and test (dataset) folders.

    pypi.org

     

    728x90
    반응형
    • 네이버 블러그 공유하기
    • 네이버 밴드에 공유하기
    • 페이스북 공유하기
    • 카카오스토리 공유하기