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