【发布时间】:2021-10-05 05:19:56
【问题描述】:
需要帮助解决问题'AttributeError: 'function' object has no attribute 'summary'。
def model(inputs):
batch_size,height,width=config.BATCH_SIZE,config.IMAGE_SHAPE[0],config.IMAGE_SHAPE[1]
with slim.arg_scope(resnet_v2.resnet_arg_scope()):
#net, end_points = resnet_v2.resnet_v2_101(inputs, 1001, is_training=False)
net, end_points = resnet_v2.resnet_v2_152(inputs,
2048,
is_training=True,
global_pool=False,
reuse=tf.AUTO_REUSE,
output_stride=config.OUTPUT_STRIDE)
#print(net)
kp_maps = tf.contrib.layers.conv2d(net,num_outputs = config.NUM_KP,
kernel_size=(1,1),activation_fn=tf.nn.sigmoid,stride=1,scope='kp_maps',reuse=tf.AUTO_REUSE)
short_offsets = tf.contrib.layers.conv2d(net,num_outputs = 2*config.NUM_KP,
kernel_size=(1,1),activation_fn=None,stride=1,scope='short_offsets',reuse=tf.AUTO_REUSE)
mid_offsets = tf.contrib.layers.conv2d(net,num_outputs = 4*config.NUM_EDGES,
kernel_size=(1,1),activation_fn=None,stride=1,scope='mid_offsets',reuse=tf.AUTO_REUSE)
long_offsets = tf.contrib.layers.conv2d(net,num_outputs = 2*config.NUM_KP,
kernel_size=(1,1),activation_fn=None,stride=1,scope='long_offsets',reuse=tf.AUTO_REUSE)
seg_mask = tf.contrib.layers.conv2d(net,num_outputs = 1,
kernel_size=(1,1),activation_fn=tf.nn.sigmoid,stride=1,scope='seg_mask',reuse=tf.AUTO_REUSE)
model.summary()
我正在尝试打印模型的摘要
【问题讨论】:
-
你能告诉我们错误吗?
-
model既是函数名又是变量名?你有model.summary,但我不知道model是在哪里定义的。 -
您似乎没有使用 Keras,您无法真正使用 model.summary(),因为您没有在此代码中构建 Keras 模型。
标签: python tensorflow keras