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


Python ops.conv2d方法代码示例

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


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

示例1: inception_v3_parameters

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def inception_v3_parameters(weight_decay=0.00004, stddev=0.1,
                            batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
  """Yields the scope with the default parameters for inception_v3.

  Args:
    weight_decay: the weight decay for weights variables.
    stddev: standard deviation of the truncated guassian weight distribution.
    batch_norm_decay: decay for the moving average of batch_norm momentums.
    batch_norm_epsilon: small float added to variance to avoid dividing by zero.

  Yields:
    a arg_scope with the parameters needed for inception_v3.
  """
  # Set weight_decay for weights in Conv and FC layers.
  with scopes.arg_scope([ops.conv2d, ops.fc],
                        weight_decay=weight_decay):
    # Set stddev, activation and parameters for batch_norm.
    with scopes.arg_scope([ops.conv2d],
                          stddev=stddev,
                          activation=tf.nn.relu,
                          batch_norm_params={
                              'decay': batch_norm_decay,
                              'epsilon': batch_norm_epsilon}) as arg_scope:
      yield arg_scope 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:26,代码来源:inception_model.py

示例2: testCreateConv

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConv(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 3])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(), [5, height, width, 32]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:ops_test.py

示例3: testCreateSquareConv

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateSquareConv(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, 3)
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(), [5, height, width, 32]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:ops_test.py

示例4: testCreateConvWithTensorShape

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvWithTensorShape(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, images.get_shape()[1:3])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(), [5, height, width, 32]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:ops_test.py

示例5: testCreateFullyConv

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateFullyConv(self):
    height, width = 6, 6
    with self.test_session():
      images = tf.random_uniform((5, height, width, 32), seed=1)
      output = ops.conv2d(images, 64, images.get_shape()[1:3], padding='VALID')
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(), [5, 1, 1, 64]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:ops_test.py

示例6: testCreateHorizontalConv

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateHorizontalConv(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [1, 3])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height, width, 32]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:10,代码来源:ops_test.py

示例7: testCreateConvWithStride

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvWithStride(self):
    height, width = 6, 6
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 3], stride=2)
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height/2, width/2, 32]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:10,代码来源:ops_test.py

示例8: testCreateConvCreatesWeightsAndBiasesVars

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvCreatesWeightsAndBiasesVars(self):
    height, width = 3, 3
    images = tf.random_uniform((5, height, width, 3), seed=1)
    with self.test_session():
      self.assertFalse(variables.get_variables('conv1/weights'))
      self.assertFalse(variables.get_variables('conv1/biases'))
      ops.conv2d(images, 32, [3, 3], scope='conv1')
      self.assertTrue(variables.get_variables('conv1/weights'))
      self.assertTrue(variables.get_variables('conv1/biases')) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:11,代码来源:ops_test.py

示例9: testCreateConvWithScope

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvWithScope(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 3], scope='conv1')
      self.assertEquals(output.op.name, 'conv1/Relu') 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:8,代码来源:ops_test.py

示例10: testCreateConvWithoutActivation

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvWithoutActivation(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 3], activation=None)
      self.assertEquals(output.op.name, 'Conv/BiasAdd') 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:8,代码来源:ops_test.py

示例11: testCreateConvWithWD

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvWithWD(self):
    height, width = 3, 3
    with self.test_session() as sess:
      images = tf.random_uniform((5, height, width, 3), seed=1)
      ops.conv2d(images, 32, [3, 3], weight_decay=0.01)
      wd = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)[0]
      self.assertEquals(wd.op.name,
                        'Conv/weights/Regularizer/L2Regularizer/value')
      sess.run(tf.global_variables_initializer())
      self.assertTrue(sess.run(wd) <= 0.01) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:ops_test.py

示例12: testCreateConvWithoutWD

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testCreateConvWithoutWD(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      ops.conv2d(images, 32, [3, 3], weight_decay=0)
      self.assertEquals(
          tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES), []) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:ops_test.py

示例13: testReuseVars

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testReuseVars(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      ops.conv2d(images, 32, [3, 3], scope='conv1')
      self.assertEquals(len(variables.get_variables()), 2)
      ops.conv2d(images, 32, [3, 3], scope='conv1', reuse=True)
      self.assertEquals(len(variables.get_variables()), 2) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:10,代码来源:ops_test.py

示例14: testNonReuseVars

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testNonReuseVars(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      ops.conv2d(images, 32, [3, 3])
      self.assertEquals(len(variables.get_variables()), 2)
      ops.conv2d(images, 32, [3, 3])
      self.assertEquals(len(variables.get_variables()), 4) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:10,代码来源:ops_test.py

示例15: testReuseConvWithWD

# 需要导入模块: from inception.slim import ops [as 别名]
# 或者: from inception.slim.ops import conv2d [as 别名]
def testReuseConvWithWD(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      ops.conv2d(images, 32, [3, 3], weight_decay=0.01, scope='conv1')
      self.assertEquals(len(variables.get_variables()), 2)
      self.assertEquals(
          len(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)), 1)
      ops.conv2d(images, 32, [3, 3], weight_decay=0.01, scope='conv1',
                 reuse=True)
      self.assertEquals(len(variables.get_variables()), 2)
      self.assertEquals(
          len(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)), 1) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:15,代码来源:ops_test.py


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