taki0112 / Densenet-Tensorflow

Simple Tensorflow implementation of Densenet using Cifar10, MNIST
MIT License
506 stars 196 forks source link

Model compilation failing with ValueError: Variable dense_1_bottleN_0_batch1/beta already exists, disallowed #24

Open amitkayal opened 5 years ago

amitkayal commented 5 years ago

======Loading data====== DataSet aready exist! Loading ./cifar-10-batches-py/data_batch_1 : 10000. Loading ./cifar-10-batches-py/data_batch_2 : 10000. Loading ./cifar-10-batches-py/data_batch_3 : 10000. Loading ./cifar-10-batches-py/data_batch_4 : 10000. Loading ./cifar-10-batches-py/data_batch_5 : 10000. Loading ./cifar-10-batches-py/test_batch : 10000. Train data: (50000, 32, 32, 3) (50000, 10) Test data : (10000, 32, 32, 3) (10000, 10) ======Load finished====== ======Shuffling data====== ======Prepare Finished======

ValueError Traceback (most recent call last)

in () 207 learning_rate = tf.placeholder(tf.float32, name='learning_rate') 208 --> 209 model = DenseNet(x=x, nb_blocks=nb_block, filters=growth_k, training=training_flag) 210 211 # logits = DenseNet(x=x, nb_blocks=nb_block, filters=growth_k, training=training_flag).model 20 frames /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variable_scope.py in _get_single_variable(self, name, shape, dtype, initializer, regularizer, partition_info, reuse, trainable, collections, caching_device, validate_shape, use_resource, constraint, synchronization, aggregation) 862 tb = [x for x in tb if "tensorflow/python" not in x[0]][:5] 863 raise ValueError("%s Originally defined at:\n\n%s" % --> 864 (err_msg, "".join(traceback.format_list(tb)))) 865 found_var = self._vars[name] 866 if not shape.is_compatible_with(found_var.get_shape()): ValueError: Variable dense_1_bottleN_0_batch1/beta already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at: File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 283, in variable aggregation=aggregation) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args return func(*args, **current_args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 355, in model_variable aggregation=aggregation) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args return func(*args, **current_args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 315, in _fused_batch_norm trainable=trainable)
murderH commented 5 years ago

I also have the problem when I run the code on colaboratory, but it has no problem on pycharm.Can someone help me solve this? Thank you.