コード例 #1
0
def resnet_v1_200(inputs,
                  num_classes=None,
                  is_training=True,
                  global_pool=True,
                  output_stride=None,
                  spatial_squeeze=True,
                  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,
                     is_training,
                     global_pool=global_pool,
                     output_stride=output_stride,
                     include_root_block=True,
                     spatial_squeeze=spatial_squeeze,
                     reuse=reuse,
                     scope=scope)
コード例 #2
0
ファイル: resnet_v1.py プロジェクト: souravroy0708/tefla
def resnet_v1_152(inputs,
                  is_training,
                  reuse,
                  num_classes=None,
                  global_pool=True,
                  output_stride=None,
                  name='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_v1(inputs,
                     is_training,
                     reuse,
                     blocks,
                     num_classes,
                     global_pool=global_pool,
                     output_stride=output_stride,
                     include_root_block=True,
                     name=name)
コード例 #3
0
def resnet_v1_50_truncated_16x16(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)] * 6)
  ]
  return resnet_v1(inputs, blocks, num_classes, global_pool, output_stride,
                   include_root_block=True, reuse=reuse, scope=scope)
コード例 #4
0
def resnet_v2_block(scope, base_depth, num_units, stride):
    # Helper function for creating a resnet_v2 bottleneck block.
    return resnet_utils.Block(scope, bottleneck, [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': 1
    }] * (num_units - 1) + [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': stride
    }])
コード例 #5
0
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)] * 8 + [(1024, 256, 2)]),
        resnet_utils.Block('block4', bottleneck,
                           [(1024, 256, 1)] * 10 + [(1024, 256, 2)]),
        resnet_utils.Block('block5', bottleneck,
                           [(1024, 256, 1)] * 15 + [(1024, 256, 2)]),
        resnet_utils.Block('block6', bottleneck,
                           [(2048, 512, 1)] * 2 + [(2048, 512, 2)]),
    ]
    return resnet_v1(inputs,
                     blocks,
                     num_classes,
                     global_pool,
                     output_stride,
                     include_root_block=True,
                     reuse=reuse,
                     scope=scope)
def resnet_v2_block(scope, base_depth, num_units, stride):
    """Helper function for creating a resnet_v2 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_v2 bottleneck block.
    """
    return resnet_utils.Block(scope, bottleneck, [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': 1
    }] * (num_units - 1) + [{
        'depth': base_depth * 4,
        'depth_bottleneck': base_depth,
        'stride': stride
    }])