-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathcreate_splits.py
33 lines (25 loc) · 1.03 KB
/
create_splits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import argparse
import glob
import os
import random
import numpy as np
from utils import get_module_logger
def split(source, destination):
"""
Create three splits from the processed records. The files should be moved to new folders in the
same directory. This folder should be named train, val and test.
args:
- source [str]: source data directory, contains the processed tf records
- destination [str]: destination data directory, contains 3 sub folders: train / val / test
"""
# TODO: Implement function
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Split data into training / validation / testing')
parser.add_argument('--source', required=True,
help='source data directory')
parser.add_argument('--destination', required=True,
help='destination data directory')
args = parser.parse_args()
logger = get_module_logger(__name__)
logger.info('Creating splits...')
split(args.source, args.destination)