具体错误信息如下:
Traceback (most recent call last):
File "/home/wanghao/bin/pycharm-2017.1.2/helpers/pydev/pydevd.py", line 1585, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/wanghao/bin/pycharm-2017.1.2/helpers/pydev/pydevd.py", line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/wanghao/bin/pycharm-2017.1.2/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/train.py", line 130, in <module>
main()
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/train.py", line 127, in main
train(config_train, args)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/train.py", line 35, in train
gan = Model(config, paths, name=args.name, dataset=args.dataset)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/model.py", line 67, in __init__
self.feature_map_x2 = Network.encoder(self.x2, config, self.training_phase, C=4)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/network.py", line 34, in encoder
out = conv_block(x, filters=f[0], kernel_size=7, strides=1, padding='VALID', actv=actv)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/network.py", line 22, in conv_block
x = tf.layers.conv2d(x, filters, kernel_size, strides=strides, padding=padding, activation=None)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/layers/convolutional.py", line 621, in conv2d
return layer.apply(inputs)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/layers/base.py", line 828, in apply
return self.__call__(inputs, *args, **kwargs)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/layers/base.py", line 699, in __call__
self.build(input_shapes)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/layers/convolutional.py", line 144, in build
dtype=self.dtype)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/layers/base.py", line 546, in add_variable
partitioner=partitioner)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/training/checkpointable.py", line 436, in _add_variable_with_custom_getter
**kwargs_for_getter)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 1317, in get_variable
constraint=constraint)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 1079, in get_variable
constraint=constraint)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 425, in get_variable
constraint=constraint)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 394, in _true_getter
use_resource=use_resource, constraint=constraint)
File "/home/zqzhu/tensorflow3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 733, in _get_single_variable
name, "".join(traceback.format_list(tb))))
ValueError: Variable generator/encoder_image/conv2d/kernel already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/network.py", line 22, in conv_block
x = tf.layers.conv2d(x, filters, kernel_size, strides=strides, padding=padding, activation=None)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/network.py", line 34, in encoder
out = conv_block(x, filters=f[0], kernel_size=7, strides=1, padding='VALID', actv=actv)
File "/home/zqzhu/EX/GAN_CC/generative-compression-master/model.py", line 62, in __init__
self.feature_map = Network.encoder(self.example, config, self.training_phase, config.channel_bottleneck)
这个模型还是原来的模型,只不过是好久没跑了今天拿出来跑一下,中间还添加了一些东西结果就出现了上面的错误,真是让人捉急啊。
我在原来的模型基础上加了一个多尺度卷积,然后就直接调用原来的编码器了,估计在第一个尺度的时候已经有了错误信息里的kernel,等到下一个尺度的时候他就觉得你那变量已经存在了,果断报错了,这是我的理解,希望有不对之处大家可以多多批评指正!!!
【reference】