1 Star 0 Fork 0

AlimTech/tensorflow-yolov3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
freeze_graph.py 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
YunYang1994 提交于 2019-05-14 11:53 . I hate tensorflow
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : freeze_graph.py
# Author : YunYang1994
# Created date: 2019-03-20 15:57:33
# Description :
#
#================================================================
import tensorflow as tf
from core.yolov3 import YOLOV3
pb_file = "./yolov3_coco.pb"
ckpt_file = "./checkpoint/yolov3_coco_demo.ckpt"
output_node_names = ["input/input_data", "pred_sbbox/concat_2", "pred_mbbox/concat_2", "pred_lbbox/concat_2"]
with tf.name_scope('input'):
input_data = tf.placeholder(dtype=tf.float32, name='input_data')
model = YOLOV3(input_data, trainable=False)
print(model.conv_sbbox, model.conv_mbbox, model.conv_lbbox)
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
saver = tf.train.Saver()
saver.restore(sess, ckpt_file)
converted_graph_def = tf.graph_util.convert_variables_to_constants(sess,
input_graph_def = sess.graph.as_graph_def(),
output_node_names = output_node_names)
with tf.gfile.GFile(pb_file, "wb") as f:
f.write(converted_graph_def.SerializeToString())
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alimtech/tensorflow-yolov3.git
git@gitee.com:alimtech/tensorflow-yolov3.git
alimtech
tensorflow-yolov3
tensorflow-yolov3
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385