简体   繁体   中英

Keras Pretrained Model Traceback

When running this line:

base_model = MobileNetV2(include_top=False, weights='imagenet', input_tensor=input_tensor, pooling=None, classes=NB_CLASS)

I get the following error

在此处输入图片说明

How do I solve the problem?

Without the save a'd the load file part of your code it's hard to say from where is the issue. If I well understood, you saved the weights in a file h5py?

I think it's always easier to save the whole trained model than only the weights:

from keras.models import load_model
model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'

# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')

Managed to solve the problem by deleting the pretrained weights and running the code again to redownload the file.

The pretrained weights file was saved in /home in the /.keras hidden folder in a .h5 file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM