I apologies in advance for what might be a complete lame question, but I can’t figure out a way around it.
I keep getting an error
OSError: [Errno 2] No such file or directory: '~/data/dogscats/sample/train’
when running
batches = vgg.get_batches(path+‘train’, batch_size=4)
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
in ()
1 ##Grab batches of data from the training folder
----> 2 batches = vgg.get_batches(path+‘train’, batch_size=4)
/home/ubuntu/nbs/vgg16.pyc in get_batches(self, path, gen, shuffle, batch_size, class_mode)
85 def get_batches(self, path, gen=image.ImageDataGenerator(), shuffle=True, batch_size=8, class_mode='categorical'):
86 return gen.flow_from_directory(path, target_size=(224,224),
---> 87 class_mode=class_mode, shuffle=shuffle, batch_size=batch_size)
88
89
/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)
OSError: [Errno 2] No such file or directory: '~/data/dogscats/sample/train'
My path is set to
path = "~/data/dogscats/sample/"
Also, I tried path = “data/dogscats/sample/”
Double checked in the terminal:
ubuntu@ip-10-0-0-4:~$ ls ~/data/dogscats/sample/train
cats dogs
I am sure it is something silly that I am missing. Thanks a lot for help!