0

I tried to apply the trained style transfer code from this GitHub repo to an image I have: https://github.com/lengstrom/fast-style-transfer

I ran these commands in Windows 10 cmd:

conda create -n style-transfer python=3

conda activate style-transfer

conda install tensorflow scipy pillow

pip install moviepy

pip install imageio-ffmpeg

And then this command which is supposed to give me my style-transferred image:

python evaluate.py --checkpoint ./rain-princess.ckpt --in-path 
C:\Users\hp\Downloads\fast-style-transfer-master\fast-style-transfer- 
master\download.jpg --out-path ./output_image.jpg

ERROR REPORT(after Ctrl+C from hanging cmd):

Traceback (most recent call last):
  File "evaluate.py", line 4, in <module>
    import transform, numpy as np, vgg, pdb, os
  File "src\transform.py", line 1, in <module>
    import tensorflow as tf, pdb
  File "C:\Users\hp\Anaconda3\envs\style-transfer\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow._api.v1 import compat
  File "C:\Users\hp\Anaconda3\envs\style-transfer\lib\site-packages\tensorflow\_api\v1\compat\__init__.py", line 21, in <module>
    from tensorflow._api.v1.compat import v1
  File "C:\Users\hp\Anaconda3\envs\style-transfer\lib\site-packages\tensorflow\_api\v1\compat\v1\__init__.py", line 649, in <module>
    from tensorflow_estimator.python.estimator.api._v1 import estimator
  File "C:\Users\hp\Anaconda3\envs\style-transfer\lib\site-packages\tensorflow_estimator\python\estimator\api\__init__.py", line 8, in <module>
    from tensorflow_estimator.python.estimator.api._v1 import estimator
  File "C:\Users\hp\Anaconda3\envs\style-transfer\lib\site-packages\tensorflow_estimator\python\estimator\api\_v1\estimator\__init__.py", line 9, in <module>
    from tensorflow_estimator.python.estimator.api._v1.estimator import export
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 818, in get_code
  File "<frozen importlib._bootstrap_external>", line 917, in get_data
  KeyboardInterrupt

Initially, when I tried running the python command, there was an AttributeError(imread) from line 16 of the utils.py file in the src folder, which I could solve by deprecating scipy to 1.1.0. Then tensorflow errors with using v1 attributes started popping up one after the other. Then I uninstalled and reinstalled tensorflow. Then it gave me an error report stating that operations of the program can't be done on the resources I have.

So I removed that environment and repeated the entire procedure all over again. And now this is the error report I am getting. Any help would be so great.

EDIT: Tried running the command to execute the program again. Then the AttributeError with imread came up. So I deprecated scipy using:

pip install scipy==1.1.0

Then when I try executing, this is the error report that comes up. It was continuously printing the error in loop(the same content again and again):

OMP: Info #212: KMP_AFFINITY: decoding x2APIC ids.
OMP: Info #210: KMP_AFFINITY: Affinity capable, using global cpuid leaf 11 info
OMP: Info #154: KMP_AFFINITY: Initial OS proc set respected: 0-7
OMP: Info #156: KMP_AFFINITY: 8 available OS procs
OMP: Info #157: KMP_AFFINITY: Uniform topology
OMP: Info #179: KMP_AFFINITY: 1 packages x 4 cores/pkg x 2 threads/core (4 total cores)
OMP: Info #214: KMP_AFFINITY: OS proc to physical thread map:
OMP: Info #171: KMP_AFFINITY: OS proc 0 maps to package 0 core 0 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 1 maps to package 0 core 0 thread 1
OMP: Info #171: KMP_AFFINITY: OS proc 2 maps to package 0 core 1 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 3 maps to package 0 core 1 thread 1
OMP: Info #171: KMP_AFFINITY: OS proc 4 maps to package 0 core 2 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 5 maps to package 0 core 2 thread 1
OMP: Info #171: KMP_AFFINITY: OS proc 6 maps to package 0 core 3 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 7 maps to package 0 core 3 thread 1
OMP: Info #250: KMP_AFFINITY: pid 1008 tid 11960 thread 0 bound to OS proc set 0
OMP: Info #250: KMP_AFFINITY: pid 1008 tid 10360 thread 1 bound to OS proc set 2
OMP: Info #250: KMP_AFFINITY: pid 1008 tid 3516 thread 2 bound to OS proc set 4
OMP: Info #250: KMP_AFFINITY: pid 1008 tid 1984 thread 3 bound to OS proc set 6
WARNING:tensorflow:From evaluate.py:85: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From evaluate.py:88: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2019-10-13 19:44:56.652411: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations:  AVX AVX2
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2019-10-13 19:44:56.678997: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.
WARNING:tensorflow:From evaluate.py:90: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From src\transform.py:66: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.

WARNING:tensorflow:From evaluate.py:94: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.

WARNING:tensorflow:From C:\Users\hp\Anaconda3\envs\style-transfer\lib\site-packages\tensorflow\python\training\saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
2019-10-13 19:45:15.381542: W tensorflow/core/common_runtime/colocation_graph.cc:1016] Failed to place the graph without changing the devices of some resources. Some of the operations (that had to be colocated with resource generating operations) are not supported on the resources' devices. Current candidate devices are [
  /job:localhost/replica:0/task:0/device:CPU:0].
See below for details of this colocation group:
Colocation Debug Info:
Colocation group had the following types and supported devices:
Root Member(assigned_device_name_index_=-1 requested_device_name_='/device:GPU:0' assigned_device_name_='' resource_device_name_='/device:GPU:0' supported_device_types_=[CPU] possible_devices_=[]
VariableV2: CPU
Assign: CPU
Identity: CPU

Colocation members, user-requested devices, and framework assigned devices, if any:
  Variable (VariableV2) /device:GPU:0
  Variable/Assign (Assign) /device:GPU:0
  Variable/read (Identity) /device:GPU:0
  save/Assign (Assign) /device:GPU:0

I would appreciate if someone could help me figure out what the issue is.

Gerhard
  • 22,678
  • 7
  • 27
  • 43
Pooja Vinod
  • 1
  • 1
  • 2
  • Hi Pooja, can you provide the full error trace without the keyboard interrupt. – Ghost Oct 13 '19 at 12:43
  • Hi @Ghost, I have edited the post above to update the error reports I am getting now. Thanks. – Pooja Vinod Oct 13 '19 at 14:27
  • Hi Pooja, from the error trace I think you are using a GPU machine. Am i wrong? If you are using gpu, can you check if the tensorflow version that you are using is compatible with the cudnn. – Ghost Oct 13 '19 at 14:40
  • Hey @Ghost, my tensorflow version is 2.0.0 and when I tried executing conda list cudnn, I am returned with nothing.(the command executes but nothing is returned under the Name, Version and Build Channel headers. This means I don't have cudNN right?) – Pooja Vinod Oct 14 '19 at 08:34
  • Hi Pooja, does your machine have nvidia gpu? If you have nvidia gpu, you can use this to check cudnn version https://stackoverflow.com/questions/45641087/on-windows-how-do-you-verify-the-version-number-of-cudnn-installed. If you don't have, you need to install it and rerun your code.. – Ghost Oct 14 '19 at 08:35

0 Answers0