Hellcatzm / DCGAN_TensorFlow

通过DCGAN生成动漫人物头像
80 stars 18 forks source link

请教报错 #2

Open PaulZzu opened 5 years ago

PaulZzu commented 5 years ago

本地使用docker,拿到的是TensorFlow 最新版本(直接拿的docker),python2.7

报错信息如下: Traceback (most recent call last): File "DCGAN_reload.py", line 48, in reload_dcgan() File "DCGAN_reload.py", line 43, in reload_dcgan samples = sess.run(end_points['sample_output'], feed_dict={end_points['initial_z']: sample_z}) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1152, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1328, in _do_run run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1348, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value generator/g_h2/w [[node generator/g_h2/w/read (defined at /notebooks/myBun/DCGAN_TensorFlow/ops.py:159) = IdentityT=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Caused by op u'generator/g_h2/w/read', defined at: File "DCGAN_reload.py", line 48, in reload_dcgan() File "DCGAN_reload.py", line 33, in reload_dcgan end_points = dcgan() File "/notebooks/myBun/DCGAN_TensorFlow/DCGAN_function.py", line 90, in dcgan g = generator(z) File "/notebooks/myBun/DCGAN_TensorFlow/DCGAN_function.py", line 78, in generator h2 = deconv2d(h1, [batch_size, s_h4, s_w4, gf_dim 2], scope='g_h2') File "/notebooks/myBun/DCGAN_TensorFlow/ops.py", line 159, in deconv2d w = tf.get_variable('w', [k_h, k_w, outputshape[-1], input.get_shape()[-1]],initializer=tf.random_normal_initializer(stddev=0.02)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 1487, in get_variable aggregation=aggregation) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 1237, in get_variable aggregation=aggregation) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 540, in get_variable aggregation=aggregation) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 492, in _true_getter aggregation=aggregation) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 922, in _get_single_variable aggregation=aggregation) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 183, in call return cls._variable_v1_call(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 146, in _variable_v1_call aggregation=aggregation) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 125, in previous_getter = lambda kwargs: default_variable_creator(None, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 2444, in default_variable_creator expected_shape=expected_shape, import_scope=import_scope) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 187, in call return super(VariableMetaclass, cls).call(*args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 1329, in init constraint=constraint) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 1491, in _init_from_args self._snapshot = array_ops.identity(self._variable, name="read") File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 81, in identity return gen_array_ops.identity(input, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3454, in identity "Identity", input=input, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1770, in init self._traceback = tf_stack.extract_stack()

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value generator/g_h2/w [[node generator/g_h2/w/read (defined at /notebooks/myBun/DCGAN_TensorFlow/ops.py:159) = IdentityT=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

请问我这是哪出了问题? 多谢!其他基本都OK,只有一些警告信息!

Amberian commented 5 years ago

没有训练好的参数模型的话就要先去训练,你这里没有找到训练好的模型,参数就都没有初始化,会报错

PaulZzu commented 5 years ago

非常感谢!

paulzzu@buntoy.com

发件人: Amberian 发送时间: 2018-12-13 09:46 收件人: Hellcatzm/DCGAN_TensorFlow 抄送: PaulZzu; Author 主题: Re: [Hellcatzm/DCGAN_TensorFlow] 请教报错 (#2) 没有训练好的参数模型的话就要先去训练,你这里没有找到训练好的模型,参数就都没有初始化,会报错 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.