The specific error message is as follows:
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)
This model is still the original model. It’s just that I haven’t run for a long time. I took it out and ran it today. Some things were added in the middle and the above error appeared. It’s really anxious.
I added a multi-scale convolution on the basis of the original model, and then directly called the original encoder. It is estimated that the kernel in the error message is already available at the first scale, and he will wait for the next scale. I feel that your variable already exists, and you decisively reported an error. This is my understanding. I hope that there is something wrong with everyone. ! !
【reference】