[Python] downloading ResNet50 in Keras generates "SSL: CERTIFICATE_VERIFY_FAILED"

Discussão em 'Python' iniciado por Stack, Novembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I am using python 3.6 and Keras (2.0.9) over Tensorflow

    trying to download trained models of resnet50 but encounter the following error: Exception: URL fetch failure on https://github.com/fchollet/deep-le...esnet50_weights_tf_dim_ordering_tf_kernels.h5: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

    the following is the code used:

    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])

    Continue reading...

Compartilhe esta Página