ZZUTK / Face-Aging-CAAE

Age Progression/Regression by Conditional Adversarial Autoencoder
636 stars 233 forks source link

Update to tensorflow 1.4 #20

Open chinmaygghag opened 7 years ago

chinmaygghag commented 7 years ago

Can this code be updated according to tensorflow 1.4?

mkj676 commented 6 years ago

Yes, You change this section

  1. tf.concat (ops.py)
  2. tf.sigmoid_~~~~(Face-Aging.py)
  3. In Tensorflow library, variable_scope.py -> def get_variable()'s parameter reuse = None -> reuse = AUTO_REUSE
AidasK commented 6 years ago

@mkj676 I have stuck with 3rd step. How can I set "reuse = AUTO_REUSE"? My current error is "ValueError: Variable E_conv0/w/Adam/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?"

AidasK commented 6 years ago

Managed to make it work by setting with tf.variable_scope('', reuse=tf.AUTO_REUSE): on line 222 of Face-Aging.py So it looks like this:

with tf.variable_scope('', reuse=tf.AUTO_REUSE):
            # optimizer for encoder + generator
            self.EG_optimizer = tf.train.AdamOptimizer(
                learning_rate=EG_learning_rate,
                beta1=beta1
            ).minimize(
                loss=self.loss_EG,
                global_step=self.EG_global_step,
                var_list=self.E_variables + self.G_variables
            )

            # optimizer for discriminator on z
            self.D_z_optimizer = tf.train.AdamOptimizer(
                learning_rate=EG_learning_rate,
                beta1=beta1
            ).minimize(
                loss=self.loss_Dz,
                var_list=self.D_z_variables
            )

            # optimizer for discriminator on image
            self.D_img_optimizer = tf.train.AdamOptimizer(
                learning_rate=EG_learning_rate,
                beta1=beta1
            ).minimize(
                loss=self.loss_Di,
                var_list=self.D_img_variables
            )
mkj676 commented 6 years ago

@AidasK No, you have to change this code ex) For me, /home/flask/lib/python2.7/site-packages/tensorflow/python/ops

ps. flask means virtualenv

praveenkumarchandaliya commented 6 years ago

Problem no 1 and 2 is not clear. where we change or which file we required to changes?