pix2pix icon indicating copy to clipboard operation
pix2pix copied to clipboard

How can i see the values, tf.log(predict_real + EPS) and tf.log(1 - predict_fake + EPS) ??

Open kycocotree opened this issue 6 years ago • 1 comments

I want see the values while training, tf.log(predict_real + EPS) and tf.log(1 - predict_fake + EPS). so, i'm add the code(#add code) in the main.

           if should(a.progress_freq):
                fetches["discrim_loss"] = model.discrim_loss
                fetches["gen_loss_GAN"] = model.gen_loss_GAN
                fetches["gen_loss_L1"] = model.gen_loss_L1
                fetches["predict_real"] = tf.log(model.predict_real + EPS)    #add code
                fetches["predict_fake"] = tf.log(1 - model.predict_fake + EPS)  #add code

            if should(a.progress_freq):
                # global_step will have the correct step count if we resume from a checkpoint
                train_epoch = math.ceil(results["global_step"] / examples.steps_per_epoch)
                train_step = (results["global_step"] - 1) % examples.steps_per_epoch + 1
                rate = (step + 1) * a.batch_size / (time.time() - start)
                remaining = (max_steps - step) * a.batch_size / rate
                print("progress  epoch %d  step %d  image/sec %0.1f  remaining %dm" % (train_epoch, train_step, rate, remaining / 60))
                print("discrim_loss", results["discrim_loss"])
                print("gen_loss_GAN", results["gen_loss_GAN"])
                print("gen_loss_L1", results["gen_loss_L1"])

                print("predict_real", results["predict_real"])      #add code
                print("predict_fake", results["predict_fake"])     #add code

but, this code is error...

Traceback (most recent call last): File "pix2pix.py", line 809, in main() File "pix2pix.py", line 763, in main fetches["predict_real"] = tf.log(model.predict_real + EPS) #add code File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\math_ops.py", line 850, in binary_op_wrapper y = ops.convert_to_tensor(y, dtype=x.dtype.base_dtype, name="y") File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1011, in convert_to_tensor as_ref=False) File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1107, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\constant_op.py", line 217, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\constant_op.py", line 202, in constant name=name).outputs[0] File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 3386, in create_op self._check_not_finalized() File "C:\Users\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 3024, in _check_not_finalized raise RuntimeError("Graph is finalized and cannot be modified.") RuntimeError: Graph is finalized and cannot be modified.

How can i see the values ???

kycocotree avatar Nov 04 '18 09:11 kycocotree

You posted it to the wrong repo.

junyanz avatar Nov 05 '18 08:11 junyanz