Open midnitekoder opened 7 years ago
When I wrote this code Tensorflow was pre-1.0 (and I unfortunately haven't kept up with the latest Tensorflow changes), thus I am not entirely sure what the issue is. Can you give some more details about how/when this error occurs?
It occurs when we run the following: python dcgan -t /path/input -o /path/output
Solved with virtualenv so you can have tensorflow 0.8
PATH_TO_PYTHON=/usr/bin/python2.7
(I wasn't able to make it work with python3.5)
virtualenv -p $PATH_TO_PYTHON DCGAN
source DCGAN/bin/activate
then
pip install numpy scikit-image
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
--ignore-installed is probably not necessary
Now you can do python dcgan -t /path/input -o /path/output
After training just deactivate deactivate
Traceback (most recent call last): File "dcgan.py", line 325, in
main(args)
File "dcgan.py", line 316, in main
args.image_size, args.scale_size, args.restore, paths)
File "dcgan.py", line 199, in train_dcgan
D_real = discriminator(real, is_train)
File "/home/chandra/ankit/ganOnCifar/tf-dcgan/models.py", line 172, in discriminator
conv2 = tf.nn.relu(conv2d("d_conv2", conv1, [5, 5, 128, 256], STRIDE_2, is_train=is_train))
File "/home/chandra/ankit/ganOnCifar/tf-dcgan/models.py", line 62, in conv2d
bn = _bn(bottom, is_train) if with_bn else bottom
File "/home/chandra/ankit/ganOnCifar/tf-dcgan/models.py", line 47, in _bn
(mean, variance) = tf.cond(is_train, train_op, test_op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 1741, in cond
orig_res, res_t = context_t.BuildCondBranch(fn1)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 1642, in BuildCondBranch
r = fn()
File "/home/chandra/ankit/ganOnCifar/tf-dcgan/models.py", line 38, in train_op
ema_op = ema.apply([mu, var])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/moving_averages.py", line 375, in apply
colocate_with_primary=(var.op.type in ["Variable", "VariableV2"]))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/slot_creator.py", line 174, in create_zeros_slot
colocate_with_primary=colocate_with_primary)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/slot_creator.py", line 149, in create_slot_with_initializer
dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/slot_creator.py", line 66, in _create_slot_var
validate_shape=validate_shape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 1049, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 948, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 356, in get_variable
validate_shape=validate_shape, use_resource=use_resource)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 341, in _true_getter
use_resource=use_resource)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 671, in _get_single_variable
"VarScope?" % name)
ValueError: Variable d_conv2/d_conv2_1/moments/normalize/mean/ExponentialMovingAverage/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?