我以Tensorflow Estimator格式实现GAN . 这是gist中的完整代码 .
该模型可以正常训练 . 但是,它似乎永远挂在 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文件进行训练和评估,但仍然得到相同的结果 .
在我看来,张量流模型可能有问题从检查点加载GAN的权重 . 如果这是真的,如何解决这个问题?
1 回答
结果是因为
dropout
和batch_normalization
中的training
参数阻止了权重的恢复 . 将训练值修正为true或false解决问题 .