5

I have an old model defined and trained using tensorflow, and now I would like to work on it but I'm currently using Keras for everything.

So the question is: is it possible to load a tf cehckpoint (with *.index, *.meta etc..) into a Keras model?

I am aware of old questions like: How can I convert a trained Tensorflow model to Keras?.

I am hoping that after 2 years, and with keras being included into tf, there would be a easier way to do it now.

Unfortunately I don't have the original model definition in tf; I may be able to find it, but it would be nicer if it wasn't necessary.

Thanks!

ClonedOne
  • 569
  • 4
  • 20

1 Answers1

2

In the below link, which is the official TensorFlow tutorial, the trained model is saved and it has .ckpt extension. After, it is loaded and is used with Keras model.

I think it might help you.

https://www.tensorflow.org/tutorials/keras/save_and_restore_models

flip flop
  • 128
  • 5
  • Thank you! Unfortunately, as I mentioned, I don't really have the original model definition code, so I would need a way to load the model definition from the checkpoint before using load_weights() – ClonedOne Jul 08 '19 at 20:36
  • 1
    Sorry, I misunderstood that part! According to the below link (section 3a), you can use .meta file in order to create your network without manually. https://cv-tricks.com/tensorflow-tutorial/save-restore-tensorflow-models-quick-complete-tutorial/ – flip flop Jul 08 '19 at 20:47