0
我使用python 3.6和Keras(2.0.9)在Tensorflow在Keras下載ResNet50產生 「SSL:CERTIFICATE_VERIFY_FAILED」
試圖下載resnet50的訓練的模型,但會遇到以下錯誤: 異常:URL抓取失敗在https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5:無 - [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])