Tensorflow 1.0之后模型文件、权重数值的读取方式
作者:地大大刘 时间:2022-01-09 21:33:18
保存的文件有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')
来源:https://blog.csdn.net/liujianlin01/article/details/80426348
标签:Tensorflow,权重,数值
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python中and和or逻辑运算符的用法示例
2022-10-13 03:31:18
![](https://img.aspxhome.com/file/2023/0/83890_0s.jpg)
用Python获取摄像头并实时控制人脸的实现示例
2022-12-11 09:50:21
Python 可迭代对象 iterable的具体使用
2021-08-28 08:24:32
实现有批量删除功能的ASP留言板
2007-10-31 07:27:00
python 两个一样的字符串用==结果为false问题的解决
2023-01-24 08:30:59
Python 京东云无线宝消息推送功能
2021-08-19 09:45:57
Python爬取腾讯视频评论的思路详解
2021-05-30 23:04:43
![](https://img.aspxhome.com/file/2023/2/70732_0s.jpg)
Pycharm学习教程(1) 定制外观
2021-08-01 05:18:11
![](https://img.aspxhome.com/file/2023/4/77584_0s.jpg)
Oracle 子程序参数模式,IN,OUT,NOCOPY
2009-10-23 18:08:00
Python编写可视化界面的全过程(Python+PyCharm+PyQt)
2022-02-23 02:21:36
![](https://img.aspxhome.com/file/2023/1/75261_0s.jpg)
在SQL Server 2005数据库中更改数据架构
2009-01-19 13:06:00
php通过隐藏表单控件获取到前两个页面的url
2023-11-16 04:00:08
![](https://img.aspxhome.com/file/2023/5/102105_0s.gif)
python人工智能tensorflow常见损失函数LOSS汇总
2023-11-22 18:12:48
![](https://img.aspxhome.com/file/2023/7/64277_0s.png)
python中input()的用法及扩展
2021-07-05 08:45:57
![](https://img.aspxhome.com/file/2023/2/87592_0s.png)
MySQL表设计优化与索引 (八)
2010-10-25 19:46:00
Python中的左斜杠、右斜杠(正斜杠和反斜杠)
2022-02-08 07:00:34
PHP substr()函数参数解释及用法讲解
2023-11-24 11:47:56
python基础之reverse和reversed函数的介绍及使用
2022-10-19 19:12:18
python Matplotlib绘图直线,折线,曲线
2023-01-12 13:44:09
![](https://img.aspxhome.com/file/2023/3/79433_0s.png)
漂亮的title提示信息
2008-08-12 12:51:00