level 1
Galois域
楼主
我下载了一些resnet_v2的模型,文件后缀名是ckpt,里面包含了网络和weight都全了。
请问如何加载?
#!/usr/bin/env python3
import tensorflow as tf
from tensorflow.python.platform import gfile
import numpy as np
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '2' #use GPU with ID=0
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.7 # maximun alloc gpu20% of MEM
config.gpu_options.allow_growth = True #allocate dynamically
x = tf.placeholder(tf.float32, shape=(224,224));
with tf.Session(config = config) as sess:
path_ckpt = "resnet_v2_50.ckpt"
output_graph_def = tf.GraphDef()
with gfile.FastGFile(path_ckpt, "rb") as f
#这里就是显示RuntimeWarning: Unexpected end-group tag: Not all data was converted
output_graph_def.ParseFromString(f.read())
_ = tf.import_graph_def(output_graph_def, name="")
for i,n in enumerate(output_graph_def.node):
print("Name of the node - %s" % n.name)
以上代码还是没有加载进来。多谢赐教
2019年04月12日 02点04分
1
请问如何加载?
#!/usr/bin/env python3
import tensorflow as tf
from tensorflow.python.platform import gfile
import numpy as np
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '2' #use GPU with ID=0
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.7 # maximun alloc gpu20% of MEM
config.gpu_options.allow_growth = True #allocate dynamically
x = tf.placeholder(tf.float32, shape=(224,224));
with tf.Session(config = config) as sess:
path_ckpt = "resnet_v2_50.ckpt"
output_graph_def = tf.GraphDef()
with gfile.FastGFile(path_ckpt, "rb") as f
#这里就是显示RuntimeWarning: Unexpected end-group tag: Not all data was converted
output_graph_def.ParseFromString(f.read())
_ = tf.import_graph_def(output_graph_def, name="")
for i,n in enumerate(output_graph_def.node):
print("Name of the node - %s" % n.name)
以上代码还是没有加载进来。多谢赐教