-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.py
58 lines (41 loc) · 1.77 KB
/
helpers.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""General project specific constants, filepaths and helper functions."""
# import os
from pathlib import Path
#=============================================================================
# File paths
DATA_FOLDER = 'data/'
# NICKY You could swap the line above with the comment and you could have the stuff work nicely with drive.
# DATA_FOLDER = '/content/drive/MyDrive/ml/data'
MODELS_FOLDER = 'models/'
# Contains all given training data
RAW_TRAIN_DATA_FOLDER = DATA_FOLDER + 'training/'
# Contains all given test data. To be used for generating AIcrowd submission.
RAW_TEST_DATA_FOLDER = DATA_FOLDER + 'test_set_images/'
# Folder to contain all our data that was generated by our preprocessing.
PROCESSED_DATA_FOLDER = DATA_FOLDER + 'processed/'
# Not too sure what this is for
REORDERED_DATA_FOLDER = PROCESSED_DATA_FOLDER + 'reordered/'
# To contain the data preprocessed in the manner we want it for cross validation. Not used for now
CROSSVAL_DATA_FOLDER = PROCESSED_DATA_FOLDER + 'crossval/'
# To contain the final version of data to be used for training out final model.
FINAL_DATA_FOLDER = PROCESSED_DATA_FOLDER + 'final/'
RAW_TEST_PREDICTIONS_FOLDER = 'data/test_set_predictions/'
#=============================================================================
# Helper functions
def create_missing_directories():
"""
Creates all needed directories that don't exist yet.
"""
FOLDERS = [
DATA_FOLDER,
RAW_TRAIN_DATA_FOLDER,
RAW_TEST_DATA_FOLDER,
PROCESSED_DATA_FOLDER,
# REORDERED_DATA_FOLDER,
# CROSSVAL_DATA_FOLDER,
FINAL_DATA_FOLDER+'images/',
FINAL_DATA_FOLDER+'labels/',
RAW_TEST_PREDICTIONS_FOLDER
]
for folder in FOLDERS:
Path(folder).mkdir(parents=True, exist_ok=True)