Comments (21)
@slashstar you can get it from here (580MB), if I have enough space on dropbox in a few mins 🙈 :
https://www.dropbox.com/s/xnm9j3ftc1zh8tc/vgg_face_model_weights.h5?dl=0
from deep-learning-models.
Consider creating a PR to add these weights (you can upload the files on gDrive for now and I will include them in the repo). Caffe models can be automatically converted to Keras models.
from deep-learning-models.
@fchollet, can you explain how to convert Caffe model to Keras model? There is VGG-16 model trained on 205places dataset, and i want to use it in Keras. I tried to use @MarcBS code for conversion, but didn't succeed on it.
from deep-learning-models.
I was referring to the code by @MarcBS. Why isn't it working? Marc, can you help?
from deep-learning-models.
It seems the prototxt provided with VGG-FACE is an old version (see ethereon/caffe-tensorflow#44). Take a look at this comment, it points out the changes you'll have to do in VGG_FACE_deploy.prototxt
.
EDIT: I modified the prototxt and it worked. Here is the updated one.
from deep-learning-models.
The model did convert, however when I tried to load it I got the following error:
AssertionError: Keyword argument not understood: b_learning_rate_multiplier
I tried to load it based on @MarcBS code:
from keras.models import Sequential, Graph, model_from_json
from keras.optimizers import SGD
import numpy as np
import copy
model = model_from_json(open('./Keras_model_structure.json').read())
from deep-learning-models.
Try to only load/save the weights, not the model topology.
On 24 August 2016 at 06:06, Victor Hugo [email protected] wrote:
The model did convert, however when I tried to load it I got the following
error:AssertionError: Keyword argument not understood: b_learning_rate_multiplier
I tried to load it based on @MarcBS code
https://github.com/MarcBS/keras/blob/master/keras/caffe/test_converted.py
:from keras.models import Sequential, Graph, model_from_json
from keras.optimizers import SGD
import numpy as np
import copy
model = model_from_json(open('./Keras_model_structure.json').read())—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AArWbzLlFtoaLKnicYa7hOoL70GGUfrkks5qjEG4gaJpZM4JeGxo
.
from deep-learning-models.
It also didn't work, but I think it might be something related to the conversion.
In [12]: model = load_model('./Keras_model_weights.h5')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-9925206257bf> in <module>()
----> 1 model = load_model('./Keras_model_weights.h5')
/usr/local/lib/python2.7/dist-packages/Keras-1.0.6-py2.7.egg/keras/models.pyc in load_model(filepath, custom_objects)
124 model_config = f.attrs.get('model_config')
125 if model_config is None:
--> 126 raise ValueError('No model found in config file.')
127 model_config = json.loads(model_config.decode('utf-8'))
128 model = model_from_config(model_config, custom_objects=custom_objects)
ValueError: No model found in config file.
from deep-learning-models.
I think @fchollet meant to try to define the model in the python script and try to load the weights via model.load_weights
.
from deep-learning-models.
@victorhcm, I am sorry for not being able to answer sooner. I tried converting the model with your .prototxt and testing it and it worked fine for me. For clarification here I write the steps that I followed:
For all the following steps (either conversion and test) we must use the keras fork in this link.
Conversion
- Copy the files VGG_FACE.caffemodel and VGG_FACE_deploy_updated.prototxt into to same folder (e.g. '/VGG_Face')
- Run the following command inside the directory '/keras/caffe':
python caffe2keras.py -load_path '/VGG_Face/' -prototxt 'VGG_FACE_deploy_updated.prototxt' -caffemodel 'VGG_FACE.caffemodel'
Test
- Inside the same directory, modify the file 'test_converted_VGG_FACE.py' (see file here). Change the model_path and the path to the image used for testing.
- Run the following command:
python test_converted_VGG_FACE.py
from deep-learning-models.
I have this more or less working... I will send a PR soonish... just in case someone else is working on this.
from deep-learning-models.
I've already upload the weights of VGG_Face,please refer to fchollet/deep-learning-models#15.
from deep-learning-models.
Hi,
@kashif , @victorhcm : Can you share the converted weighted of vgg-face?
Thanks.
from deep-learning-models.
@kashif , Thanks for sharing the network weights.
from deep-learning-models.
@kashif FYI it's not there anymore.
from deep-learning-models.
@danielvarga did you get it? @slashstar The link doesn't work.
from deep-learning-models.
sorry @danielvarga @adwin5 my dropbox got too full... i am putting it back...
https://www.dropbox.com/s/xnm9j3ftc1zh8tc/vgg_face_model_weights.h5?dl=0
can you try?
from deep-learning-models.
Got it, thank you! I've uploaded it to
http://people.mokk.bme.hu/~daniel/vgg_face_model_weights.h5
@kashif Is this okay with you? If yes: I won't give any hard promises that the above link stays live for a long time, but my expectation is that it does.
from deep-learning-models.
@MarcBS
Hi,
First of all, thank you for such an amazing module for converting caffe model to keras model.
I followed the instructions that you mentioned in this thread to generate the keras version of VGG face and I could convert it successfully. I used test_converted_VGG_FACE.py
to test on the new face images and it works when I use your script from the same location where you are keeping. But when I bring out your script from the directory where you are keeping and run to make a prediction, it shows following error. Could you please comment on it, why its not working? I have latest keras 1.2.2 installed on my machine. I tried downgrading the version to 1.2.0 and tried to run, it still does not work.
`Using Theano backend.
Preparing test image.
Loading model.
Traceback (most recent call last):
File "test_converted_VGG_FACE.py", line 52, in <module>
model = model_from_json(open(model_path+'/Keras_model_structure.json').read())
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/models.py", line 210, in model_from_json
return layer_from_config(config, custom_objects=custom_objects)
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 38, in layer_from_config
return layer_class.from_config(config['config'], custom_objects=custom_objects)
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/engine/topology.py", line 2575, in from_config
process_layer(layer_data)
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/engine/topology.py", line 2553, in process_layer
custom_objects=custom_objects)
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 40, in layer_from_config
return layer_class.from_config(config['config'])
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/engine/topology.py", line 1016, in from_config
return cls(**config)
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/layers/convolutional.py", line 388, in __init__
super(Convolution2D, self).__init__(**kwargs)
File "/Users/XXX/anaconda2/envs/python2/lib/python2.7/site-packages/keras/engine/topology.py", line 323, in __init__
raise TypeError('Keyword argument not understood:', kwarg)
TypeError: ('Keyword argument not understood:', u'b_learning_rate_multiplier')
`
from deep-learning-models.
@bienbinod, thank you for your feedback.
If you are using the original Keras repo your converted models won't work. You must use this Keras fork, given that the converter also uses that specific version.
from deep-learning-models.
@MarcBS Thanks for your quick reply. I did as you suggested and it works.
from deep-learning-models.
Related Issues (20)
- ResNet50 unexpected keyword argument 'include_top' HOT 3
- Optimize AUC metric on compile function with R Keras API
- Resnet50 raises AttributeError: 'NoneType' object has no attribute 'image_data_format'
- An existing connection was forcibly closed by the remote host HOT 1
- Resnet50 has wrong shape after stem - problem was corrected in keras-applications version.
- Making a Keras layer dynamic for Tensorflow operations(Tensorflow object detection API) HOT 1
- Would it be possible to integrate object detection or image segmentation models?
- ImportError: cannot import name '_obtain_input_shape' from 'keras.applications.imagenet_utils' (C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\applications\imagenet_utils.py) HOT 1
- -- issue is added by mistake --
- Why keras is slower HOT 1
- Why keras is slower'
- how to change the models' path ?
- No normalization in prepocess_input function HOT 1
- keras applications
- Loading Keras Model for Multiprocess
- download speed too slow HOT 2
- NameError: name 'X_val_prep' is not defined
- ValueError: Error when checking input: expected vgg16_input to have shape (244, 244, 3) but got array with shape (224, 224, 3)
- The model expects 0 input arrays, but only received one array.
- SignatureDoesNotMatch when downloading the releases v0.7 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deep-learning-models.