Python 未为TensorFlow模型保存的某些变量

Python 未为TensorFlow模型保存的某些变量,python,tensorflow,Python,Tensorflow,我正在基于Github项目进行神经网络着色实验: 在colorize.py文件中,我在创建保护程序之前添加了以下代码: ckpt_reader = tf.train.NewCheckpointReader(saved_path) ckpt_vars = ckpt_reader.get_variable_to_shape_map() print (ckpt_vars) 当我执行colorize.py来恢复模型并为测试图像着色时,它会将存储的模型作为字典打印出来: {'generator/con

我正在基于Github项目进行神经网络着色实验:

在colorize.py文件中,我在创建保护程序之前添加了以下代码:

ckpt_reader = tf.train.NewCheckpointReader(saved_path)
ckpt_vars = ckpt_reader.get_variable_to_shape_map()
print (ckpt_vars)
当我执行colorize.py来恢复模型并为测试图像着色时,它会将存储的模型作为字典打印出来:

{'generator/conv8e/bias': [512], 'generator/conv8e/batch_normalization/scale': [512], 'generator/conv8e/batch_normalization/offset': [512], 'generator/conv8d/weights': [4, 4, 2, 64], 'generator/conv7e/weights': [4, 4, 512, 512], 'generator/conv7e/batch_normalization/scale': [512], 'generator/conv7e/batch_normalization/offset': [512], 'generator/conv7d/weights': [4, 4, 64, 128], 'generator/conv7d/bias': [64], 'generator/conv7d/batch_normalization/offset': [1], 'generator/conv4e/batch_normalization/scale': [512], 'generator/conv6e/batch_normalization/offset': [512], 'generator/conv6e/bias': [512], 'generator/conv6d/batch_normalization/offset': [1], 'generator/conv4e/bias': [512], 'generator/conv6e/weights': [4, 4, 512, 512], 'generator/conv5e/weights': [4, 4, 512, 512], 'generator/conv5d/weights': [4, 4, 256, 512], 'generator/conv5e/batch_normalization/scale': [512], 'generator/conv5d/batch_normalization/offset': [1], 'generator/conv6d/weights': [4, 4, 128, 256], 'generator/conv4e/weights': [4, 4, 256, 512], 'generator/conv7d/batch_normalization/scale': [1], 'generator/conv4e/batch_normalization/offset': [512], 'generator/conv5d/batch_normalization/scale': [1], 'generator/conv4d/batch_normalization/scale': [1], 'generator/conv3e/weights': [4, 4, 128, 256], 'generator/conv5e/bias': [512], 'generator/conv2e/batch_normalization/scale': [128], 'generator/conv4d/bias': [512], 'generator/conv3d/batch_normalization/offset': [1], 'generator/conv3e/bias': [256], 'generator/conv5d/bias': [256], 'generator/conv3d/weights': [4, 4, 512, 512], 'generator/conv4d/weights': [4, 4, 512, 512], 'generator/conv6d/bias': [128], 'generator/conv3d/batch_normalization/scale': [1], 'generator/conv3e/batch_normalization/offset': [256], 'generator/conv6d/batch_normalization/scale': [1], 'generator/conv5e/batch_normalization/offset': [512], 'generator/conv2e/batch_normalization/offset': [128], 'generator/conv2e/bias': [128], 'generator/conv1d/bias': [512], 'generator/conv2d/weights': [4, 4, 512, 512], 'generator/conv2d/batch_normalization/scale': [1], 'generator/conv3e/batch_normalization/scale': [256], 'generator/conv2e/weights': [4, 4, 64, 128], 'generator/conv7e/bias': [512], 'generator/conv6e/batch_normalization/scale': [512], 'generator/conv1d/batch_normalization/offset': [1], 'generator/conv8d/bias': [2], 'generator/conv1e/weights': [4, 4, 1, 64], 'generator/conv1d/weights': [4, 4, 512, 512], 'generator/conv3d/bias': [512], 'generator/conv1e/bias': [64], 'generator/conv1d/batch_normalization/scale': [1], 'generator/conv8e/weights': [4, 4, 512, 512], 'generator/conv4d/batch_normalization/offset': [1], 'generator/conv2d/bias': [512], 'generator/conv2d/batch_normalization/offset': [1]}
但在检查点文件中找不到以下变量:

W tensorflow/core/framework/op_kernel.cc:993] Not found: Key generator/conv4d/batch_normalization/generator/conv4d/batch_normalization/moments/normalize/variance/ExponentialMovingAverage not found in checkpoint
等等

存储的模型及其变量用于

因此,我的问题是模型将如何以及在何处存储一个名为:

generator/conv4d/batch_normalization/generator/conv4d/batch_normalization/movingaverage/movingame/normalize/variance/ExponentialMovingAverage

由于这个长名称变量没有正确存储,它可能会出错

多谢各位