Ejemplo n.º 1
0
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: coloc_model_pb2.CoLocDetectionModel
    train_config: train_pb2.TrainConfig
    input_config: coloc_input_reader_pb2.CoLocInputReader
  """
    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 = attention_model_pb2.AttentionModel()
    with tf.gfile.GFile(FLAGS.model_config_path, 'r') as f:
        text_format.Merge(f.read(), model_config)

    input_config = coloc_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
Ejemplo n.º 2
0
def get_configs_from_multiple_files():
    """Reads evaluation configuration from multiple config files.

  Reads the evaluation config from the following files:
    model_config: Read from --model_config_path
    eval_config: Read from --eval_config_path
    input_config: Read from --input_config_path

  Returns:
    model_config: a model_pb2.DetectionModel
    eval_config: a eval_pb2.EvalConfig
    input_config: a input_reader_pb2.InputReader
  """
    eval_config = coloc_eval_pb2.EvalConfig()
    with tf.gfile.GFile(FLAGS.eval_config_path, 'r') as f:
        text_format.Merge(f.read(), eval_config)

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

    input_config = coloc_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, eval_config, input_config