當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。