neural-style-tf
neural-style-tf copied to clipboard
Is there any "neural_style.py" for TensorFlow 2.0?
There is a script (tf_upgrade_v2 ) to convert "neural_style.py" from TensorFlow 1.X to TensorFlow 2.0 but the result script do not runs.
you should be able to just run this version in tf2.0. You’ll get some warnings but it works fine. at some point they may actually deprecate tf1 functions but for now it works fine.
Not true. Do not runs. Error with session
On 19/10/19 01:39, Derrick Schultz wrote:
you should be able to just run this version in tf2.0. You’ll get some warnings but it works fine. at some point they may actually deprecate tf1 functions but for now it works fine.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cysmith/neural-style-tf/issues/93?email_source=notifications&email_token=ANMH3PJBUD773YO6EVNBFITQPJJN7A5CNFSM4I5GJOUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBWS4KQ#issuecomment-544026154, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMH3PIQNWJ3CZ6LGXTTMRTQPJJN7ANCNFSM4I5GJOUA.
runs perfectly fine!!!
I get an exception when using the latest Tensorflow 2.x version. After downgrading via pip install tensorflow==1.15
everything works fine.
Exception:
Traceback (most recent call last): File "neural_style.py", line 858, in <module> main() File "neural_style.py", line 855, in main else: render_single_image() File "neural_style.py", line 824, in render_single_image stylize(content_img, style_imgs, init_img) File "neural_style.py", line 550, in stylize with tf.device(args.device), tf.Session() as sess: AttributeError: module 'tensorflow' has no attribute 'Session'
Yeah, it still doesn't run even after using the tf_upgrade_v2 script because of a fully deprecated function in there called contrib(). Unlike the rest of the deprecated functions that just have new syntax that can be easily swapped out, it has to be fixed on a case-by-case basis. I tried for a little bit, but I have zero experience with the TensorFlow framework, so I eventually gave up and just downgraded to tensorflow 1.15.
Add "import tensorflow.compat.v1 as tf" to "neural_style.py"