sess = K.get_session()
resnetBuilder = ResnetBuilder()
fc,att,模型= resnetBuilder.ResNet101('resnet101.h5',img.shape)
数组= sess.run(att)
=============================
错误:
ResNet101中的文件“ /Users/workspace/misc/resnet_keras.py”,第456行
x = identity_block(x,3,[512,512,2048],stage = 5,block ='c')
在identity_block中,文件“ /Users/heshuguo/workspace/misc/resnet_keras.py”第229行
x =比例尺(axis = bn_axis,name = scale_name_base +'2c')(x)
在调用
中的文件“ /usr/local/lib/python2.7/site-packages/keras/engine/topology.py”,第576行
self.build(input_shapes [0])
在版本
中,文件“ /Users/workspace/misc/resnet_keras.py”,第333行
self.beta = K.variable(self.beta_init(shape),name ='%s_beta'%self.name)
文件“ /usr/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py”,行380,在变量中
v = tf.Variable(value,dtype = tf.as_dtype(dtype),name = name)
init 中的文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py”,第259行
约束=约束)
_init_from_args中的文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py”,第422行
self._snapshot = array_ops.identity(self._variable,name =“ read”)
标识为“ /usr/local/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py”的第80行,
返回gen_array_ops.identity(input,name = name)
文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py”,行3264,标识为
“身份”,输入=输入,名称=名称)
_apply_op_helper中的文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py”,行787
op_def = op_def)
文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py”,行454,在new_func中
return func(* args,** kwargs)
在create_op中,文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py”,行3155
op_def = op_def)
init
中的文件“ /usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py”,第1717行
self._traceback = tf_stack.extract_stack()
FailedPreconditionError(请参阅上面的回溯):尝试使用未初始化的值scale5c_branch2c / scale5c_branch2c_beta
[[节点:scale5c_branch2c / scale5c_branch2c_beta / read = IdentityT = DT_FLOAT,_device =“ / job:localhost /副本:0 / task:0 / device:CPU:0”]]
========================================
如何解决该问题?