Skip to content

Commit 1081885

Browse files
Give informative error msg when no data exists
1 parent 3041fa3 commit 1081885

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ def __init__(self, sess, input_height=108, input_width=108, crop=True,
7575
self.data_X, self.data_y = self.load_mnist()
7676
self.c_dim = self.data_X[0].shape[-1]
7777
else:
78-
self.data = glob(os.path.join(self.data_dir, self.dataset_name, self.input_fname_pattern))
78+
data_path = os.path.join(self.data_dir, self.dataset_name, self.input_fname_pattern)
79+
self.data = glob(data_path)
80+
if len(self.data) == 0:
81+
raise Exception("[!] No data found in '" + data_path + "'")
7982
np.random.shuffle(self.data)
8083
imreadImg = imread(self.data[0])
8184
if len(imreadImg.shape) >= 3: #check if image is a non-grayscale image by checking channel number

0 commit comments

Comments
 (0)