tensorflow model几种模型文件

转载:https://blog.eson.org/pub/3da24a26/

 

模型文件相关

  • checkpoint (.ckpt):
    • variable的序列化存储,常用于保存和还原模型参数。保存方式是变量name—>value的映射
    • 缺陷:序列化内容与创建的代码相关,因此在跨语言时通常不采用这种格式
  • SavedModel: 同时包含variablegraph、graph’s metadata
    • Checkpoints is a format dependent on the code that created the model(是指和模型版本相关吗?还是语言种类?). 不包含graph
    • SavedModel is a format independent of the code that created the model. 包含graph
  • meta graph:
    • 类: MetaGraphDef ,包含MetaInfoDefGraphDefSaverDefCollectionDef
    • 序列化存储格式: protobuf, .meta文件
    • 示例
  • GraphDef (.pb)
    • Graph对象的protobuf保存形式为GraphDef对象
    • 示例
  • frozen graph:
    • freeze_graph.py的操作: 将 GraphDef 中所有 Variable 节点转换为常量。
      FrozenGraphDef:
      graph和variable分别存储在不同的文件,通常不利于部署到产品。
      tensorflow提供freeze_graph.py脚本将graph定义和checkpoint中的变量打包到一个文件。
    • 序列化存储格式: protobuf, 文件
      • 示例
  • TensorFlow Lite model (.tflite): 轻量级模型格式 *.lite,和 FrozenGraphDef 十分类似

部署在线服务(Serving)时官方推荐使用 SavedModel 格式,而部署到手机等移动端的模型一般使用 FrozenGraphDef 格式

你可能感兴趣的:(tensorflow)