Cloud-CV / Cloud-CV/Fabrik

Models exported as graphdef protos for Tensorflow cannot be trained.

Open
#447 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

When graphdefs are imported using tf.import_graph_def(), variable collections within tensorflow such as GLOBAL_VARIABLES and TRAINABLE_VARIABLES are not updated. Since tensorflow optimizers look for variables to optimize in the above collections by default, calling tf.train.Optimizer.minimize() fails with an error saying that there are no variables to be optimized.

This strangely seems to be an issue only with graphdefs extracted from the keras backend session and not a problem with Fabrik.

A better way would be to export metagraphdefs, which contain the graphdef along with information about variable collections, which are restored when the metagraphdef is imported. Exporting models for tensorflow as .meta files can be done with very little change in the export logic as it is now.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.