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


Python pnasnet.pnasnet_large_arg_scope方法代码示例

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


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

示例1: testBuildLogitsLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testBuildLogitsLargeModel(self):
    batch_size = 5
    height, width = 331, 331
    num_classes = 1000
    inputs = tf.random_uniform((batch_size, height, width, 3))
    tf.train.create_global_step()
    with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
      logits, end_points = pnasnet.build_pnasnet_large(inputs, num_classes)
    auxlogits = end_points['AuxLogits']
    predictions = end_points['Predictions']
    self.assertListEqual(auxlogits.get_shape().as_list(),
                         [batch_size, num_classes])
    self.assertListEqual(logits.get_shape().as_list(),
                         [batch_size, num_classes])
    self.assertListEqual(predictions.get_shape().as_list(),
                         [batch_size, num_classes]) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:18,代码来源:pnasnet_test.py

示例2: pnasnet_large_arg_scope_for_detection

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def pnasnet_large_arg_scope_for_detection(is_batch_norm_training=False):
  """Defines the default arg scope for the PNASNet Large for object detection.

  This provides a small edit to switch batch norm training on and off.

  Args:
    is_batch_norm_training: Boolean indicating whether to train with batch norm.
    Default is False.

  Returns:
    An `arg_scope` to use for the PNASNet Large Model.
  """
  imagenet_scope = pnasnet.pnasnet_large_arg_scope()
  with slim.arg_scope(imagenet_scope):
    with slim.arg_scope([slim.batch_norm],
                        is_training=is_batch_norm_training) as sc:
      return sc 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:19,代码来源:ssd_pnasnet_feature_extractor.py

示例3: testBuildLogitsLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testBuildLogitsLargeModel(self):
    batch_size = 5
    height, width = 331, 331
    num_classes = 1000
    inputs = tf.random.uniform((batch_size, height, width, 3))
    tf.train.create_global_step()
    with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
      logits, end_points = pnasnet.build_pnasnet_large(inputs, num_classes)
    auxlogits = end_points['AuxLogits']
    predictions = end_points['Predictions']
    self.assertListEqual(auxlogits.get_shape().as_list(),
                         [batch_size, num_classes])
    self.assertListEqual(logits.get_shape().as_list(),
                         [batch_size, num_classes])
    self.assertListEqual(predictions.get_shape().as_list(),
                         [batch_size, num_classes]) 
开发者ID:tensorflow,项目名称:models,代码行数:18,代码来源:pnasnet_test.py

示例4: testBuildNonExistingLayerLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testBuildNonExistingLayerLargeModel(self):
    """Tests that the model is built correctly without unnecessary layers."""
    inputs = tf.random_uniform((5, 331, 331, 3))
    tf.train.create_global_step()
    with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
      pnasnet.build_pnasnet_large(inputs, 1000)
    vars_names = [x.op.name for x in tf.trainable_variables()]
    self.assertIn('cell_stem_0/1x1/weights', vars_names)
    self.assertNotIn('cell_stem_1/comb_iter_0/right/1x1/weights', vars_names) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:11,代码来源:pnasnet_test.py

示例5: testBuildPreLogitsLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testBuildPreLogitsLargeModel(self):
    batch_size = 5
    height, width = 331, 331
    num_classes = None
    inputs = tf.random_uniform((batch_size, height, width, 3))
    tf.train.create_global_step()
    with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
      net, end_points = pnasnet.build_pnasnet_large(inputs, num_classes)
    self.assertFalse('AuxLogits' in end_points)
    self.assertFalse('Predictions' in end_points)
    self.assertTrue(net.op.name.startswith('final_layer/Mean'))
    self.assertListEqual(net.get_shape().as_list(), [batch_size, 4320]) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:14,代码来源:pnasnet_test.py

示例6: testAllEndPointsShapesLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testAllEndPointsShapesLargeModel(self):
    batch_size = 5
    height, width = 331, 331
    num_classes = 1000
    inputs = tf.random_uniform((batch_size, height, width, 3))
    tf.train.create_global_step()
    with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
      _, end_points = pnasnet.build_pnasnet_large(inputs, num_classes)

    endpoints_shapes = {'Stem': [batch_size, 42, 42, 540],
                        'Cell_0': [batch_size, 42, 42, 1080],
                        'Cell_1': [batch_size, 42, 42, 1080],
                        'Cell_2': [batch_size, 42, 42, 1080],
                        'Cell_3': [batch_size, 42, 42, 1080],
                        'Cell_4': [batch_size, 21, 21, 2160],
                        'Cell_5': [batch_size, 21, 21, 2160],
                        'Cell_6': [batch_size, 21, 21, 2160],
                        'Cell_7': [batch_size, 21, 21, 2160],
                        'Cell_8': [batch_size, 11, 11, 4320],
                        'Cell_9': [batch_size, 11, 11, 4320],
                        'Cell_10': [batch_size, 11, 11, 4320],
                        'Cell_11': [batch_size, 11, 11, 4320],
                        'global_pool': [batch_size, 4320],
                        # Logits and predictions
                        'AuxLogits': [batch_size, 1000],
                        'Predictions': [batch_size, 1000],
                        'Logits': [batch_size, 1000],
                       }
    self.assertEqual(len(end_points), 17)
    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      tf.logging.info('Endpoint name: {}'.format(endpoint_name))
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertIn(endpoint_name, end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:38,代码来源:pnasnet_test.py

示例7: testNoAuxHeadLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testNoAuxHeadLargeModel(self):
    batch_size = 5
    height, width = 331, 331
    num_classes = 1000
    for use_aux_head in (True, False):
      tf.reset_default_graph()
      inputs = tf.random_uniform((batch_size, height, width, 3))
      tf.train.create_global_step()
      config = pnasnet.large_imagenet_config()
      config.set_hparam('use_aux_head', int(use_aux_head))
      with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
        _, end_points = pnasnet.build_pnasnet_large(inputs, num_classes,
                                                    config=config)
      self.assertEqual('AuxLogits' in end_points, use_aux_head) 
开发者ID:leimao,项目名称:DeepLab_v3,代码行数:16,代码来源:pnasnet_test.py

示例8: pnasnet_large_arg_scope_for_detection

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def pnasnet_large_arg_scope_for_detection(is_batch_norm_training=False):
  """Defines the default arg scope for the PNASNet Large for object detection.

  This provides a small edit to switch batch norm training on and off.

  Args:
    is_batch_norm_training: Boolean indicating whether to train with batch norm.

  Returns:
    An `arg_scope` to use for the PNASNet Large Model.
  """
  imagenet_scope = pnasnet.pnasnet_large_arg_scope()
  with arg_scope(imagenet_scope):
    with arg_scope([slim.batch_norm], is_training=is_batch_norm_training) as sc:
      return sc 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:17,代码来源:faster_rcnn_pnas_feature_extractor.py

示例9: testOverrideHParamsLargeModel

# 需要导入模块: from nets.nasnet import pnasnet [as 别名]
# 或者: from nets.nasnet.pnasnet import pnasnet_large_arg_scope [as 别名]
def testOverrideHParamsLargeModel(self):
    batch_size = 5
    height, width = 331, 331
    num_classes = 1000
    inputs = tf.random_uniform((batch_size, height, width, 3))
    tf.train.create_global_step()
    config = pnasnet.large_imagenet_config()
    config.set_hparam('data_format', 'NCHW')
    with slim.arg_scope(pnasnet.pnasnet_large_arg_scope()):
      _, end_points = pnasnet.build_pnasnet_large(
          inputs, num_classes, config=config)
    self.assertListEqual(
        end_points['Stem'].shape.as_list(), [batch_size, 540, 42, 42]) 
开发者ID:autoai-org,项目名称:CVTron,代码行数:15,代码来源:pnasnet_test.py


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