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


Python train_pb2.TrainConfig方法代码示例

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


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

示例1: get_configs_from_pipeline_file

# 需要导入模块: from object_detection.protos import train_pb2 [as 别名]
# 或者: from object_detection.protos.train_pb2 import TrainConfig [as 别名]
def get_configs_from_pipeline_file():
  """Reads training configuration from a pipeline_pb2.TrainEvalPipelineConfig.

  Reads training config from file specified by pipeline_config_path flag.

  Returns:
    model_config: model_pb2.DetectionModel
    train_config: train_pb2.TrainConfig
    input_config: input_reader_pb2.InputReader
  """
  pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
  with tf.gfile.GFile(FLAGS.pipeline_config_path, 'r') as f:
    text_format.Merge(f.read(), pipeline_config)

  model_config = pipeline_config.model
  train_config = pipeline_config.train_config
  input_config = pipeline_config.train_input_reader

  return model_config, train_config, input_config 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:21,代码来源:train.py

示例2: get_configs_from_pipeline_file

# 需要导入模块: from object_detection.protos import train_pb2 [as 别名]
# 或者: from object_detection.protos.train_pb2 import TrainConfig [as 别名]
def get_configs_from_pipeline_file():
  """Reads training configuration from a pipeline_pb2.TrainEvalPipelineConfig.

  Reads training config from file specified by pipeline_config_path flag.

  Returns:
    model_config: model_pb2.DetectionModel
    train_config: train_pb2.TrainConfig
    input_config: input_reader_pb2.InputReader
  """
  pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
  with tf.gfile.GFile(FLAGS.pipeline_config_path, 'r') as f:
    text_format.Merge(f.read(), pipeline_config)

  model_config = pipeline_config.model.ssd
  train_config = pipeline_config.train_config
  input_config = pipeline_config.train_input_reader

  return model_config, train_config, input_config 
开发者ID:xiaobai1217,项目名称:MBMD,代码行数:21,代码来源:train_video.py

示例3: test_configure_trainer_and_train_two_steps

# 需要导入模块: from object_detection.protos import train_pb2 [as 别名]
# 或者: from object_detection.protos.train_pb2 import TrainConfig [as 别名]
def test_configure_trainer_and_train_two_steps(self):
    train_config_text_proto = """
    optimizer {
      adam_optimizer {
        learning_rate {
          constant_learning_rate {
            learning_rate: 0.01
          }
        }
      }
    }
    data_augmentation_options {
      random_adjust_brightness {
        max_delta: 0.2
      }
    }
    data_augmentation_options {
      random_adjust_contrast {
        min_delta: 0.7
        max_delta: 1.1
      }
    }
    num_steps: 2
    """
    train_config = train_pb2.TrainConfig()
    text_format.Merge(train_config_text_proto, train_config)

    train_dir = self.get_temp_dir()

    trainer.train(create_tensor_dict_fn=get_input_function,
                  create_model_fn=FakeDetectionModel,
                  train_config=train_config,
                  master='',
                  task=0,
                  num_clones=1,
                  worker_replicas=1,
                  clone_on_cpu=True,
                  ps_tasks=0,
                  worker_job_name='worker',
                  is_chief=True,
                  train_dir=train_dir) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:43,代码来源:trainer_test.py

示例4: get_configs_from_multiple_files

# 需要导入模块: from object_detection.protos import train_pb2 [as 别名]
# 或者: from object_detection.protos.train_pb2 import TrainConfig [as 别名]
def get_configs_from_multiple_files():
  """Reads training configuration from multiple config files.

  Reads the training config from the following files:
    model_config: Read from --model_config_path
    train_config: Read from --train_config_path
    input_config: Read from --input_config_path

  Returns:
    model_config: model_pb2.DetectionModel
    train_config: train_pb2.TrainConfig
    input_config: input_reader_pb2.InputReader
  """
  train_config = train_pb2.TrainConfig()
  with tf.gfile.GFile(FLAGS.train_config_path, 'r') as f:
    text_format.Merge(f.read(), train_config)

  model_config = model_pb2.DetectionModel()
  with tf.gfile.GFile(FLAGS.model_config_path, 'r') as f:
    text_format.Merge(f.read(), model_config)

  input_config = input_reader_pb2.InputReader()
  with tf.gfile.GFile(FLAGS.input_config_path, 'r') as f:
    text_format.Merge(f.read(), input_config)

  return model_config, train_config, input_config 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:28,代码来源:train.py

示例5: get_optimizer_type

# 需要导入模块: from object_detection.protos import train_pb2 [as 别名]
# 或者: from object_detection.protos.train_pb2 import TrainConfig [as 别名]
def get_optimizer_type(train_config):
  """Returns the optimizer type for training.

  Args:
    train_config: A train_pb2.TrainConfig.

  Returns:
    The type of the optimizer
  """
  return train_config.optimizer.WhichOneof("optimizer") 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:12,代码来源:config_util.py


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