fast-style-transfer icon indicating copy to clipboard operation
fast-style-transfer copied to clipboard

Convert checkpoint state to model

Open KostyaAtarik opened this issue 7 years ago • 4 comments

Hello! After training I have 4 files (checkpoint, fns.ckpt, fns.ckpt.index, fns.ckpt.meta) in checkpoint directory, 200 Mb in total. And to evaluate picture with learned style i need all these 4 files, but your pretrained models are single files of 20 Mb each one. How can I convert my 4 files to such a model file? Thank you for your attention!

KostyaAtarik avatar Jan 22 '18 09:01 KostyaAtarik

@KostyaAtarik After training my model, I also have the following files; checkpoint, fns.ckpt.data-00000-of-00001, fns.ckpt.index, and fns.ckpt.meta. You can evaluate using the /path/to/trained/model/checkpoint. Don't need to specify the exact files. It worked for me to only supply the checkpoint folder.

python evaluate.py --checkpoint path/to/style/checkpoint --in-path dir/of/test/imgs/ --out-path dir/for/results/

jshaw avatar Feb 24 '18 18:02 jshaw

@jshaw Thank you for your answer! It works for me too to evaluate using the checkpoint folder, but what I was actually asking is how to convert the mess in the checkpoint folder to one tiny handy to transfer and use model file.

KostyaAtarik avatar Feb 27 '18 14:02 KostyaAtarik

Tensorflow's Saver class seems to have been updated since the release of this project.

Change saver = tf.train.Saver() to saver = tf.train.Saver(write_version=tf.train.SaverDef.V1)

it's in src/optimize.py

#78

onyedikilo avatar Feb 27 '18 16:02 onyedikilo

saver = tf.train.Saver(write_version=tf.train.SaverDef.V1)

For Tensorflow 2 users:

saver = tf.compat.v1.train.Saver(write_version=tf.compat.v1.train.SaverDef.V1)

ruslo avatar Feb 25 '24 04:02 ruslo