當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。