{
  "id": 47735,
  "title": "Please Help: Error during using pre-trained network keras",
  "url": "/competitions/sp-society-camera-model-identification/discussion/47735",
  "author_name": "",
  "post_date": "2018-01-18T06:08:40.310320600Z",
  "votes": null,
  "comment_count": 5,
  "views": 0,
  "content": "<p>While using keras pre-trained network  vgg16 I faced the following error: </p>\n\n<p>Traceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1318, in do_open\n909.5s\n5\n    encode_chunked=req.has_header('Transfer-encoding'))\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1239, in request\n    self._send_request(method, url, body, headers, encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1285, in _send_request\n    self.endheaders(body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1234, in endheaders\n    self._send_output(message_body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1026, in _send_output\n    self.send(msg)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 964, in send\n    self.connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1392, in connect\n    super().connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 936, in connect\n    (self.host,self.port), self.timeout, self.source_address)\n  File \"/opt/conda/lib/python3.6/socket.py\", line 704, in create_connection\n    for res in getaddrinfo(host, port, 0, SOCK_STREAM):\n  File \"/opt/conda/lib/python3.6/socket.py\", line 745, in getaddrinfo\n    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\nsocket.gaierror: [Errno -2] Name or service not known</p>\n\n<p>During handling of the above exception, another exception occurred:</p>\n\n<p>Traceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/utils/data_utils.py\", line 223, in get_file\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 248, in urlretrieve\n    with contextlib.closing(urlopen(url, data)) as fp:\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 223, in urlopen\n    return opener.open(url, data, timeout)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 526, in open\n    response = self._open(req, data)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 544, in _open\n    '_open', req)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 504, in _call_chain\n    result = func(*args)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1361, in https_open\n    context=self._context, check_hostname=self._check_hostname)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1320, in do_open\n    raise URLError(err)\nurllib.error.URLError: </p>\n\n<p>During handling of the above exception, another exception occurred:</p>\n\n<p>Traceback (most recent call last):\n  File \"../src/script.py\", line 148, in \n    save_bottleneck_features(X_train, X_test)\n  File \"../src/script.py\", line 105, in save_bottleneck_features\n    model = applications.VGG16(include_top=False, weights='imagenet')\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/applications/vgg16.py\", line 175, in VGG16\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/utils/data_utils.py\", line 225, in get_file\nException: URL fetch failure on <a href=\"https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5\">https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5</a>: None -- [Errno -2] Name or service not known</p>",
  "messages": [
    {
      "id": "270362",
      "postDate": "01/18/2018 06:08:40",
      "content": "<p>While using keras pre-trained network  vgg16 I faced the following error: </p>\n\n<p>Traceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1318, in do_open\n909.5s\n5\n    encode_chunked=req.has_header('Transfer-encoding'))\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1239, in request\n    self._send_request(method, url, body, headers, encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1285, in _send_request\n    self.endheaders(body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1234, in endheaders\n    self._send_output(message_body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1026, in _send_output\n    self.send(msg)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 964, in send\n    self.connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1392, in connect\n    super().connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 936, in connect\n    (self.host,self.port), self.timeout, self.source_address)\n  File \"/opt/conda/lib/python3.6/socket.py\", line 704, in create_connection\n    for res in getaddrinfo(host, port, 0, SOCK_STREAM):\n  File \"/opt/conda/lib/python3.6/socket.py\", line 745, in getaddrinfo\n    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\nsocket.gaierror: [Errno -2] Name or service not known</p>\n\n<p>During handling of the above exception, another exception occurred:</p>\n\n<p>Traceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/utils/data_utils.py\", line 223, in get_file\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 248, in urlretrieve\n    with contextlib.closing(urlopen(url, data)) as fp:\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 223, in urlopen\n    return opener.open(url, data, timeout)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 526, in open\n    response = self._open(req, data)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 544, in _open\n    '_open', req)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 504, in _call_chain\n    result = func(*args)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1361, in https_open\n    context=self._context, check_hostname=self._check_hostname)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1320, in do_open\n    raise URLError(err)\nurllib.error.URLError: </p>\n\n<p>During handling of the above exception, another exception occurred:</p>\n\n<p>Traceback (most recent call last):\n  File \"../src/script.py\", line 148, in \n    save_bottleneck_features(X_train, X_test)\n  File \"../src/script.py\", line 105, in save_bottleneck_features\n    model = applications.VGG16(include_top=False, weights='imagenet')\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/applications/vgg16.py\", line 175, in VGG16\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/utils/data_utils.py\", line 225, in get_file\nException: URL fetch failure on <a href=\"https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5\">https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5</a>: None -- [Errno -2] Name or service not known</p>",
      "rawMarkdown": "While using keras pre-trained network  vgg16 I faced the following error: \n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1318, in do_open\n909.5s\n5\n    encode_chunked=req.has_header('Transfer-encoding'))\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1239, in request\n    self._send_request(method, url, body, headers, encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1285, in _send_request\n    self.endheaders(body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1234, in endheaders\n    self._send_output(message_body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1026, in _send_output\n    self.send(msg)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 964, in send\n    self.connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1392, in connect\n    super().connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 936, in connect\n    (self.host,self.port), self.timeout, self.source_address)\n  File \"/opt/conda/lib/python3.6/socket.py\", line 704, in create_connection\n    for res in getaddrinfo(host, port, 0, SOCK_STREAM):\n  File \"/opt/conda/lib/python3.6/socket.py\", line 745, in getaddrinfo\n    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\nsocket.gaierror: [Errno -2] Name or service not known\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/utils/data_utils.py\", line 223, in get_file\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 248, in urlretrieve\n    with contextlib.closing(urlopen(url, data)) as fp:\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 223, in urlopen\n    return opener.open(url, data, timeout)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 526, in open\n    response = self._open(req, data)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 544, in _open\n    '_open', req)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 504, in _call_chain\n    result = func(*args)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1361, in https_open\n    context=self._context, check_hostname=self._check_hostname)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1320, in do_open\n    raise URLError(err)\nurllib.error.URLError:",
      "votes": null
    },
    {
      "id": "270460",
      "postDate": "01/18/2018 09:02:32",
      "content": "<p>Seems Keras is not able to download the pretrained imagenet weights for the model you want to run, you can manually download the weights by clicking on  the URL mentioned in the error and place it at ~/.keras/models (Ubuntu) and run your code again.</p>",
      "rawMarkdown": "Seems Keras is not able to download the pretrained imagenet weights for the model you want to run, you can manually download the weights by clicking on  the URL mentioned in the error and place it at ~/.keras/models (Ubuntu) and run your code again.",
      "votes": null
    },
    {
      "id": "271011",
      "postDate": "01/19/2018 13:23:56",
      "content": "<p>Thank you, I will try it </p>",
      "rawMarkdown": "Thank you, I will try it",
      "votes": null
    },
    {
      "id": "271575",
      "postDate": "01/20/2018 20:56:22",
      "content": "<p>This is a collection of all the articles I found that is talking about how to handle Keras pre-trained networks in Kaggle. I will summarize all of them here for reference: </p>\n\n<ul>\n<li><p><a href=\"https://github.com/Kaggle/docker-python/issues/73\">https://github.com/Kaggle/docker-python/issues/73</a> </p></li>\n<li><p><a href=\"https://www.kaggle.com/ekkus93/keras-models\">https://www.kaggle.com/ekkus93/keras-models</a> </p></li>\n<li><p><a href=\"https://www.kaggle.com/ekkus93/keras-models-as-datasets-test\">https://www.kaggle.com/ekkus93/keras-models-as-datasets-test</a> </p></li>\n</ul>",
      "rawMarkdown": "This is a collection of all the articles I found that is talking about how to handle Keras pre-trained networks in Kaggle. I will summarize all of them here for reference: \n\n* https://github.com/Kaggle/docker-python/issues/73 \n\n* https://www.kaggle.com/ekkus93/keras-models \n\n* https://www.kaggle.com/ekkus93/keras-models-as-datasets-test",
      "votes": null
    },
    {
      "id": "273904",
      "postDate": "01/25/2018 13:19:55",
      "content": "<p>To use pre-trained keras model, there is already uploaded files to Kaggle platform. </p>\n\n<ol>\n<li><p>In the Data tab click (add data source)</p></li>\n<li><p>In the pop up dialog choose Datasets </p></li>\n<li><p>In the search box write (keras) </p></li>\n<li><p>From search results choose (Keras Pretrained models) </p></li>\n<li><p>It will be added to (input/keras-pretrained-models/) </p></li>\n</ol>",
      "rawMarkdown": "To use pre-trained keras model, there is already uploaded files to Kaggle platform. \n\n1. In the Data tab click (add data source)\n\n2. In the pop up dialog choose Datasets \n\n3. In the search box write (keras) \n\n4. From search results choose (Keras Pretrained models) \n\n5. It will be added to (input/keras-pretrained-models/)",
      "votes": null
    },
    {
      "id": "370499",
      "postDate": "08/14/2018 23:37:24",
      "content": "<p>Can you share the link to the \"Data\" tab location, since I don't see an \"Add data source option\"?\nUpdate: I got it. Thanks!</p>",
      "rawMarkdown": "Can you share the link to the \"Data\" tab location, since I don't see an \"Add data source option\"?\nUpdate: I got it. Thanks!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 270460,
      "author_name": "datasec",
      "author_url": "",
      "post_date": "01/18/2018 09:02:32",
      "content": "<p>Seems Keras is not able to download the pretrained imagenet weights for the model you want to run, you can manually download the weights by clicking on  the URL mentioned in the error and place it at ~/.keras/models (Ubuntu) and run your code again.</p>",
      "votes": null,
      "replies": [
        {
          "id": 271011,
          "author_name": "thegenuismentalist",
          "author_url": "",
          "post_date": "01/19/2018 13:23:56",
          "content": "<p>Thank you, I will try it </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 271575,
      "author_name": "thegenuismentalist",
      "author_url": "",
      "post_date": "01/20/2018 20:56:22",
      "content": "<p>This is a collection of all the articles I found that is talking about how to handle Keras pre-trained networks in Kaggle. I will summarize all of them here for reference: </p>\n\n<ul>\n<li><p><a href=\"https://github.com/Kaggle/docker-python/issues/73\">https://github.com/Kaggle/docker-python/issues/73</a> </p></li>\n<li><p><a href=\"https://www.kaggle.com/ekkus93/keras-models\">https://www.kaggle.com/ekkus93/keras-models</a> </p></li>\n<li><p><a href=\"https://www.kaggle.com/ekkus93/keras-models-as-datasets-test\">https://www.kaggle.com/ekkus93/keras-models-as-datasets-test</a> </p></li>\n</ul>",
      "votes": null,
      "replies": []
    },
    {
      "id": 273904,
      "author_name": "thegenuismentalist",
      "author_url": "",
      "post_date": "01/25/2018 13:19:55",
      "content": "<p>To use pre-trained keras model, there is already uploaded files to Kaggle platform. </p>\n\n<ol>\n<li><p>In the Data tab click (add data source)</p></li>\n<li><p>In the pop up dialog choose Datasets </p></li>\n<li><p>In the search box write (keras) </p></li>\n<li><p>From search results choose (Keras Pretrained models) </p></li>\n<li><p>It will be added to (input/keras-pretrained-models/) </p></li>\n</ol>",
      "votes": null,
      "replies": [
        {
          "id": 370499,
          "author_name": "sabiha90",
          "author_url": "",
          "post_date": "08/14/2018 23:37:24",
          "content": "<p>Can you share the link to the \"Data\" tab location, since I don't see an \"Add data source option\"?\nUpdate: I got it. Thanks!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "270362": "While using keras pre-trained network  vgg16 I faced the following error: \n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1318, in do_open\n909.5s\n5\n    encode_chunked=req.has_header('Transfer-encoding'))\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1239, in request\n    self._send_request(method, url, body, headers, encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1285, in _send_request\n    self.endheaders(body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1234, in endheaders\n    self._send_output(message_body, encode_chunked=encode_chunked)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1026, in _send_output\n    self.send(msg)\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 964, in send\n    self.connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 1392, in connect\n    super().connect()\n  File \"/opt/conda/lib/python3.6/http/client.py\", line 936, in connect\n    (self.host,self.port), self.timeout, self.source_address)\n  File \"/opt/conda/lib/python3.6/socket.py\", line 704, in create_connection\n    for res in getaddrinfo(host, port, 0, SOCK_STREAM):\n  File \"/opt/conda/lib/python3.6/socket.py\", line 745, in getaddrinfo\n    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\nsocket.gaierror: [Errno -2] Name or service not known\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/opt/conda/lib/python3.6/site-packages/Keras-2.1.2-py3.6.egg/keras/utils/data_utils.py\", line 223, in get_file\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 248, in urlretrieve\n    with contextlib.closing(urlopen(url, data)) as fp:\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 223, in urlopen\n    return opener.open(url, data, timeout)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 526, in open\n    response = self._open(req, data)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 544, in _open\n    '_open', req)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 504, in _call_chain\n    result = func(*args)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1361, in https_open\n    context=self._context, check_hostname=self._check_hostname)\n  File \"/opt/conda/lib/python3.6/urllib/request.py\", line 1320, in do_open\n    raise URLError(err)\nurllib.error.URLError:",
    "270460": "Seems Keras is not able to download the pretrained imagenet weights for the model you want to run, you can manually download the weights by clicking on  the URL mentioned in the error and place it at ~/.keras/models (Ubuntu) and run your code again.",
    "271011": "Thank you, I will try it",
    "271575": "This is a collection of all the articles I found that is talking about how to handle Keras pre-trained networks in Kaggle. I will summarize all of them here for reference: \n\n* https://github.com/Kaggle/docker-python/issues/73 \n\n* https://www.kaggle.com/ekkus93/keras-models \n\n* https://www.kaggle.com/ekkus93/keras-models-as-datasets-test",
    "273904": "To use pre-trained keras model, there is already uploaded files to Kaggle platform. \n\n1. In the Data tab click (add data source)\n\n2. In the pop up dialog choose Datasets \n\n3. In the search box write (keras) \n\n4. From search results choose (Keras Pretrained models) \n\n5. It will be added to (input/keras-pretrained-models/)",
    "370499": "Can you share the link to the \"Data\" tab location, since I don't see an \"Add data source option\"?\nUpdate: I got it. Thanks!"
  },
  "source": "meta"
}