Skip to content

Commit

Permalink
Fix data load feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Seungmin Oh committed Jan 18, 2021
1 parent 87fab5c commit f67b6ca
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def str2bool(v):
help='Load best model or most recent for testing')
misc_arg.add_argument('--seed', type=int, default=1,
help='Seed to ensure reproducibility')
misc_arg.add_argument('--data_dir', type=str, default='../data/processed/',
misc_arg.add_argument('--data_dir', type=str, default='./data/processed/',
help='Directory in which data is stored')
misc_arg.add_argument('--logs_dir', type=str, default='./result/',
help='Directory in which logs wil be stored')
Expand Down
13 changes: 9 additions & 4 deletions data_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ def prepare_data():
background_dir = "data/unzip/background"
evaluation_dir = "data/unzip/evaluation"
processed_dir = "data/processed"

train_dir = os.path.join(processed_dir, 'train')
val_dir = os.path.join(processed_dir, 'val')
test_dir = os.path.join(processed_dir, 'test')

random.seed(5)

if not os.path.exists(processed_dir):
os.makedirs(processed_dir)
os.makedirs(processed_dir +'/train')
os.makedirs(processed_dir +'/val')
os.makedirs(processed_dir +'/test')


if any([True for _ in os.scandir(processed_dir)]):
return
Expand All @@ -52,6 +53,10 @@ def prepare_data():
val_dir = os.path.join(processed_dir, 'val')
test_dir = os.path.join(processed_dir, 'test')

print(len(train_alpha))
print(len(val_alpha))
print(len(test_alpha))

move_image_to_processed_dir(train_alpha, train_dir, 'train')
move_image_to_processed_dir(val_alpha, val_dir, 'val')
move_image_to_processed_dir(test_alpha, test_dir, 'test')
Binary file not shown.
24 changes: 24 additions & 0 deletions result/1/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"augment": true,
"batch_size": 128,
"best": true,
"data_dir": "./data/processed/",
"epochs": 200,
"flush": false,
"init_momentum": 0.5,
"logs_dir": "./result/1",
"lr": 0.0003,
"num_model": "1",
"num_train": 90000,
"num_workers": 4,
"optimizer": "Adam",
"pin_memory": false,
"resume": false,
"seed": 1,
"shuffle": true,
"test_trials": 400,
"train_patience": 20,
"use_gpu": true,
"valid_trials": 320,
"way": 20
}

0 comments on commit f67b6ca

Please sign in to comment.