• 大小: 1KB
    文件类型: .py
    金币: 2
    下载: 1 次
    发布日期: 2021-06-09
  • 语言: Python
  • 标签: tensorflow  pb  inference  

资源简介

tensorflow训练网络模型 ,生成用于模型预测的pb模型文件,输入图片,进行前向预测

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
“““
Created on Wed Oct 24 17:54:28 2018

@author: DELL
“““

import tensorflow as tf
import numpy as np
lookup=dict()
with open(“dict.txt“ “r“) as f:
    for line in f:
        split=line.split()
        lookup[int(split[0])]=split[1]

with tf.Session() as sess:
    with open(‘classify_image_graph_def.pb‘ ‘rb‘) as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read()) 
 #       print(graph_def)
#        file=open(‘Output_nod.txt‘‘w‘)  
 #       file.write(str(graph_def));
        softmax_tensor = tf.get_defau

评论

共有 条评论