我正在尝试将预训练的InceptionV3与this dataset上的keras一起使用。我拥有所有必要的进口商品:
import keras
from keras.applications.inception_v3 import InceptionV3
from keras.preprocessing import image
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D
from keras import backend as K
我正在这样做以创建和训练模型:
base_model = InceptionV3(weights='imagenet', include_top=False)
class_names = ["0", "1", "2", "3", "4"]
CLASSES = 5
x = base_model.output
x = GlobalAveragePooling2D(name='avg_pool')(x)
x = Dropout(0.4)(x)
predictions = Dense(CLASSES, activation='softmax')(x)
model = Model(inputs=base_model.input, outputs=predictions)
for layer in base_model.layers:
layer.trainable = False
model.compile(optimizer='rmsprop',
loss='categorical_crossentropy',
metrics=['accuracy'])
但是,我遇到此错误:
Traceback (most recent call last):
File "/Users/Mady/Documents/EyePACSMLModelTest1.py", line 19, in <module>
base_model = InceptionV3(weights='imagenet', include_top=False)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/applications/__init__.py", line 28, in wrapper
return base_fun(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/applications/inception_v3.py", line 11, in InceptionV3
return inception_v3.InceptionV3(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras_applications/inception_v3.py", line 390, in InceptionV3
file_hash='bcbd6486424b2319ff4ef7d526e38f63')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/utils/data_utils.py", line 226, in get_file
raise Exception(error_msg.format(origin, e.errno, e.reason))
Exception: URL fetch failure on https://github.com/fchollet/deep-learning-models/releases/download/v0.5/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5: None -- [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661)
这是我第一次使用该模型,该错误表示什么?
谢谢!