小编AlG*_*ara的帖子

在Keras中下载ResNet50会生成“ SSL:CERTIFICATE_VERIFY_FAILED”

我在Tensorflow上使用python 3.6和Keras(2.0.9)

尝试下载经过训练的resnet50模型,但遇到以下错误:异常:https : //github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5上的URL提取失败:无- [SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:777)

以下是使用的代码:

from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np

model = ResNet50(weights='imagenet')

img_path = 'elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
model.summary()
preds = model.predict(x)

print('Predicted:', decode_predictions(preds, top=3)[0])
Run Code Online (Sandbox Code Playgroud)

python keras tensorflow

4
推荐指数
2
解决办法
2117
查看次数

标签 统计

keras ×1

python ×1

tensorflow ×1