image_generator icon indicating copy to clipboard operation
image_generator copied to clipboard

Issue with running notebook

Open sam2332 opened this issue 5 years ago • 2 comments

When running the application with a good dataset I get the following errors.

ValueError: Trying to share variable discriminator/conv1/kernel, but specified shape (5, 5, 3, 64) and found shape (5, 5, 4, 64).

` ValueError Traceback (most recent call last) in 9 10 with tf.Graph().as_default(): ---> 11 train(get_batches(input_images), input_images.shape)

in train(get_batches, data_shape, checkpoint_to_load) 1 def train(get_batches, data_shape, checkpoint_to_load=None): 2 input_images, input_z, lr_G, lr_D = model_inputs(data_shape[1:], NOISE_SIZE) ----> 3 d_loss, g_loss = model_loss(input_images, input_z, data_shape[3]) 4 d_opt, g_opt = model_optimizers(d_loss, g_loss) 5

in model_loss(input_real, input_z, output_channel_dim) 8 9 d_model_real, d_logits_real = discriminator(noisy_input_real, reuse=False) ---> 10 d_model_fake, d_logits_fake = discriminator(g_model, reuse=True) 11 12 d_loss_real = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_real,

in discriminator(x, reuse) 9 padding="SAME", 10 kernel_initializer=tf.truncated_normal_initializer(stddev=WEIGHT_INIT_STDDEV), ---> 11 name='conv1') 12 batch_norm1 = tf.layers.batch_normalization(conv1, 13 training=True, `

WARNING: Logging before flag parsing goes to stderr. W0827 08:43:17.895732 14504 deprecation.py:323] From <ipython-input-2-6a171d8d9e59>:5: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.dense instead. W0827 08:43:17.899729 14504 deprecation.py:506] From c:\users\srudloff\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\ops\init_ops.py:1251: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor W0827 08:43:18.230528 14504 deprecation.py:323] From <ipython-input-2-6a171d8d9e59>:16: conv2d_transpose (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version. Instructions for updating: Use tf.keras.layers.Conv2DTransposeinstead. W0827 08:43:18.795181 14504 deprecation.py:323] From <ipython-input-2-6a171d8d9e59>:20: batch_normalization (from tensorflow.python.layers.normalization) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.BatchNormalization instead. In particular,tf.control_dependencies(tf.GraphKeys.UPDATE_OPS)should not be used (consult thetf.keras.layers.batch_normalizationdocumentation). W0827 08:43:19.111992 14504 deprecation.py:323] From <ipython-input-3-5b9e48b97d85>:11: conv2d (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version. Instructions for updating: Usetf.keras.layers.Conv2D instead.

sam2332 avatar Aug 27 '19 12:08 sam2332

I've just run into the exact same issue.

As a side note, I had to manually downgrade my TensorFlow from v2 to v1 using: import tensorflow.compat.v1 as tf tf.disable_v2_behavior()

markhanslip avatar Apr 07 '20 13:04 markhanslip

How can I deal with this problem?

WARNING:tensorflow:From :5: dense (from tensorflow.python.keras.legacy_tf_layers.core) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.Dense instead. WARNING:tensorflow:From C:\Users\Admin\anaconda3\lib\site-packages\tensorflow\python\keras\legacy_tf_layers\core.py:187: Layer.apply (from tensorflow.python.keras.engine.base_layer_v1) is deprecated and will be removed in a future version. Instructions for updating: Please use layer.__call__ method instead. WARNING:tensorflow:From :16: conv2d_transpose (from tensorflow.python.keras.legacy_tf_layers.convolutional) is deprecated and will be removed in a future version. Instructions for updating: Use tf.keras.layers.Conv2DTranspose instead. WARNING:tensorflow:From :20: batch_normalization (from tensorflow.python.keras.legacy_tf_layers.normalization) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.BatchNormalization instead. In particular, tf.control_dependencies(tf.GraphKeys.UPDATE_OPS) should not be used (consult the tf.keras.layers.BatchNormalization documentation). WARNING:tensorflow:From :11: conv2d (from tensorflow.python.keras.legacy_tf_layers.convolutional) is deprecated and will be removed in a future version. Instructions for updating: Use tf.keras.layers.Conv2D instead.

NaChuaN666 avatar Aug 09 '20 01:08 NaChuaN666