I am using the fastai/courses/dl1/lesson.ipynb and I save the weights like this :
arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.save('modelweights')
After that, I copied the file to /static/_model/modelweights.h5
but when I ran, python server.py
it is giving the following error
### start server 2018-07-19 12:01:39.808413
### image upload folder: /home/ubuntu/flask_fastai_CNN/static/_uploads/unknown/
### data folder: /home/ubuntu/flask_fastai_CNN/static/data/redux
Using gpu device 0: Tesla K80 (CNMeM is disabled, cuDNN Mixed dnn version. The header is from one version, but we link with a different version (5103, 7005))
Using Theano backend.
### initializing model:
VVV/home/ubuntu/flask_fastai_CNN/static/_model/modelweights.h5
Traceback (most recent call last):
File "server.py", line 52, in <module>
vgg = Vgg16()
File "/home/ubuntu/flask_fastai_CNN/utils/vgg16.py", line 32, in __init__
self.create()
File "/home/ubuntu/flask_fastai_CNN/utils/vgg16.py", line 84, in create
model.load_weights(trained_model_path)
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2494, in load_weights
f = h5py.File(filepath, mode='r')
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/h5py/_hl/files.py", line 269, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/h5py/_hl/files.py", line 99, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
IOError: Unable to open file (file signature not found)
Please tell me where I am wrong