hwalsuklee / tensorflow-fast-style-transfer

A simple, concise tensorflow implementation of fast style transfer
Apache License 2.0
245 stars 70 forks source link

Android conversion #15

Open e-papa opened 5 years ago

e-papa commented 5 years ago

Hello, first of all thank you for your code.

I successfully used it to train a model and style some images using a GPU. Then, I would like to port the model on an Android device and try it there, but unfortunately I wasn't able to proceed.

I see the pbtxt file is missing from the directory where the checkpoints are saved so I wasn't able to proceed to freeze the graph and optimize it for mobile. I tried modifying your files to make them save the pbtxt file but I'm not sure I did it correctly. I added tf.train.write_graph(self.sess.graph_def, ".", "graph.pbtxt") just before res = saver.save(self.sess,self.save_path+'/final.ckpt') in style_transfer_trainer.py.

The saved graph file is probably way too big (~650MB), and anyway, using the summarize_graph from tensorflow I get 211 possible outputs, so unfortunately I don't know then how to freeze and optimize it.

Could you give me some advices? Thank you.