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


Python resnet_v2.resnet_arg_scope方法代码示例

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


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

示例1: build_pretrained_graph

# 需要导入模块: from tensorflow.contrib.slim.python.slim.nets import resnet_v2 [as 别名]
# 或者: from tensorflow.contrib.slim.python.slim.nets.resnet_v2 import resnet_arg_scope [as 别名]
def build_pretrained_graph(
      self, images, resnet_layer, checkpoint, is_training, reuse=False):
    """See baseclass."""
    with slim.arg_scope(resnet_v2.resnet_arg_scope()):
      _, endpoints = resnet_v2.resnet_v2_50(
          images, is_training=is_training, reuse=reuse)
      resnet_layer = 'resnet_v2_50/block%d' % resnet_layer
      resnet_output = endpoints[resnet_layer]
      resnet_variables = slim.get_variables_to_restore()
      resnet_variables = [
          i for i in resnet_variables if 'global_step' not in i.name]
      if is_training and not reuse:
        init_saver = tf.train.Saver(resnet_variables)
        def init_fn(scaffold, sess):
          del scaffold
          init_saver.restore(sess, checkpoint)
      else:
        init_fn = None

      return resnet_output, resnet_variables, init_fn 
开发者ID:rky0930,项目名称:yolo_v2,代码行数:22,代码来源:model.py

示例2: encoder_resnet

# 需要导入模块: from tensorflow.contrib.slim.python.slim.nets import resnet_v2 [as 别名]
# 或者: from tensorflow.contrib.slim.python.slim.nets.resnet_v2 import resnet_arg_scope [as 别名]
def encoder_resnet(x, is_training=True, weight_decay=0.001, reuse=False):
    """
    Resnet v2-50
    Assumes input is [batch, height_in, width_in, channels]!!
    Input:
    - x: N x H x W x 3
    - weight_decay: float
    - reuse: bool->True if test

    Outputs:
    - cam: N x 3
    - Pose vector: N x 72
    - Shape vector: N x 10
    - variables: tf variables
    """
    from tensorflow.contrib.slim.python.slim.nets import resnet_v2
    with tf.name_scope('Encoder_resnet', values=[x]):
        with slim.arg_scope(
                resnet_v2.resnet_arg_scope(weight_decay=weight_decay)):
            net, end_points = resnet_v2.resnet_v2_50(
                x,
                num_classes=None,
                is_training=is_training,
                reuse=reuse,
                scope='resnet_v2_50')
            net = tf.squeeze(net, axis=[1, 2])
    variables_scope = 'resnet_v2_50'
    return net, variables_scope 
开发者ID:jasonyzhang,项目名称:phd,代码行数:30,代码来源:models.py

示例3: encoder_resnet

# 需要导入模块: from tensorflow.contrib.slim.python.slim.nets import resnet_v2 [as 别名]
# 或者: from tensorflow.contrib.slim.python.slim.nets.resnet_v2 import resnet_arg_scope [as 别名]
def encoder_resnet(x, is_training=True, weight_decay=0.001, reuse=False):
    """
    Resnet v2-50
    Assumes input is [batch, height_in, width_in, channels]!!
    Input:
    - x: N x H x W x 3
    - weight_decay: float
    - reuse: bool->True if test

    Outputs:
    - cam: N x 3
    - Pose vector: N x 72
    - Shape vector: N x 10
    - variables: tf variables
    """
    from tensorflow.contrib.slim.python.slim.nets import resnet_v2
    with tf.name_scope('Encoder_resnet', [x]):
        with slim.arg_scope(
                resnet_v2.resnet_arg_scope(weight_decay=weight_decay)):
            net, end_points = resnet_v2.resnet_v2_50(
                x,
                num_classes=None,
                is_training=is_training,
                reuse=reuse,
                scope='resnet_v2_50')
            net = tf.squeeze(net, axis=[1, 2])
    variables_scope = 'resnet_v2_50'
    return net, variables_scope 
开发者ID:akanazawa,项目名称:human_dynamics,代码行数:30,代码来源:models.py

示例4: Encoder_resnet

# 需要导入模块: from tensorflow.contrib.slim.python.slim.nets import resnet_v2 [as 别名]
# 或者: from tensorflow.contrib.slim.python.slim.nets.resnet_v2 import resnet_arg_scope [as 别名]
def Encoder_resnet(x, is_training=True, weight_decay=0.001, reuse=False):
    """
    Resnet v2-50
    Assumes input is [batch, height_in, width_in, channels]!!
    Input:
    - x: N x H x W x 3
    - weight_decay: float
    - reuse: bool->True if test

    Outputs:
    - cam: N x 3
    - Pose vector: N x 72
    - Shape vector: N x 10
    - variables: tf variables
    """
    from tensorflow.contrib.slim.python.slim.nets import resnet_v2
    with tf.name_scope("Encoder_resnet", [x]):
        with slim.arg_scope(
                resnet_v2.resnet_arg_scope(weight_decay=weight_decay)):
            net, end_points = resnet_v2.resnet_v2_50(
                x,
                num_classes=None,
                is_training=is_training,
                reuse=reuse,
                scope='resnet_v2_50')
            net = tf.squeeze(net, axis=[1, 2])
    variables = tf.contrib.framework.get_variables('resnet_v2_50')
    return net, variables 
开发者ID:akanazawa,项目名称:motion_reconstruction,代码行数:30,代码来源:models.py


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