awentzonline / keras-vgg-buddy

A real pal when you want to add VGG16 to your Keras model.
MIT License
27 stars 10 forks source link

importing VGG16 from keras_vgg_buddy #1

Open calocedrus opened 8 years ago

calocedrus commented 8 years ago

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?

awentzonline commented 8 years ago

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!

calocedrus commented 8 years ago

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

awentzonline commented 8 years ago

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.

calocedrus commented 8 years ago

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

Le Mercredi 18 mai 2016 23h15, Adam Wentz <notifications@github.com> 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