VGG16のモデルを使い、finetuningにより新しく学習させたオリジナルのモデルを作成したのですが、そのモデルをローカル環境に移し、ローカル環境でモデルを用いて画像判別をしたいのですが、モデルの重みをロードする段階で以下のエラーが出てしまい困っております。
以下のコードを入力した時にエラーが出てしまいます。
vgg_model.load_weights('/content/finetuning.h5')
以下、エラー内容
Using TensorFlow backend.
2020-02-28 21:23:05.195826: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
makemodel.py:26: UserWarning: Update your Model
call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("se...)
vgg_model = Model(input=vgg16.input, output=top_model(vgg16.output))
Traceback (most recent call last):
File "makemodel.py", line 27, in <module>
vgg_model.load_weights('finetuning.h5')
File "/opt/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/engine/topology.py", line 2647, in load_weights
with h5py.File(filepath, mode='r') as f:
File "/opt/anaconda3/envs/tensorflow/lib/python3.6/site-packages/h5py/_hl/files.py", line 394, in init
swmr=swmr)
File "/opt/anaconda3/envs/tensorflow/lib/python3.6/site-packages/h5py/_hl/files.py", line 170, 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 85, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 25857777, sblock->base_addr = 0, stored_eof = 84606928)
モデルの方は以下のコードでローカルに保存しました。
from google.colab import files
files.download( "/content/finetuning.h5" )
わかる方がおりましたら教えていただけると助かります。
tensorflow==1.15.0
keras==2.2.5