Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot download vgg16_weights #33

Open
TriLoo opened this issue Jan 16, 2017 · 35 comments
Open

cannot download vgg16_weights #33

TriLoo opened this issue Jan 16, 2017 · 35 comments

Comments

@TriLoo
Copy link

TriLoo commented Jan 16, 2017

Hi fchollet,
Now, I'm using vgg16 under Keras to classify oxford 102 flower dataset and I want to download the trained weight file: vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5. But I cannot download it...
Wourld you please email this file to me? thank u very much.
my email: songmh_1@hotmail.com

@gugarosa
Copy link

Just use this straight link: https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5

@kashyap32
Copy link

You can download it manually from here: https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5
and paste it on
~/.keras/models

@muthiyanbhushan
Copy link

Hello everyone,

I am using Jetson TX2 (flashed with Jetpack 3.0) for the tutorial "ImageNet classification with Python and Keras".
I have installed all the dependencies.
I tried running the script as mentioned in the tutorial.
It gave me below error:

Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5
Traceback (most recent call last):
File "test_imagenet.py", line 40, in
model = VGG16(weights="imagenet")
File "/home/nvidia/deep-learning-models/imagenet-example/vgg16.py", line 143, in VGG16
cache_subdir='models')
File "build/bdist.linux-aarch64/egg/keras/utils/data_utils.py", line 222, in get_file
Exception: URL fetch failure on https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

I tried downloading file and placed it in " ~/.keras/models" folder. But still, I am getting the same error.

Can someone help me with this.

Thank you.

@srinivaschalamala
Copy link

Export proxy environment variables http_proxy, socks_proxy, https_proxy,ftp_proxy etc

@helxsz
Copy link

helxsz commented Aug 27, 2017

I faced the same problem that the vgg16_weights_tf_dim_ordering_tf_kernels.h5 was downloaded directly from the browser and placed into the ./keras/models folder, but when the application is running, it is still downloading the model, why it is happening

@sudhir2016
Copy link

sudhir2016 commented Dec 28, 2017

I am facing the same issue. Even if I download and manually place the VGG16 weights file in Keras model folder the program still tries to downloads and stops after downloading about 33 MB with the error 'Connection closed by remote host'. Please suggest solution.

@DianaLi96
Copy link

I also met the same problem.I download the weight file manually,but it also make me download repeatedly. How can I solve the problem.Thank you!

@sai-sundar
Copy link

I faced the same problem found a work around like this ! If you are using VGG16 from keras.applications or from 'https://github.com/fchollet/deep-learning-models' the download happens in any case. Now in order to stop this download what I did was took the vgg16.py from the link I just mentioned and then provided the path where I stored my manually downloaded weights. This happens at line 170 in vgg16.py where you can comment the if/else condition and modify the load_weights accordingly.
Finally include 'from vgg16 import VGG16' to your main python file. Hope this made sense.

@eltronix
Copy link

eltronix commented Apr 1, 2018

If you're on Mac OS, I found a solution here:
ageron/handson-ml#46

@aarshee
Copy link

aarshee commented Apr 8, 2018

If you download the model from https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5 make sure you set the include_top variable as False:
model = VGG16(weights = 'imagenet', include_top = False)

@ClaudeCoulombe
Copy link

ClaudeCoulombe commented Apr 21, 2018

For Mac OS X

  1. Update to Python 3.6.5 using the native app installer downloaded from the official Python language website https://www.python.org/downloads/

I've found that the installer is taking care of updating the links and symlinks for the new Python a lot better than homebrew.

  1. Install a new certificate using "./Install Certificates.command" which is in the refreshed Python 3.6 directory

    cd "/Applications/Python 3.6/"
    sudo "./Install Certificates.command"

@unnir
Copy link

unnir commented Jun 14, 2018

add these lines before downloading the weights:

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

@yzc1112
Copy link

yzc1112 commented Jun 29, 2018

Hi, guys, I found a really easy solution. If you cannot download it due to proxy settings in a company like me. You can use PyPAC to auto set proxy for you by using the internet explorer's setting

  1. download PyPAC
    open your terminal and type
    pip install pypac
  2. inside your python code, write the following:
    from keras.applications import resnet50
    from pypac import pac_context_for_url
    import ssl
    context = ssl._create_unverified_context()
    with pac_context_for_url('https://www.google.com'): # put any website here, it just uses the website to get proxy settings
    model = resnet50.ResNet50() # put the download code line under your pac_context_for_url(''): function.

here you go

@Red-Eyed
Copy link

Red-Eyed commented Aug 9, 2018

@unnir , thank you a lot, it works!!

@drscarlat
Copy link

@unnir - many thanx for your elegant solution !

@MLEinmaking
Copy link

Downloading https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5 and passing the path to weights worked for me.
self.resnet = ResNet50(weights='models/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5',
include_top=False,
pooling='avg')

@duocang
Copy link

duocang commented May 23, 2019

copy paste and run. you see my power.

from keras.applications import VGG16
from keras import backend as K
import tensorflow as tf

import httplib2
# detect presense of proxy and use env varibles if they exist
pi = httplib2.proxy_info_from_environment()
if pi:
    import socks
    socks.setdefaultproxy(pi.proxy_type, pi.proxy_host, pi.proxy_port)
    socks.wrapmodule(httplib2)    

# now all calls through httplib2 should use the proxy settings
httplib2.Http()

mn = VGG16()
saver = tf.train.Saver()
sess = K.get_session()
saver.save(sess, "./TF_Model/vgg16")

@clived2
Copy link

clived2 commented May 27, 2019

I faced the same problem that the vgg16_weights_tf_dim_ordering_tf_kernels.h5 was downloaded directly from the browser and placed into the ./keras/models folder, but when the application is running, it is still downloading the model, why it is happening

I am having the same problem, please advise

@Red-Eyed
Copy link

What error message do u have?

@clived2
Copy link

clived2 commented May 28, 2019 via email

@evovinetu
Copy link

My app can't download files from gihub because of the company's firewall.
What worked for me is downloading the weights file manually and putting it to a folder "models" within the app.
Then in place of
model = ResNet50(weights="imagenet")
i linked it to the file:
model = ResNet50(weights="models/resnet50_weights_tf_dim_ordering_tf_kernels.h5")

But how do i locally link the index file which is also being attempted to download in the imagenet_utils.py? This:
CLASS_INDEX_PATH = 'https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json'

@vstupakov
Copy link

@evaldasjab, I guess u need remove weights= and the manually load your model

@evovinetu
Copy link

@vstupakov, weights are not an issue now, it's imagenet_class_index.json that is not downloadable.

@SpocWeb
Copy link

SpocWeb commented Oct 7, 2019

You must enable Internet Access in your Kernel Settings to be able to download data from github!
grafik

@evovinetu
Copy link

@SpocWeb, unfortunately my company has firewalled outgoing connections, my app can't request anything from github directly.

@SpocWeb
Copy link

SpocWeb commented Oct 8, 2019

@evaldasjab So you are running your Code locally? Well than there is no choice but downloading it, right?

@evovinetu
Copy link

@SpocWeb, the code runs in Openshift, in a Docker container.
I don't know where to put the downloaded file so that the model could find it.
The Docker container doesn't have "~/.keras/models" folder.

@Red-Eyed
Copy link

Red-Eyed commented Oct 8, 2019

You can manually create dir and set KERAS_HOME env: https://github.com/keras-team/keras/blob/master/keras/utils/data_utils.py#L174
PS: Sorry, but read the first time Openshift as Openshit XD

@evovinetu
Copy link

@Red-Eyed, wonderful, that worked!
So, what i did eventually:
i created a folder keras/models in the app's working directory where
i moved both files imagenet_class_index.json and resnet50_weights_tf_dim_ordering_tf_kernels.h5.
Then i added to the app's code:

import os
os.environ['KERAS_HOME'] = os.path.join(os.getcwd(), 'keras')

@cad-ml
Copy link

cad-ml commented Jan 7, 2020

You must make that
model = VGG16(weights='vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5',
include_top=True,
pooling='avg')

@MasoumehVahedi
Copy link

My app can't download files from gihub because of the company's firewall.
What worked for me is downloading the weights file manually and putting it to a folder "models" within the app.
Then in place of
model = ResNet50(weights="imagenet")
i linked it to the file:
model = ResNet50(weights="models/resnet50_weights_tf_dim_ordering_tf_kernels.h5")

But how do i locally link the index file which is also being attempted to download in the imagenet_utils.py? This:
CLASS_INDEX_PATH = 'https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json'

Hi, I have the same problem. Could you help me how I should tackle it?
Thank you

@evovinetu
Copy link

Hi, I have the same problem. Could you help me how I should tackle it?
Thank you

Hi,read my last post.

@soans1994
Copy link

dont use the python idle software. run the python code in terminal.

@kuleen179
Copy link

Hi fchollet, Now, I'm using vgg16 under Keras to classify oxford 102 flower dataset and I want to download the trained weight file: vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5. But I cannot download it... Wourld you please email this file to me? thank u very much. my email: songmh_1@hotmail.com

Try this before downloading VGG16:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

@JayamalaB
Copy link

from . import get_submodules_from_kwargs
ImportError: attempted relative import with no known parent package
can u provide me a solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests