Creating your own style transfer mirror with Gradient° and ml5.js

tutorial

#1

In this post, we will learn how to train a style transfer network with Paperspace's Gradient° and use the model in ml5.js to create an interactive style transfer mirror. This post is the second on a series of blog posts dedicated to train machine learning models in Paperspace and then use them in ml5.js. You can read the first post in this series on how to train a LSTM network to generate text here.


This is a companion discussion topic for the original entry at https://blog.paperspace.com/creating-your-own-style-transfer-mirror/

#2

Thanks for the great Tutorial, but when I start the training, the process is interrupted because of a missing file:

1 ml5.js Style Transfer Training!
2 Note: This traning will take a couple of hours.
3 Training is starting!...
4 (1, 2000, 1510, 3)
5 UID: 9
6 Training complete. For evaluation:
7    `python evaluate.py --checkpoint checkpoints/ ...`
8 Converting model to ml5js
9 Traceback (most recent call last):
10  File "style.py", line 179, in <module>
11    main()
12  File "style.py", line 175, in main
13    dump_checkpoints(kwargs['save_path'], options.model_dir)
14  File "/paperspace/dump_checkpoints.py", line 58, in dump_checkpoints
15    reader = tf.train.NewCheckpointReader(chk_fpath)
16  File "/usr/local/lib/python2.7/dist-    packages/tensorflow/python/pywrap_tensorflow_internal.py", line 150, in NewCheckpointReader
17    return CheckpointReader(compat.as_bytes(filepattern), status)
18  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
19    c_api.TF_GetCode(self.status.status))
20 tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader     constructor: Failed to find any matching files for checkpoints/fns.ckpt
21 PSEOF

Any ideas why that is?
Thanks!


#3

Hi @manolis!

I just updated some changes to repository. The path to the COCO dataset was updated and that wasn’t been reflected in this code. If you pull the latest changes and try again it should work.

let me know how it goes


#5

Thanks @Cris_Valenzuela
After the update it worked great!


#6

Ran it, started fine, then got an error in node console. Spat out bad gateway and what looks like the html of the error page.

Output E:\Dropbox\Paperspace\training_styletransfer>paperspace jobs create --container
cvalenzuelab/styletransfer --machineType P5000 --command ‘./run.sh’ --project ‘S
tyle Transfer training’
Zipping directory training_styletransfer [=============] 12299440/bps 100% 0.0s
Uploading training_styletransfer.zip [==================] 3799971/bps 100% 0.0s
New jobId: j07a4wthzgudy
Cluster: PS Jobs
Job Pending
Waiting for job to run…

ETC

Checked Paperspace gradient under jobs, found this error:

1[FATAL tini (7)] exec ./run.sh failed: No such file or directory
2PSEOF

Suggestions?


#7

Hi - I am confused as to what the purpose of the --test image is. Does this improve / influence results? Does it matter what style of image this is in comparison to our style image? I can’t seem to find much explanation on this, even in the fast style transfer github repo.


#8

Hey! it seems that the file run.sh is not in the directory. Can you double check that this file is your folder: https://github.com/Paperspace/training_styletransfer/blob/master/run.sh


#9

When training, the test image will be used to test the results of the model over time. It’s just a way of visualizing progress. It will not improve or influence the results.