Tensorflow 1.0之后模型文件、权重数值的读取方式
2020-03-11 16:35
375 查看
保存的文件有4个:
checkpoint
model-parameters.bin-46000.data-00000-of-00001
model-parameters.bin-46000.index
model-parameters.bin-46000.meta
读取代码:
from tensorflow.python import pywrap_tensorflow with tf.Graph().as_default(): with tf.Session() as sess: ckpt = tf.train.get_checkpoint_state('./checkpoint') if ckpt and ckpt.model_checkpoint_path: reader = pywrap_tensorflow.NewCheckpointReader('./checkpoint/model-parameters.bin-46000') all_variables = reader.get_variable_to_shape_map() w1 = reader.get_tensor("conv1/weight") print(w1.shape) print(w1) print(all_variables) else: print('No checkpoint file found')
以上这篇Tensorflow 1.0之后模型文件、权重数值的读取方式就是小编分享给大家的全部内容了,希望能给大家一个参考
您可能感兴趣的文章:
相关文章推荐
- Tensorflow读取并输出已保存模型的权重数值方式
- 将tensorflow模型打包成PB文件及PB文件读取方式
- 如何用Tensorflow训练模型成pb文件(一)——基于原始图片的读取
- TensorFLow 读取图片1:初探四种从文件读取的方式
- TensorFlow模型文件保存和读取
- [libexpat]_[XML处理]_[C/C++使用libexpat库以数据流(SAX模型)的方式读取(解析)大XML文件]
- TensorFlow学习Day3读取csv文件,动手写个logistic,softmax分类模型
- [libexpat]_[XML处理]_[C/C++使用libexpat库以数据流(SAX模型)的方式读取(解析)大XML文件]
- pytorch保存模型等相关参数,利用torch.save(),以及读取保存之后的文件
- TensorFlow模型文件保存和读取
- tensorflow数据集制作/文件队列读取方式
- 如何用Tensorflow训练模型成pb文件(二)——基于tfrecord的读取
- Tensorflow: 从checkpoint文件中读取tensor方式
- pytorch利用torch.save()保存模型及相关参数,以及读取保存之后的文件
- tensorflow通过模型文件,使用tensorboard查看其模型图Graph方式
- tensorflow预训练简单模型及权重文件复用初始化复杂模型
- python&C++ python读取tensorflow模型参数,写入txt文件,C++读取txt文件
- spirng boot 读取配置文件两种方式
- Spring-boot中读取config配置文件的两种方式
- java通过判断文本的编码方式再读取文件