运行样式传输代码时的Cmd错误

时间:2019-10-13 07:21:27

标签: python tensorflow deep-learning

我试图将来自此GitHub存储库的训练有素的样式转换代码应用于我拥有的图像:https://github.com/lengstrom/fast-style-transfer

我在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

然后是应该给我我样式转换图像的命令:

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

错误报告(在Ctrl + C挂起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

最初,当我尝试运行python命令时,src文件夹中utils.py文件的第16行出现AttributeError(imread),可以通过将scipy弃用至1.1.0来解决。然后使用v1属性的tensorflow错误开始一个接一个地弹出。然后我卸载并重新安装了tensorflow。然后,它给了我一个错误报告,指出无法在我拥有的资源上执行程序的操作。

因此,我删除了该环境,并再次重复了整个过程。现在这是我得到的错误报告。任何帮助都会很棒。

编辑:尝试运行命令以再次执行程序。然后出现了具有imread的AttributeError。所以我不赞成使用scipy:

pip install scipy==1.1.0

然后,当我尝试执行时,这是出现的错误报告。它不断循环打印错误(一次又一次地重复相同的内容):

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

如果有人能帮助我找出问题所在,我将不胜感激。

0 个答案:

没有答案