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


Python nasnet_utils.calc_reduction_layers方法代码示例

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


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

示例1: testCalcReductionLayers

# 需要导入模块: from nets.nasnet import nasnet_utils [as 别名]
# 或者: from nets.nasnet.nasnet_utils import calc_reduction_layers [as 别名]
def testCalcReductionLayers(self):
    num_cells = 18
    num_reduction_layers = 2
    reduction_layers = nasnet_utils.calc_reduction_layers(
        num_cells, num_reduction_layers)
    self.assertEqual(len(reduction_layers), 2)
    self.assertEqual(reduction_layers[0], 6)
    self.assertEqual(reduction_layers[1], 12) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:10,代码来源:nasnet_utils_test.py

示例2: _build_pnasnet_base

# 需要导入模块: from nets.nasnet import nasnet_utils [as 别名]
# 或者: from nets.nasnet.nasnet_utils import calc_reduction_layers [as 别名]
def _build_pnasnet_base(
    hidden_previous, hidden, normal_cell, hparams, true_cell_num,
    start_cell_num):
  """Constructs a PNASNet image model for proposal classifier features."""

  # Find where to place the reduction cells or stride normal cells
  reduction_indices = nasnet_utils.calc_reduction_layers(
      hparams.num_cells, hparams.num_reduction_layers)
  filter_scaling = _filter_scaling(reduction_indices, start_cell_num)

  # Note: The None is prepended to match the behavior of _imagenet_stem()
  cell_outputs = [None, hidden_previous, hidden]
  net = hidden

  # Run the cells
  for cell_num in range(start_cell_num, hparams.num_cells):
    is_reduction = cell_num in reduction_indices
    stride = 2 if is_reduction else 1
    if is_reduction: filter_scaling *= hparams.filter_scaling_rate
    prev_layer = cell_outputs[-2]
    net = normal_cell(
        net,
        scope='cell_{}'.format(cell_num),
        filter_scaling=filter_scaling,
        stride=stride,
        prev_layer=prev_layer,
        cell_num=true_cell_num)
    true_cell_num += 1
    cell_outputs.append(net)

  # Final nonlinearity.
  # Note that we have dropped the final pooling, dropout and softmax layers
  # from the default pnasnet version.
  with tf.variable_scope('final_layer'):
    net = tf.nn.relu(net)
  return net


# TODO(shlens): Only fixed_shape_resizer is currently supported for PNASNet
# featurization. The reason for this is that pnasnet.py only supports
# inputs with fully known shapes. We need to update pnasnet.py to handle
# shapes not known at compile time. 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:44,代码来源:faster_rcnn_pnas_feature_extractor.py


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