當前位置: 首頁>>代碼示例>>Python>>正文


Python resnet_v1.bottleneck方法代碼示例

本文整理匯總了Python中nets.resnet_v1.bottleneck方法的典型用法代碼示例。如果您正苦於以下問題:Python resnet_v1.bottleneck方法的具體用法?Python resnet_v1.bottleneck怎麽用?Python resnet_v1.bottleneck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nets.resnet_v1的用法示例。


在下文中一共展示了resnet_v1.bottleneck方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testEndPointsV1

# 需要導入模塊: from nets import resnet_v1 [as 別名]
# 或者: from nets.resnet_v1 import bottleneck [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

示例2: resnet_v1_block

# 需要導入模塊: from nets import resnet_v1 [as 別名]
# 或者: from nets.resnet_v1 import bottleneck [as 別名]
def resnet_v1_block(scope, base_depth, num_units, stride):
  """Helper function for creating a resnet_v1 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 first unit.
      All other units have stride=1.
      Note that the default slim implementation places the stride in the last unit,
      which is less memory efficient and a deviation from the resnet paper.
  Returns:
    A resnet_v1 bottleneck block.
  """
  return resnet_utils.Block(scope, resnet_v1.bottleneck, [{
      'depth': base_depth * 4,
      'depth_bottleneck': base_depth,
      'stride': stride
  }] + [{
      'depth': base_depth * 4,
      'depth_bottleneck': base_depth,
      'stride': 1
  }] * (num_units - 1)) 
開發者ID:simonmeister,項目名稱:motion-rcnn,代碼行數:24,代碼來源:resnet_v1_util.py

示例3: _extract_box_classifier_features

# 需要導入模塊: from nets import resnet_v1 [as 別名]
# 或者: from nets.resnet_v1 import bottleneck [as 別名]
def _extract_box_classifier_features(self, proposal_feature_maps, scope):
    """Extracts second stage box classifier features.

    Args:
      proposal_feature_maps: A 4-D float tensor with shape
        [batch_size * self.max_num_proposals, crop_height, crop_width, depth]
        representing the feature map cropped to each proposal.
      scope: A scope name (unused).

    Returns:
      proposal_classifier_features: A 4-D float tensor with shape
        [batch_size * self.max_num_proposals, height, width, depth]
        representing box classifier features for each proposal.
    """
    with tf.variable_scope(self._architecture, reuse=self._reuse_weights):
      with slim.arg_scope(
          resnet_utils.resnet_arg_scope(
              batch_norm_epsilon=1e-5,
              batch_norm_scale=True,
              weight_decay=self._weight_decay)):
        with slim.arg_scope([slim.batch_norm], is_training=False):
          blocks = [
              resnet_utils.Block('block4', resnet_v1.bottleneck, [{
                  'depth': 2048,
                  'depth_bottleneck': 512,
                  'stride': 1
              }] * 3)
          ]
          proposal_classifier_features = resnet_utils.stack_blocks_dense(
              proposal_feature_maps, blocks)
    return proposal_classifier_features 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:33,代碼來源:faster_rcnn_resnet_v1_feature_extractor.py

示例4: _extract_box_classifier_features

# 需要導入模塊: from nets import resnet_v1 [as 別名]
# 或者: from nets.resnet_v1 import bottleneck [as 別名]
def _extract_box_classifier_features(self, proposal_feature_maps, scope):
    """Extracts second stage box classifier features.

    Args:
      proposal_feature_maps: A 4-D float tensor with shape
        [batch_size * self.max_num_proposals, crop_height, crop_width, depth]
        representing the feature map cropped to each proposal.
      scope: A scope name (unused).

    Returns:
      proposal_classifier_features: A 4-D float tensor with shape
        [batch_size * self.max_num_proposals, height, width, depth]
        representing box classifier features for each proposal.
    """
    with tf.variable_scope(self._architecture, reuse=self._reuse_weights):
      with slim.arg_scope(
          resnet_utils.resnet_arg_scope(
              batch_norm_epsilon=1e-5,
              batch_norm_scale=True,
              weight_decay=self._weight_decay)):
        with slim.arg_scope([slim.batch_norm],
                            is_training=self._train_batch_norm):
          blocks = [
              resnet_utils.Block('block4', resnet_v1.bottleneck, [{
                  'depth': 2048,
                  'depth_bottleneck': 512,
                  'stride': 1
              }] * 3)
          ]
          proposal_classifier_features = resnet_utils.stack_blocks_dense(
              proposal_feature_maps, blocks)
    return proposal_classifier_features 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:34,代碼來源:faster_rcnn_resnet_v1_feature_extractor.py

示例5: testAtrousValuesBottleneck

# 需要導入模塊: from nets import resnet_v1 [as 別名]
# 或者: from nets.resnet_v1 import bottleneck [as 別名]
def testAtrousValuesBottleneck(self):
    self._atrousValues(resnet_v1.bottleneck) 
開發者ID:wenwei202,項目名稱:terngrad,代碼行數:4,代碼來源:resnet_v1_test.py

示例6: _resnet_small

# 需要導入模塊: from nets import resnet_v1 [as 別名]
# 或者: from nets.resnet_v1 import bottleneck [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."""
    bottleneck = resnet_v1.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_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:wenwei202,項目名稱:terngrad,代碼行數:29,代碼來源:resnet_v1_test.py


注:本文中的nets.resnet_v1.bottleneck方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。