ml5js / training-styletransfer

Style Transfer training and using the model in ml5js
Other
72 stars 30 forks source link

Update repo please?? #9

Open quintendewilde opened 3 years ago

quintendewilde commented 3 years ago

I'm trying to make this to work on current platform and versions but it's very hard for a newbie like me..

Any help with this?

disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version. Instructions for updating: non-resource variables are not supported in the long term Traceback (most recent call last): File "style.py", line 6, in from optimize import optimize File "src/optimize.py", line 6, in from utils import get_img File "src/utils.py", line 23 return img ^

IndentationError: expected an indented block
(mlquinten) ubuntu@ip-172-31-51-152:~/training_styletransfer$ sudo nano src/utils.py
(mlquinten) ubuntu@ip-172-31-51-152:~/training_styletransfer$ bash run.sh
WARNING:tensorflow:From /home/ubuntu/mlquinten/lib/python3.7/site-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Traceback (most recent call last):
  File "style.py", line 6, in <module>
    from optimize import optimize
  File "src/optimize.py", line 6, in <module>
    from utils import get_img
  File "src/utils.py", line 22
    return img
         ^
IndentationError: expected an indented block
(mlquinten) ubuntu@ip-172-31-51-152:~/training_styletransfer$ sudo nano src/utils.py
(mlquinten) ubuntu@ip-172-31-51-152:~/training_styletransfer$ bash run.sh
WARNING:tensorflow:From /home/ubuntu/mlquinten/lib/python3.7/site-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
ml5.js Style Transfer Training!
Note: This traning will take a couple of hours.
Training is starting!...
Train set has been trimmed slightly..
(1, 512, 362, 3)
UID: 25
Traceback (most recent call last):
  File "style.py", line 179, in <module>
    main()
  File "style.py", line 156, in main
    for preds, losses, i, epoch in optimize(*args, **kwargs):
  File "src/optimize.py", line 107, in optimize
    X_batch[j] = get_img(img_p, (256,256,3)).astype(np.float32)
ValueError: could not broadcast input array from shape (427,640,3) into shape (256,256,3)
shiffman commented 3 years ago

Hi @quintendewilde, sorry that this repo hasn't had a lot of attention as of late! I was recently able to train the model by following @yining1023's google colab notebook:

https://colab.research.google.com/drive/1TZNdhoUEBoxQqY5EFloZcuyYUs9oNQ-g?usp=sharing

More info: https://github.com/yining1023/machine-learning-for-the-web/tree/master/week5-styleTransfer#coding-session

epphone commented 1 year ago

Hello! I have recently used the google colab notebook to train a model for style transfer for a new and exciting installation I made. However I had many problems with compatibility, due to colab not being able to install the tensorflow v1.14. Turns out(!), training with newer versions leads to functional models to use with ml5, even with ml5's older tensorflow implementation.

I have a new colab notebook here, but I had to change a couple of files :

Here is the new notebook : https://colab.research.google.com/drive/1TFuIUStPP3bZMrjPYyIwcVVLHAVeCEXo?usp=sharing

I've include a zip with the updated files, but maybe forks of the above githubs with updated files would be better? ml5_styleTransfer_github.zip Still a noob at Github, sorry! Thanks!