Tensorflow GAN估计器在评估时挂起



我以Tensorflow Estimator格式实现GAN。以下是完整的概要代码。

模型可以正常训练。然而,它似乎永远挂在model.evaluate上。培训后的日志如下。

INFO:tensorflow:Starting evaluation at 2018-12-03-02:19:06
INFO:tensorflow:Graph was finalized.
2018-12-03 02:19:06.956750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2018-12-03 02:19:06.956781: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-12-03 02:19:06.956786: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2018-12-03 02:19:06.956790: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2018-12-03 02:19:06.956912: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10464 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
INFO:tensorflow:Restoring parameters from /tensorlog/wad/acgan/a51fbd6/model.ckpt-10002
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.

如果我使用tf.estimator.train_and_evaluate,评估的准确度将始终为0.5。

我已经检查了我的tfrecords文件,它不是空的,可以毫无问题地读取图像和标签。我还尝试使用相同的tfrecords文件进行训练和评估,但仍然得到了相同的结果。

在我看来,tensorflow模型可能在从检查点加载GAN的权重时遇到问题。如果这是真的,如何解决这个问题?

原来是因为dropoutbatch_normalization中的training参数阻止了权重的恢复。修正训练的价值,以解决问题。

最新更新