Tensorflow freeze_graph script failing on model defined with Keras

前端 未结 2 1401
小鲜肉
小鲜肉 2021-01-01 02:02

I\'m attempting to export a model built and trained with Keras to a protobuffer that I can load in a C++ script (as in this example). I\'ve generated a .pb file containing t

2条回答
  •  情话喂你
    2021-01-01 02:33

    So, I got it working. Sort of.

    By using tensorflow.python.client.graph_util.convert_variables_to_constants directly instead of first saving GraphDef and a checkpoint to disk and then using the freeze_graph tool/script, I have been able to save a GraphDef containing both graph definition and variables converted to constants.

    EDIT

    mrry updated his answer, which solved my issue of freeze_graph not working, but I'll leave this answer as well, in case anyone else could find it useful.

提交回复
热议问题