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


Python resnet_v1.resnet_v1方法代码示例

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


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

示例1: _resnet_small

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [as 别名]
def _resnet_small(self,
                    inputs,
                    num_classes=None,
                    is_training=True,
                    global_pool=True,
                    output_stride=None,
                    include_root_block=True,
                    reuse=None,
                    scope='resnet_v1_small'):
    """A shallow and thin ResNet v1 for faster tests."""
    block = resnet_v1.resnet_v1_block
    blocks = [
        block('block1', base_depth=1, num_units=3, stride=2),
        block('block2', base_depth=2, num_units=3, stride=2),
        block('block3', base_depth=4, num_units=3, stride=2),
        block('block4', base_depth=8, num_units=2, stride=1),
    ]
    return resnet_v1.resnet_v1(inputs, blocks, num_classes,
                               is_training=is_training,
                               global_pool=global_pool,
                               output_stride=output_stride,
                               include_root_block=include_root_block,
                               reuse=reuse,
                               scope=scope) 
开发者ID:DetectionTeamUCAS,项目名称:R2CNN_Faster-RCNN_Tensorflow,代码行数:26,代码来源:resnet_v1_test.py

示例2: testEndPointsV1

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [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:wenwei202,项目名称:terngrad,代码行数:26,代码来源:resnet_v1_test.py

示例3: testEndPointsV1

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [as 别名]
def testEndPointsV1(self):
    """Test the end points of a tiny v1 bottleneck network."""
    blocks = [
        resnet_v1.resnet_v1_block(
            'block1', base_depth=1, num_units=2, stride=2),
        resnet_v1.resnet_v1_block(
            'block2', base_depth=2, num_units=2, stride=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:ringringyi,项目名称:DOTA_models,代码行数:29,代码来源:resnet_v1_test.py

示例4: _resnet_small

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [as 别名]
def _resnet_small(self,
                    inputs,
                    num_classes=None,
                    is_training=True,
                    global_pool=True,
                    output_stride=None,
                    include_root_block=True,
                    spatial_squeeze=True,
                    reuse=None,
                    scope='resnet_v1_small'):
    """A shallow and thin ResNet v1 for faster tests."""
    block = resnet_v1.resnet_v1_block
    blocks = [
        block('block1', base_depth=1, num_units=3, stride=2),
        block('block2', base_depth=2, num_units=3, stride=2),
        block('block3', base_depth=4, num_units=3, stride=2),
        block('block4', base_depth=8, num_units=2, stride=1),
    ]
    return resnet_v1.resnet_v1(inputs, blocks, num_classes,
                               is_training=is_training,
                               global_pool=global_pool,
                               output_stride=output_stride,
                               include_root_block=include_root_block,
                               spatial_squeeze=spatial_squeeze,
                               reuse=reuse,
                               scope=scope) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:28,代码来源:resnet_v1_test.py

示例5: testEndPointsV1

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [as 别名]
def testEndPointsV1(self):
    """Test the end points of a tiny v1 bottleneck network."""
    blocks = [
        resnet_v1.resnet_v1_block(
            'block1', base_depth=1, num_units=2, stride=2),
        resnet_v1.resnet_v1_block(
            'block2', base_depth=2, num_units=2, stride=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.keys()) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:29,代码来源:resnet_v1_test.py

示例6: testEndPointsV1

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [as 别名]
def testEndPointsV1(self):
    """Test the end points of a tiny v1 bottleneck network."""
    blocks = [
        resnet_v1.resnet_v1_block(
            'block1', base_depth=1, num_units=2, stride=2),
        resnet_v1.resnet_v1_block(
            'block2', base_depth=2, num_units=2, stride=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, list(end_points.keys())) 
开发者ID:google-research,项目名称:morph-net,代码行数:29,代码来源:resnet_v1_test.py

示例7: testMinBaseDepth

# 需要导入模块: from nets import resnet_v1 [as 别名]
# 或者: from nets.resnet_v1 import resnet_v1 [as 别名]
def testMinBaseDepth(self):
    resnets = [
        resnet_v1.resnet_v1_50, resnet_v1.resnet_v1_101,
        resnet_v1.resnet_v1_152, resnet_v1.resnet_v1_200
    ]
    resnet_names = [
        'resnet_v1_50', 'resnet_v1_101', 'resnet_v1_152', 'resnet_v1_200'
    ]
    for resnet, resnet_name in zip(resnets, resnet_names):
      min_base_depth = 5
      global_pool = True
      num_classes = 10
      inputs = create_test_input(2, 224, 224, 3)
      with slim.arg_scope(resnet_utils.resnet_arg_scope()):
        _, end_points = resnet(
            inputs,
            num_classes,
            global_pool=global_pool,
            min_base_depth=min_base_depth,
            depth_multiplier=0,
            scope=resnet_name)
        for block in ['block1', 'block2', 'block3', 'block4']:
          block_name = resnet_name + '/' + block
          self.assertTrue(block_name in end_points)
          self.assertEqual(
              len(end_points[block_name].get_shape().as_list()), 4)
          # The output depth is 4 times base_depth.
          depth_expected = min_base_depth * 4
          self.assertEqual(
              end_points[block_name].get_shape().as_list()[3], depth_expected) 
开发者ID:google-research,项目名称:morph-net,代码行数:32,代码来源:resnet_v1_test.py


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