Quick question - I was revisiting all the notebooks and for the lesson2.ipynb notebook and I get the error message below. The valid/ and train/ subdirectories have the required structure/content, was wondering if anyone has run into this. Thanks!
Message
Notebook line:
val_data = get_data(val_batches)
Error:
TypeError Traceback (most recent call last)
in ()
----> 1 val_data = get_data(val_batches)
/home/ubuntu/nbs/utils.pyc in get_data(path)
77
78 def get_data(path):
—> 79 batches = get_batches(path, shuffle=False, batch_size=1, class_mode=None)
80 return np.concatenate([batches.next() for i in range(batches.nb_sample)])
81
/home/ubuntu/nbs/utils.pyc in get_batches(dirname, gen, shuffle, batch_size, class_mode)
69 def get_batches(dirname, gen=image.ImageDataGenerator(), shuffle=True, batch_size=4, class_mode=‘categorical’):
70 return gen.flow_from_directory(dirname, target_size=(224,224),
—> 71 class_mode=class_mode, shuffle=shuffle, batch_size=batch_size)
72
73
/home/ubuntu/anaconda2/lib/python2.7/site-packages/keras/preprocessing/image.pyc in flow_from_directory(self, directory, target_size, color_mode, classes, class_mode, batch_size, shuffle, seed, save_to_dir, save_prefix, save_format)
288 dim_ordering=self.dim_ordering,
289 batch_size=batch_size, shuffle=shuffle, seed=seed,
–> 290 save_to_dir=save_to_dir, save_prefix=save_prefix, save_format=save_format)
291
292 def standardize(self, x):
/home/ubuntu/anaconda2/lib/python2.7/site-packages/keras/preprocessing/image.pyc in init(self, directory, image_data_generator, target_size, color_mode, dim_ordering, classes, class_mode, batch_size, shuffle, seed, save_to_dir, save_prefix, save_format)
553 if not classes:
554 classes = []
–> 555 for subdir in sorted(os.listdir(directory)):
556 if os.path.isdir(os.path.join(directory, subdir)):
557 classes.append(subdir)
TypeError: coercing to Unicode: need string or buffer, DirectoryIterator found