Unable to instantiate Vgg16 object
Whenever I run
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.fit(batches, val_batches, nb_epoch=1)
I get the following error:
OError Traceback (most recent call last)
<ipython-input-24-2b6861506a11> in <module>()
----> 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)
/Users/indraner/dev/datascience/fastai/courses/deeplearning1/nbs/vgg16.py in __init__(self)
31 def __init__(self):
32 self.FILE_PATH = 'http://www.platform.ai/models/'
---> 33 self.create()
/Users/indraner/dev/datascience/fastai/courses/deeplearning1/nbs/vgg16.py in create(self)
81 fname = 'vgg16.h5'
---> 82 model.load_weights('/Users/indraner/dev/datascience/fastai/data/dogsVcats/vgg16.h5')
/usr/local/lib/python2.7/site-packages/keras/engine/topology.pyc in load_weights(self, filepath, by_name)
2513 import h5py
-> 2514 f = h5py.File(filepath, mode='r')
2515 if 'layer_names' not in f.attrs and 'model_weights' in f:
2516 f = f['model_weights']
/usr/local/lib/python2.7/site-packages/h5py/_hl/files.pyc in __init__(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
271 fapl = make_fapl(driver, libver, **kwds)
--> 272 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
274 if swmr_support:
/usr/local/lib/python2.7/site-packages/h5py/_hl/files.pyc in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
90 if swmr and swmr_support:
91 flags |= h5f.ACC_SWMR_READ
---> 92 fid = h5f.open(name, flags, fapl=fapl)
93 elif mode == 'r+':
94 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2687)()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2645)()
h5py/h5f.pyx in h5py.h5f.open (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/h5f.c:1933)()
IOError: Unable to open file (Truncated file: eof = 237635312, sblock->base_addr = 0, stored_eoa = 553482496)
I have downloaded the .h5 file and trying load it from local disk, since I was getting error while loading it from the 'platform.ai' url
Also the code is the latest from github.
Can someone pls help?