当前位置: 首页>>代码示例>>Python>>正文


Python inception_utils.inception_arg_scope方法代码示例

本文整理汇总了Python中nets.inception_utils.inception_arg_scope方法的典型用法代码示例。如果您正苦于以下问题:Python inception_utils.inception_arg_scope方法的具体用法?Python inception_utils.inception_arg_scope怎么用?Python inception_utils.inception_arg_scope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nets.inception_utils的用法示例。


在下文中一共展示了inception_utils.inception_arg_scope方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: endpoints

# 需要导入模块: from nets import inception_utils [as 别名]
# 或者: from nets.inception_utils import inception_arg_scope [as 别名]
def endpoints(image, is_training):
    if image.get_shape().ndims != 4:
        raise ValueError('Input must be of size [batch, height, width, 3]')

    image = image - tf.constant(_RGB_MEAN, dtype=tf.float32, shape=(1,1,1,3))

    with tf.contrib.slim.arg_scope(inception_arg_scope(batch_norm_decay=0.9, weight_decay=0.0002)):
        _, endpoints = inception_v4(image, num_classes=None, is_training=is_training)

    print('endpoints: {}'.format(endpoints))
    endpoints['model_output'] = endpoints['global_pool'] = tf.reduce_mean(
        endpoints['Mixed_7d'], [1, 2], name='pool5', keep_dims=False)

    return endpoints, 'InceptionV4' 
开发者ID:knwng,项目名称:vehicle-triplet-reid,代码行数:16,代码来源:inception.py

示例2: model

# 需要导入模块: from nets import inception_utils [as 别名]
# 或者: from nets.inception_utils import inception_arg_scope [as 别名]
def model(images, weight_decay=1e-5, is_training=True):
    images = mean_image_subtraction(images)
    with slim.arg_scope(inception_arg_scope(weight_decay=weight_decay)):
        logits, end_points = inception_resnet_v2(images, num_classes=None, is_training=is_training)
    for key in end_points.keys():
        print(key, end_points[key])
    return logits, end_points
    # print(end_points.keys())
    # with tf.variable_scope('feature_fusion', values=[end_points.values()]):
    #     batch_norm_params = {
    #         'decay': 0.997,
    #         'epsilon': 1e-5,
    #         'scale': True,
    #         'is_training': is_training
    #     }
    #     with slim.arg_scope([slim.conv2d], activation_fn=tf.nn.relu, normalizer_fn=slim.batch_norm,
    #                         normalizer_params=batch_norm_params, weights_regularizer=slim.l2_regularizer(weight_decay)):
    #         f = [end_points['Scale-5'],     # 16
    #              end_points['Scale-4'],  # 32
    #              end_points['Scale-3'],  # 64
    #              end_points['Scale-2'],     # 128
    #              end_points['Scale-1']]     # 256
    #         g = [None, None, None, None, None]
    #         h = [None, None, None, None, None]
    #         num_outputs = [None, 1024, 128, 64, 32]
    #         for i in range(5):
    #             if i == 0:
    #                 h[i] = f[i]
    #             else:
    #                 # 相当于一个融合,减少维度的过程,kernel size等于1
    #                 c1_1 = slim.conv2d(tf.concat([g[i-1], f[i]], axis=-1), num_outputs=num_outputs[i], kernel_size=1)
    #                 h[i] = slim.conv2d(c1_1, num_outputs=num_outputs[i], kernel_size=3)
    #             if i <= 3:
    #                 g[i] = unpool(h[i])
    #                 # g[i] = slim.conv2d(g[i], num_outputs[i + 1], 1)
    #                 # g[i] = slim.conv2d(g[i], num_outputs[i + 1], 3)
    #             else:
    #                 g[i] = slim.conv2d(h[i], num_outputs[i], 3)
    #             print("Shape of f_{} {}, h_{} {}, g_{} {}".format(i, f[i].shape, i, h[i].shape, i, g[i].shape))
    #         F_score = slim.conv2d(g[3], 1, 1, activation_fn=tf.nn.sigmoid, normalizer_fn=None)
    #         if FLAGS.geometry == 'RBOX':
    #             # 4 channel of axis aligned bbox and 1 channel rotation angle
    #             print 'RBOX'
    #             geo_map = slim.conv2d(g[4], 4, 1, activation_fn=tf.nn.sigmoid, normalizer_fn=None) * FLAGS.text_scale
    #             angle_map = (slim.conv2d(g[4], 1, 1, activation_fn=tf.nn.sigmoid,
    #                                      normalizer_fn=None) - 0.5) * np.pi / 2  # angle is between [-45, 45]
    #             F_geometry = tf.concat([geo_map, angle_map], axis=-1)
    #         else:
    #             # LD modify
    #             # concated_score_map = tf.concat([F_score, g[3]], axis=-1)
    #             # F_geometry = slim.conv2d(g[4], 8, 1, activation_fn=parametric_relu,
    #             #                          normalizer_fn=None) * FLAGS.text_scale
    #             assert False
    #     return F_score, F_geometry 
开发者ID:UpCoder,项目名称:ICPR_TextDection,代码行数:56,代码来源:model.py


注:本文中的nets.inception_utils.inception_arg_scope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。