1

i have had big troubles today with saving formats while training a style-transfer neural network.

The task is already solved i feel, i only need to save my model and load it again. But i can't find a proper way to do it.

I used the following code from github to train a style-transfer network:

https://github.com/nikhilagrawal2000/Neural-Style-Transfer-with-Eager-Execution/blob/master/Neural_Style_Transfer_with_Eager_Execution.ipynb

I already succesfully trained the network.

Now, i saved the model using the following line:

model.save("/tmp/nst/test.h5")

For applying the saved neural network though, i need to use the network in a .ckpt format.

Can someone tell me how to switch the data formats between h5 and .ckpt ?

Or is there a specific save method for keras, so i can save it as .ckpt? (--> pseudocode: model.save_cpkt("/tmp/nst/test.ckpt")

Would be extremely happy if someone could explain that to me, i tried it for several hours now without success.

beinando
  • 477
  • 4
  • 18
  • do you need checkpoint or tensorflow lite? there is a way to transform between tf.keras model and TfLite model – Igna Feb 19 '20 at 20:51

1 Answers1

1

You can save the weights in checkpoint format using:

model.save_weights("modelcheckpoint",save_format="tf")

You can read more about saving weights or models and chepoints here

Igna
  • 1,078
  • 8
  • 18