我想创建一个单独的完整连接层来处理卷积运算的结果,我的代码是:
def logit(inputs, is_training=True, dropout_keep_prob=0.8, bottleneck_layer_size=128, reuse=None, scope='logit_alexnet_rt'):
#end_points_l = {}
with tf.variable_scope(scope, 'logit_alexnet_rt', [inputs], reuse=reuse):
with slim.arg_scope([slim.batch_norm, slim.dropout], is_training=is_training):
with slim.arg_scope([slim.conv2d, slim.max_pool2d, slim.avg_pool2d], stride=1, padding='SAME'):
net = inputs
#end_points_l['PrePool'] = net
net = slim.avg_pool2d(net, net.get_shape()[1:3], padding='VALID', scope='avg_pool2d')
net = slim.flatten(net)
net = slim.dropout(net, dropout_keep_prob, is_training=True, scope='dropout')
#end_points_l['PreLogitsFlatten'] = net
net = slim.fully_connected(net, 128, activation_fn=None, scope='bottleneck', reuse=None)
return net#end_points_l
但是它有一些问题:ValueError: Variable triplet_loss/logit_alexnet_rt/bottleneck/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?