当前位置:网站首页>深度学习源码项目里的checkpoint
深度学习源码项目里的checkpoint
2022-07-21 05:04:00 【Jumbo星】
这几天刚入门跑别人论文的项目(TDD-net)。对项目里的checkpoint比较好奇,于是上网搜寻了相关资料。
机器学习里面保存的模型checkpoint文件里面到底是什么东东? - 知乎
简单地说,在使用tensorflow跑模型的时候,我们不可能一次跑完,中间要保存一下的(就像写文章中间要保存下草稿)。因此checkpoint其实就是保存下来的中间模型。
保存了TensorFlow 模型之后,我们会得到如下图所示的4个文件:
checkpoint中包含了需要加载模型的目录,需要根据实际地址修改一下。
“.ckpt.meta”是一个protocol buffer,用于保存完整的Tensorflow图/完整的神经网络结构图; 即所有变量,操作,集合等。也就是你能在tensorboard/graph中看见的内容。但是不包含变量的值,也就是说TensorFlow是把图结构和变量值分开储存的。
“.ckpt.data”保存了所有的变量的值/已训练好的变量参数/网络权重值,但是不包含结构。
“ ckpt.index”描述了variable中key和value的对应关系。
如果要在python中恢复一个模型,我们只需要使用同时用到meta和data文件:
with tf.Session() as sess:
saver = tf.train.import_meta_graph('/tmp/model.ckpt.meta')
saver.restore(sess, "/tmp/model.ckpt")
在这里,我们需要先导入.meta文件,再导入.data文件,否则模型不知道如何把checkpoint里面的值对应到变量上。
作者:风影忍着
链接:https://www.zhihu.com/question/265634425/answer/1784814150
来源:知乎
著作权归作者所有。
边栏推荐
- pytorch的安装
- Es aggregate statistical syntax
- RestHighLevelClient语法
- PyTorch的模型定义
- NIO之Channel详解
- 【PCB】电路板绘制笔记之生产文件整理及输出--画板笔记
- 【PCB】Altium Designer 中(Via过孔)(文本string)(走线Linear Dimension)等项目修改默认设置
- Judge whether there are duplicate values in the "string []" array, and use the HashSet feature to check
- Training and acquisition of Chinese wiki corpus
- Recursive and non recursive implementation of four traversals of binary trees
猜你喜欢
Exclusive locking of this profile failed. Another running VMware process may be using a profile.
Project of integrating SSM framework
Jenkins plug-in development - provide external access interface
枚举的例子
4.paddlepaddle之10行代码mnist手写数字识别
Starfish OS: create a new paradigm of the meta universe with reality as the link
【记录】Optisystem运行卡死,无法点击关闭、输入变量数值等问题解决方法
图的邻接表及其深度优先(DFS)、广度优先(BFS)遍历
合泰32-Onenet-WiFi模块-合泰单片机通过MQTT协议数据上云(二)
Adjacency table of graph and its depth first (DFS) and breadth first (BFS) traversal
随机推荐
Display method of front desk serial number
Cat and dog picture resources
Initializing libiomp5.dylib, but found libomp.dylib already initialized
AS7341光谱传感器测量色温color_temperature_学习笔记
【PCB】电路板绘制笔记之生产文件整理及输出--画板笔记
14. Can you tell the difference between process and thread
合泰HT32 & 淘晶驰TJC--T0串口屏学习笔记
NIO之Channel详解
Redis installation of Linux system
合泰32-Onenet-WiFi模块-合泰单片机通过MQTT协议数据上云(一)
【C语言】一些常用的字符串函数--学习笔记
Kingbase conversion time
快捷键、命令
mask rcnn 加载权重报错
原码、反码、补码 AND 逻辑运算“与或非”
Data type map, empty string, empty key value and other judgment methods are the most detailed in the whole network
Mac brew install MySQL installation steps
学习IO由浅入深
Exclusive locking of this profile failed. Another running VMware process may be using a profile.
Original code, inverse code, complement and logical operation "and or not"