This repository has been archived by the owner on Mar 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirs.py
57 lines (51 loc) · 1.62 KB
/
dirs.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
import os
def create_dirs(dirs):
"""
dirs - a list of directories to create if these directories are not found
:param dirs:
:return:
"""
try:
for dir_ in dirs:
if not os.path.exists(dir_):
os.makedirs(dir_)
except Exception as err:
print("Creating directories error: {0}".format(err))
exit(-1)
def create_experiment_dirs(exp_dir):
"""
Create Directories of a regular tensorflow experiment directory
:param exp_dir:
:return summary_dir, checkpoint_dir:
"""
experiment_dir = os.path.realpath(os.path.join(os.path.dirname(__file__))) + "/experiments/" + exp_dir + "/"
summary_dir = experiment_dir + 'summaries/'
checkpoint_dir = experiment_dir + 'checkpoints/'
dirs = [summary_dir, checkpoint_dir]
try:
for dir_ in dirs:
if not os.path.exists(dir_):
os.makedirs(dir_)
print("exp_dirs created")
return summary_dir, checkpoint_dir
except Exception as err:
print("Creating directories error: {0}".format(err))
exit(-1)
def create_out_dirs(out_dir):
"""
Create directories for output from the network
:param out_dir:
:return:
"""
out_dir = os.path.realpath(os.path.join(os.path.dirname(__file__))) + "/out/" + out_dir + "/"
# TODO define the output dir tree
dirs = []
try:
for dir_ in dirs:
if not os.path.exists(dir_):
os.makedirs(dir_)
print("out_dirs created")
return None
except Exception as err:
print("Creating directories error: {0}".format(err))
exit(-1)