kshmelkov / gan_evaluation

Code release for paper "How good is my GAN?"
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

error in train_all_classifiers #1

Open RanaElnaggar opened 5 years ago

RanaElnaggar commented 5 years ago

Hi I am trying to run the code and when I run python classifier.py --run_name=cifar10_classifier_ms_decay --dataset=cifar10 --image_size=32 I get InvalidArgumentError (see above for traceback): Default AvgPoolingOp only supports NHWC on device type CPU [[node resnet/average_pooling2d/AvgPool (defined at /gan_evaluation-master/resnet_tf_models.py:373) ]]

I also get the same error when I run train_all_classifiers python gan.py --action=train_gan,generate,train_all_classifiers --dataset=cifar10 --run_name=sngan --sum_pooling --gen_depth=256 --gen_linear_dim=1024 --gan_loss=hinge --spectral_normalization --conditional_bn --projection --acgan_dw=0 --acgan_gw=0 --gradient_penalty=0 --learning_rate=2e-4 --adam_beta1=0.0 --adam_beta2=0.9 --num_discriminator_steps=5 --arch=resnet --lr_decay --bn_decay=0.9 --batch_size=64

I am running the code on a cpu, Can you help me solve this issue ?

Best Regards Rana

RanaElnaggar commented 5 years ago

Hi

I bypassed this error by changing data_form to channels_last, so classifier.py finished successfully

However, I am stuck in python gan.py --action=train_gan,generate,train_all_classifiers --dataset=cifar10 --run_name=sngan --sum_pooling --gen_depth=256 --gen_linear_dim=1024 --gan_loss=hinge --spectral_normalization --conditional_bn --projection --acgan_dw=0 --acgan_gw=0 --gradient_penalty=0 --learning_rate=2e-4 --adam_beta1=0.0 --adam_beta2=0.9 --num_discriminator_steps=5 --arch=resnet --lr_decay --bn_decay=0.9 --batch_size=64

I get FailedPreconditionError (see above for traceback): Attempting to use uninitialized value resnet/dense/bias [[node resnet/dense/bias/read (defined at gan_evaluation-master/resnet_tf_models.py:379) ]]

Can you help me help this issue ?

Best Regards, Rana

RanaElnaggar commented 5 years ago

Hi

I solved this issue by adding in evaluate_classifier the following: clean_init_op = tf.group(tf.global_variables_initializer(), local_init_op)

and inside with tf.Session

I added sess.run(local_init_op)

I also added in resnet_tf_models.py with tf.Session() as sess: sess.run(tf.global_variables_initializer()) sess.run(tf.tables_initializer())

It now calculates GAN-train and GAN-test on dcgan

I just tried with 2 iteration to ensure that it does not give an error, I was wondering how long did it take to train dcgan, wgangp, and sngan and get the GAN-train, GAN-test and IS score

IS score took more than 2 hours on a CPU, So, I would like to get an estimate of the time.

Best Regards Rana