OSError: Unable to open file (file signature not found)


(Atul) #1

HI all
trying to run this block from lesson1

vgg = Vgg16()

Grab a few images at a time for training and validation.

NB: They must be in subdirectories named based on their category

batches = vgg.get_batches(path+‘train’, batch_size=batch_size)
val_batches = vgg.get_batches(path+‘valid’, batch_size=batch_size*2)
vgg.finetune(batches)
vgg.fit(batches, val_batches, nb_epoch=1)

getting below error, please help

OSError Traceback (most recent call last)
in ()
----> 1 vgg = Vgg16()
2 # Grab a few images at a time for training and validation.
3 # NB: They must be in subdirectories named based on their category
4 batches = vgg.get_batches(path+‘train’, batch_size=batch_size)
5 val_batches = vgg.get_batches(path+‘valid’, batch_size=batch_size*2)

C:\Users\akatti\Desktop\DL\courses-master\deeplearning1\nbs\vgg16.py in init(self)
30 def init(self):
31 self.FILE_PATH = ‘http://files.fast.ai/models/
—> 32 self.create()
33 self.get_classes()
34

C:\Users\akatti\Desktop\DL\courses-master\deeplearning1\nbs\vgg16.py in create(self)
79
80 fname = ‘vgg16.h5’
—> 81 model.load_weights(get_file(fname, self.FILE_PATH+fname, cache_subdir=‘models’))
82
83

C:\Users\akatti\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\engine\topology.py in load_weights(self, filepath, by_name)
2700 “”"
2701 import h5py
-> 2702 f = h5py.File(filepath, mode=‘r’)
2703 if ‘layer_names’ not in f.attrs and ‘model_weights’ in f:
2704 f = f[‘model_weights’]

C:\Users\akatti\AppData\Local\Programs\Python\Python35\lib\site-packages\h5py_hl\files.py in init(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
267 with phil:
268 fapl = make_fapl(driver, libver, **kwds)
–> 269 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
270
271 if swmr_support:

C:\Users\akatti\AppData\Local\Programs\Python\Python35\lib\site-packages\h5py_hl\files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
97 if swmr and swmr_support:
98 flags |= h5f.ACC_SWMR_READ
—> 99 fid = h5f.open(name, flags, fapl=fapl)
100 elif mode == ‘r+’:
101 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py_objects.pyx in h5py._objects.with_phil.wrapper()

h5py_objects.pyx in h5py._objects.with_phil.wrapper()

h5py\h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file signature not found)


(kab) #2

Did you figure this out? I’m having the same problem.


(Eric Ho) #3

Tried to access with https://www.platform.ai/models/vgg16.h5 and seems like adding Google oauth for file access.
Is there any backup for this file?


#4

I’m having the same problem,too…Did you fix it?