Skip to content

Commit 79cfc99

Browse files
committed
Added training data existence checks
1 parent 52e98b7 commit 79cfc99

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

bottlenecking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def train_top_model():
7777

7878

7979
if __name__ == '__main__':
80+
u.checkDirs([s.train_data_dir, s.validation_data_dir, s.test_data_dir])
8081
u.createDirIfNotExisting(s.plots_dir)
8182
u.createDirIfNotExisting(s.results_dir)
8283
save_bottlebeck_features()

model-evaluator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# File paths
1212
log_path = os.path.join(s.results_dir, 'log_test_dataset.txt')
1313

14+
# Check test data existence
15+
u.checkDirs([s.test_data_dir])
16+
1417
# Load fine tuned model
1518
model = load_model(s.fine_tuned_model_path)
1619
print("Fine tuned model loaded...")

utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ def createDirIfNotExisting(path):
4444
except OSError as e:
4545
if e.errno != errno.EEXIST:
4646
raise
47+
48+
# Raise exception if training data is not found
49+
def checkDirs(paths):
50+
for (i, path) in enumerate(paths):
51+
if not os.path.isdir(path):
52+
raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), path)

0 commit comments

Comments
 (0)