keras-vgg-buddy icon indicating copy to clipboard operation
keras-vgg-buddy copied to clipboard

importing VGG16 from keras_vgg_buddy

Open calocedrus opened this issue 8 years ago • 4 comments

I have installed successfully keras-vgg-buddy, I have keras installed too (keras was installed via anaconda), but when running the example in keras-vgg-buddy-master/examples (e.g. conv_features.py) I'm being told that VGG16 can't be found. ImportError: cannot import name 'vgg16' I have downloaded vgg16_weights.h5, it's in the keras-vgg-buddy-master/keras_vgg_buddy. What should I pay attention to so that I can run the examples?

calocedrus avatar May 17 '16 07:05 calocedrus

Thanks for reporting this. It should work now if you pull/install the latest version from pypi. Let me know if it doesn't, though!

awentzonline avatar May 17 '16 18:05 awentzonline

Adam, thank you for the prompt reply and update. The error is gone and I can run conv_features all right but get an error for classify.py:

python classify.py --weights ../../vgg16_weights.h5 ../TestImages/tigerCat.jpeg gives me:

Traceback (most recent call last): File "classify.py", line 19, in print('Best guess: {}'.format(IMAGENET_CLASSES[best_class])) KeyError: 14032 It may be related to my feeding the example with an inapropriate image, I tried it with images of a tiger cat (obtained from http://image-net.org/synset?wnid=n02123159) and a forklift but get the same error (with a different "KeyError" number though). Is there any condition to respect on the input image or a preliminary step to take before running the example?

Ludovic

calocedrus avatar May 18 '16 01:05 calocedrus

Are you using the reduced-size weights from the readme? That file only contains the convolutional layers which would explain why argmax is returning a number greater than 1000. The weight file here: https://drive.google.com/file/d/0Bz7KyqmuGsilT0J5dmRCM0ROVHc/view?usp=sharing contains the entire model with the final fully-connected layers. The full set of weights is 500+MB vs ~50MB for just the conv layers, which is why the option exists.

I'll update the readme since I see it really doesn't explain this.

awentzonline avatar May 18 '16 15:05 awentzonline

Yes indeed, I was using the reduced weight files, I'll try with the full set.

Le Mercredi 18 mai 2016 23h15, Adam Wentz <[email protected]> a écrit :

Are you using the reduced-size weights from the readme? That file only contains the convolutional layers which would explain why argmax is returning a number greater than 1000. The weight file here: https://drive.google.com/file/d/0Bz7KyqmuGsilT0J5dmRCM0ROVHc/view?usp=sharing contains the entire model with the final fully-connected layers. The full set of weights is 500+MB vs ~50MB for just the conv layers, which is why the option exists.I'll update the readme since I see it really doesn't explain this.— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

calocedrus avatar May 18 '16 15:05 calocedrus