-
Notifications
You must be signed in to change notification settings - Fork 1k
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
freezing models #23
Comments
While the script currently does not directly support this, it is fairly straightforward to create a "frozen" version from the emitted code. See this related issue for details. |
The linked related issue is not what I meant. It uses a saver to save the weights. But as I understand it the graph_def will be separate.
I think what you suggested is using the generated py from caffe-tensorflow to build the graph, and store the weights as a checkpoint file. This is not what I and others mean by a 'frozen' model. i.e. it can still be trained as all the weights are still variables. What I asked for is different though, I would like to have the graph and weights stored in a single graph_def proto file. To do that you need to convert the weights from variables to constants and then write the graph_def proto to a file (this doesn't use a Saver, but tf.train.write_graph. Anyway, I'll write a script to do it. I understand that this lib doesn't support that directly. I just thought it would be useful to create 'frozen' (non variable) versions of the caffe models. |
Apologies - looks like I misinterpreted your question. You're right - it would be a useful addition. I'll re-open this issue as a reminder. |
@apcode I use this snippet code to convert to a graphdef file. Hope it helps.
|
for the second half of the solution above, freeze_graph did not work for me but convert_variables_to_constant worked for me: http://stackoverflow.com/a/38853802/5597458 |
The tensorflow retrain.py example uses a frozen inception model that is entirely defined within the graphdef. By frozen, I mean they convert all the variables to constants in the graph so they get stored to the graphdef proto. This way everything is in one file.
Would it be possible to add this as an option to this lib?
The text was updated successfully, but these errors were encountered: