Reputation: 340
I was following the tutorial given here: https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
On executing the first half i.e. the data preprocessing code :
for batch in datagen.flow(x, batch_size=1,
save_to_dir='preview', save_prefix='cat', save_format='jpeg'):
i += 1
if i > 20:
break
I get the error :
`fp = builtins.open(filename, "w+b")
IOError: [Errno 2] No such file or directory: 'preview/cat_0_7886.jpeg`
How do I solve this?
Upvotes: 4
Views: 2490
Reputation: 5681
save_to_dir
must have the full path and you have to create all directories in that path before hand
Example:
save_to_dir=r'C:\ML\augImage\train'
Upvotes: 6
Reputation: 11
I was having the same issue and I fixed using
folder = "training_blond_sep" (no slash or backslash)
(...)
for batch in datagen.flow_from_directory(folder, classes=['cat1','cat2'], target_size=(180,180), batch_size=100, shuffle = False, seed=7, save_to_dir=folder+'/aug', save_prefix="changed"):
but I had to create this folder manually.
Hope this helps.
Upvotes: 0
Reputation: 761
Try using an absolute path like /tmp/preview
after making sure that path exists
Upvotes: 0