neural-style-tf icon indicating copy to clipboard operation
neural-style-tf copied to clipboard

Is there any "neural_style.py" for TensorFlow 2.0?

Open luisgo007 opened this issue 5 years ago • 6 comments

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.

luisgo007 avatar Oct 03 '19 17:10 luisgo007

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.

dvschultz avatar Oct 19 '19 00:10 dvschultz

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.

luisgo007 avatar Oct 19 '19 08:10 luisgo007

runs perfectly fine!!!

0merjavaid avatar Nov 26 '19 12:11 0merjavaid

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'

THEAccess avatar Jan 11 '20 19:01 THEAccess

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.

siegmattel avatar Jan 14 '20 03:01 siegmattel

Add "import tensorflow.compat.v1 as tf" to "neural_style.py"

PIPDesign avatar Aug 26 '21 07:08 PIPDesign