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


Python resnet_utils.Block方法代码示例

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


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

示例1: resnet_v2_50

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v2_50(inputs,
                 num_classes=None,
                 global_pool=True,
                 output_stride=None,
                 reuse=None,
                 scope='resnet_v2_50'):
  """ResNet-50 model of [1]. See resnet_v2() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 3 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 5 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)]
  return resnet_v2(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:20,代码来源:resnet_v2.py

示例2: resnet_v2_101

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v2_101(inputs,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  reuse=None,
                  scope='resnet_v2_101'):
  """ResNet-101 model of [1]. See resnet_v2() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 3 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 22 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)]
  return resnet_v2(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:20,代码来源:resnet_v2.py

示例3: resnet_v2_152

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v2_152(inputs,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  reuse=None,
                  scope='resnet_v2_152'):
  """ResNet-152 model of [1]. See resnet_v2() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 7 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 35 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)]
  return resnet_v2(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:20,代码来源:resnet_v2.py

示例4: resnet_v2_200

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v2_200(inputs,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  reuse=None,
                  scope='resnet_v2_200'):
  """ResNet-200 model of [2]. See resnet_v2() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 23 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 35 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)]
  return resnet_v2(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:20,代码来源:resnet_v2.py

示例5: testEndPointsV2

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def testEndPointsV2(self):
    """Test the end points of a tiny v2 bottleneck network."""
    bottleneck = resnet_v2.bottleneck
    blocks = [resnet_utils.Block('block1', bottleneck, [(4, 1, 1), (4, 1, 2)]),
              resnet_utils.Block('block2', bottleneck, [(8, 2, 1), (8, 2, 1)])]
    inputs = create_test_input(2, 32, 16, 3)
    with slim.arg_scope(resnet_utils.resnet_arg_scope()):
      _, end_points = self._resnet_plain(inputs, blocks, scope='tiny')
    expected = [
        'tiny/block1/unit_1/bottleneck_v2/shortcut',
        'tiny/block1/unit_1/bottleneck_v2/conv1',
        'tiny/block1/unit_1/bottleneck_v2/conv2',
        'tiny/block1/unit_1/bottleneck_v2/conv3',
        'tiny/block1/unit_2/bottleneck_v2/conv1',
        'tiny/block1/unit_2/bottleneck_v2/conv2',
        'tiny/block1/unit_2/bottleneck_v2/conv3',
        'tiny/block2/unit_1/bottleneck_v2/shortcut',
        'tiny/block2/unit_1/bottleneck_v2/conv1',
        'tiny/block2/unit_1/bottleneck_v2/conv2',
        'tiny/block2/unit_1/bottleneck_v2/conv3',
        'tiny/block2/unit_2/bottleneck_v2/conv1',
        'tiny/block2/unit_2/bottleneck_v2/conv2',
        'tiny/block2/unit_2/bottleneck_v2/conv3']
    self.assertItemsEqual(expected, end_points) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:26,代码来源:resnet_v2_test.py

示例6: _resnet_small

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def _resnet_small(self,
                    inputs,
                    num_classes=None,
                    global_pool=True,
                    output_stride=None,
                    include_root_block=True,
                    reuse=None,
                    scope='resnet_v2_small'):
    """A shallow and thin ResNet v2 for faster tests."""
    bottleneck = resnet_v2.bottleneck
    blocks = [
        resnet_utils.Block(
            'block1', bottleneck, [(4, 1, 1)] * 2 + [(4, 1, 2)]),
        resnet_utils.Block(
            'block2', bottleneck, [(8, 2, 1)] * 2 + [(8, 2, 2)]),
        resnet_utils.Block(
            'block3', bottleneck, [(16, 4, 1)] * 2 + [(16, 4, 2)]),
        resnet_utils.Block(
            'block4', bottleneck, [(32, 8, 1)] * 2)]
    return resnet_v2.resnet_v2(inputs, blocks, num_classes, global_pool,
                               output_stride, include_root_block, reuse, scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:23,代码来源:resnet_v2_test.py

示例7: testEndPointsV1

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def testEndPointsV1(self):
    """Test the end points of a tiny v1 bottleneck network."""
    bottleneck = resnet_v1.bottleneck
    blocks = [resnet_utils.Block('block1', bottleneck, [(4, 1, 1), (4, 1, 2)]),
              resnet_utils.Block('block2', bottleneck, [(8, 2, 1), (8, 2, 1)])]
    inputs = create_test_input(2, 32, 16, 3)
    with slim.arg_scope(resnet_utils.resnet_arg_scope()):
      _, end_points = self._resnet_plain(inputs, blocks, scope='tiny')
    expected = [
        'tiny/block1/unit_1/bottleneck_v1/shortcut',
        'tiny/block1/unit_1/bottleneck_v1/conv1',
        'tiny/block1/unit_1/bottleneck_v1/conv2',
        'tiny/block1/unit_1/bottleneck_v1/conv3',
        'tiny/block1/unit_2/bottleneck_v1/conv1',
        'tiny/block1/unit_2/bottleneck_v1/conv2',
        'tiny/block1/unit_2/bottleneck_v1/conv3',
        'tiny/block2/unit_1/bottleneck_v1/shortcut',
        'tiny/block2/unit_1/bottleneck_v1/conv1',
        'tiny/block2/unit_1/bottleneck_v1/conv2',
        'tiny/block2/unit_1/bottleneck_v1/conv3',
        'tiny/block2/unit_2/bottleneck_v1/conv1',
        'tiny/block2/unit_2/bottleneck_v1/conv2',
        'tiny/block2/unit_2/bottleneck_v1/conv3']
    self.assertItemsEqual(expected, end_points) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:26,代码来源:resnet_v1_test.py

示例8: resnet_v1_50

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_50(inputs,
                 num_classes=None,
                 global_pool=True,
                 output_stride=None,
                 reuse=None,
                 scope='resnet_v1_50'):
  """ResNet-50 model of [1]. See resnet_v1() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 3 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 5 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)
  ]
  return resnet_v1(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:21,代码来源:resnet_v1.py

示例9: resnet_v1_101

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_101(inputs,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  reuse=None,
                  scope='resnet_v1_101'):
  """ResNet-101 model of [1]. See resnet_v1() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 3 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 22 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)
  ]
  return resnet_v1(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:21,代码来源:resnet_v1.py

示例10: resnet_v1_152

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_152(inputs,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  reuse=None,
                  scope='resnet_v1_152'):
  """ResNet-152 model of [1]. See resnet_v1() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 7 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 35 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)]
  return resnet_v1(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:20,代码来源:resnet_v1.py

示例11: resnet_v1_200

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_200(inputs,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  reuse=None,
                  scope='resnet_v1_200'):
  """ResNet-200 model of [2]. See resnet_v1() for arg and return description."""
  blocks = [
      resnet_utils.Block(
          'block1', bottleneck, [(256, 64, 1)] * 2 + [(256, 64, 2)]),
      resnet_utils.Block(
          'block2', bottleneck, [(512, 128, 1)] * 23 + [(512, 128, 2)]),
      resnet_utils.Block(
          'block3', bottleneck, [(1024, 256, 1)] * 35 + [(1024, 256, 2)]),
      resnet_utils.Block(
          'block4', bottleneck, [(2048, 512, 1)] * 3)]
  return resnet_v1(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:20,代码来源:resnet_v1.py

示例12: resnet_v1_beta_block

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_beta_block(scope, base_depth, num_units, stride):
    """Helper function for creating a resnet_v1 beta variant bottleneck block.

    Args:
    scope: The scope of the block.
    base_depth: The depth of the bottleneck layer for each unit.
    num_units: The number of units in the block.
    stride: The stride of the block, implemented as a stride in the last unit.
      All other units have stride=1.

    Returns:
    A resnet_v1 bottleneck block.
    """
    return resnet_utils.Block(scope, bottleneck, [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': 1,
        'unit_rate': 1
    }] * (num_units - 1) + [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': stride,
        'unit_rate': 1
    }]) 
开发者ID:SketchyScene,项目名称:SketchySceneColorization,代码行数:26,代码来源:deeplab_v3plus_model.py

示例13: resnet_v1_beta_block

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_beta_block(scope, base_depth, num_units, stride):
  """Helper function for creating a resnet_v1 beta variant bottleneck block.

  Args:
    scope: The scope of the block.
    base_depth: The depth of the bottleneck layer for each unit.
    num_units: The number of units in the block.
    stride: The stride of the block, implemented as a stride in the last unit.
      All other units have stride=1.

  Returns:
    A resnet_v1 bottleneck block.
  """
  return resnet_utils.Block(scope, bottleneck, [{
      'depth': base_depth * 4,
      'depth_bottleneck': base_depth,
      'stride': 1,
      'unit_rate': 1
  }] * (num_units - 1) + [{
      'depth': base_depth * 4,
      'depth_bottleneck': base_depth,
      'stride': stride,
      'unit_rate': 1
  }]) 
开发者ID:IBM,项目名称:MAX-Image-Segmenter,代码行数:26,代码来源:resnet_v1_beta.py

示例14: resnet_v1_small_beta_block

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_small_beta_block(scope, base_depth, num_units, stride):
  """Helper function for creating a resnet_18 beta variant bottleneck block.

  Args:
    scope: The scope of the block.
    base_depth: The depth of the bottleneck layer for each unit.
    num_units: The number of units in the block.
    stride: The stride of the block, implemented as a stride in the last unit.
      All other units have stride=1.

  Returns:
    A resnet_18 bottleneck block.
  """
  block_args = []
  for _ in range(num_units - 1):
    block_args.append({'depth': base_depth, 'stride': 1, 'unit_rate': 1})
  block_args.append({'depth': base_depth, 'stride': stride, 'unit_rate': 1})
  return resnet_utils.Block(scope, lite_bottleneck, block_args) 
开发者ID:tensorflow,项目名称:models,代码行数:20,代码来源:resnet_v1_beta.py

示例15: resnet_v1_beta_block

# 需要导入模块: from tensorflow.contrib.slim.nets import resnet_utils [as 别名]
# 或者: from tensorflow.contrib.slim.nets.resnet_utils import Block [as 别名]
def resnet_v1_beta_block(scope, base_depth, num_units, stride):
    """Helper function for creating a resnet_v1 beta variant bottleneck block.

    Args:
      scope: The scope of the block.
      base_depth: The depth of the bottleneck layer for each unit.
      num_units: The number of units in the block.
      stride: The stride of the block, implemented as a stride in the last unit.
        All other units have stride=1.

    Returns:
      A resnet_v1 bottleneck block.
    """
    return resnet_utils.Block(scope, bottleneck, [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': 1,
        'unit_rate': 1
    }] * (num_units - 1) + [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': stride,
        'unit_rate': 1
    }]) 
开发者ID:POSTECH-IMLAB,项目名称:LaneSegmentationNetwork,代码行数:26,代码来源:resnet_v1_beta.py


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