當前位置: 首頁>>代碼示例>>Python>>正文


Python optimizer_pb2.Optimizer方法代碼示例

本文整理匯總了Python中object_detection.protos.optimizer_pb2.Optimizer方法的典型用法代碼示例。如果您正苦於以下問題:Python optimizer_pb2.Optimizer方法的具體用法?Python optimizer_pb2.Optimizer怎麽用?Python optimizer_pb2.Optimizer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在object_detection.protos.optimizer_pb2的用法示例。


在下文中一共展示了optimizer_pb2.Optimizer方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testBuildRMSPropOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildRMSPropOptimizer(self):
    optimizer_text_proto = """
      rms_prop_optimizer: {
        learning_rate: {
          exponential_decay_learning_rate {
            initial_learning_rate: 0.004
            decay_steps: 800720
            decay_factor: 0.95
          }
        }
        momentum_optimizer_value: 0.9
        decay: 0.9
        epsilon: 1.0
      }
      use_moving_average: false
    """
    global_summaries = set([])
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer = optimizer_builder.build(optimizer_proto, global_summaries)
    self.assertTrue(isinstance(optimizer, tf.train.RMSPropOptimizer)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:23,代碼來源:optimizer_builder_test.py

示例2: testBuildMomentumOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildMomentumOptimizer(self):
    optimizer_text_proto = """
      momentum_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.001
          }
        }
        momentum_optimizer_value: 0.99
      }
      use_moving_average: false
    """
    global_summaries = set([])
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer = optimizer_builder.build(optimizer_proto, global_summaries)
    self.assertTrue(isinstance(optimizer, tf.train.MomentumOptimizer)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:19,代碼來源:optimizer_builder_test.py

示例3: testBuildAdamOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildAdamOptimizer(self):
    optimizer_text_proto = """
      adam_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.002
          }
        }
      }
      use_moving_average: false
    """
    global_summaries = set([])
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer = optimizer_builder.build(optimizer_proto, global_summaries)
    self.assertTrue(isinstance(optimizer, tf.train.AdamOptimizer)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:18,代碼來源:optimizer_builder_test.py

示例4: testBuildMovingAverageOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildMovingAverageOptimizer(self):
    optimizer_text_proto = """
      adam_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.002
          }
        }
      }
      use_moving_average: True
    """
    global_summaries = set([])
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer = optimizer_builder.build(optimizer_proto, global_summaries)
    self.assertTrue(
        isinstance(optimizer, tf.contrib.opt.MovingAverageOptimizer)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:19,代碼來源:optimizer_builder_test.py

示例5: testBuildMovingAverageOptimizerWithNonDefaultDecay

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildMovingAverageOptimizerWithNonDefaultDecay(self):
    optimizer_text_proto = """
      adam_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.002
          }
        }
      }
      use_moving_average: True
      moving_average_decay: 0.2
    """
    global_summaries = set([])
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer = optimizer_builder.build(optimizer_proto, global_summaries)
    self.assertTrue(
        isinstance(optimizer, tf.contrib.opt.MovingAverageOptimizer))
    # TODO: Find a way to not depend on the private members.
    self.assertAlmostEqual(optimizer._ema._decay, 0.2) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:22,代碼來源:optimizer_builder_test.py

示例6: testBuildRMSPropOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildRMSPropOptimizer(self):
    optimizer_text_proto = """
      rms_prop_optimizer: {
        learning_rate: {
          exponential_decay_learning_rate {
            initial_learning_rate: 0.004
            decay_steps: 800720
            decay_factor: 0.95
          }
        }
        momentum_optimizer_value: 0.9
        decay: 0.9
        epsilon: 1.0
      }
      use_moving_average: false
    """
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer, _ = optimizer_builder.build(optimizer_proto)
    self.assertTrue(isinstance(optimizer, tf.train.RMSPropOptimizer)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:22,代碼來源:optimizer_builder_test.py

示例7: testBuildMomentumOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildMomentumOptimizer(self):
    optimizer_text_proto = """
      momentum_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.001
          }
        }
        momentum_optimizer_value: 0.99
      }
      use_moving_average: false
    """
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer, _ = optimizer_builder.build(optimizer_proto)
    self.assertTrue(isinstance(optimizer, tf.train.MomentumOptimizer)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:18,代碼來源:optimizer_builder_test.py

示例8: testBuildMovingAverageOptimizer

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildMovingAverageOptimizer(self):
    optimizer_text_proto = """
      adam_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.002
          }
        }
      }
      use_moving_average: True
    """
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer, _ = optimizer_builder.build(optimizer_proto)
    self.assertTrue(
        isinstance(optimizer, tf.contrib.opt.MovingAverageOptimizer)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:18,代碼來源:optimizer_builder_test.py

示例9: testBuildMovingAverageOptimizerWithNonDefaultDecay

# 需要導入模塊: from object_detection.protos import optimizer_pb2 [as 別名]
# 或者: from object_detection.protos.optimizer_pb2 import Optimizer [as 別名]
def testBuildMovingAverageOptimizerWithNonDefaultDecay(self):
    optimizer_text_proto = """
      adam_optimizer: {
        learning_rate: {
          constant_learning_rate {
            learning_rate: 0.002
          }
        }
      }
      use_moving_average: True
      moving_average_decay: 0.2
    """
    optimizer_proto = optimizer_pb2.Optimizer()
    text_format.Merge(optimizer_text_proto, optimizer_proto)
    optimizer, _ = optimizer_builder.build(optimizer_proto)
    self.assertTrue(
        isinstance(optimizer, tf.contrib.opt.MovingAverageOptimizer))
    # TODO(rathodv): Find a way to not depend on the private members.
    self.assertAlmostEqual(optimizer._ema._decay, 0.2) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:21,代碼來源:optimizer_builder_test.py


注:本文中的object_detection.protos.optimizer_pb2.Optimizer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。