Python object_detection.utils.config_util.update_input_reader_config() Examples

The following are 12 code examples of object_detection.utils.config_util.update_input_reader_config(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module object_detection.utils.config_util , or try the search function .
Example #1
Source File: config_util_test.py    From vehicle_counting_tensorflow with MIT License 6 votes vote down vote up
def testUpdateInputReaderConfigSuccess(self):
    original_shuffle = False
    new_shuffle = True
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.train_input_reader.shuffle = original_shuffle
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle) 
Example #2
Source File: config_util_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 6 votes vote down vote up
def testUpdateInputReaderConfigSuccess(self):
    original_shuffle = False
    new_shuffle = True
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.train_input_reader.shuffle = original_shuffle
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle) 
Example #3
Source File: config_util_test.py    From MAX-Object-Detector with Apache License 2.0 6 votes vote down vote up
def testUpdateInputReaderConfigSuccess(self):
    original_shuffle = False
    new_shuffle = True
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.train_input_reader.shuffle = original_shuffle
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle) 
Example #4
Source File: config_util_test.py    From g-tensorflow-models with Apache License 2.0 6 votes vote down vote up
def testUpdateInputReaderConfigSuccess(self):
    original_shuffle = False
    new_shuffle = True
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.train_input_reader.shuffle = original_shuffle
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle) 
Example #5
Source File: config_util_test.py    From models with Apache License 2.0 6 votes vote down vote up
def testUpdateInputReaderConfigSuccess(self):
    original_shuffle = False
    new_shuffle = True
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.train_input_reader.shuffle = original_shuffle
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle) 
Example #6
Source File: config_util_test.py    From multilabel-image-classification-tensorflow with MIT License 6 votes vote down vote up
def testUpdateInputReaderConfigSuccess(self):
    original_shuffle = False
    new_shuffle = True
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.train_input_reader.shuffle = original_shuffle
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle)

    config_util.update_input_reader_config(
        configs,
        key_name="train_input_config",
        input_name=None,
        field_name="shuffle",
        value=new_shuffle)
    self.assertEqual(configs["train_input_config"].shuffle, new_shuffle) 
Example #7
Source File: config_util_test.py    From vehicle_counting_tensorflow with MIT License 5 votes vote down vote up
def testUpdateInputReaderConfigErrors(self):
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    with self.assertRaisesRegexp(ValueError,
                                 "Duplicate input name found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="same_eval_name",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(
        ValueError, "Input name name_not_exist not found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="name_not_exist",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(ValueError,
                                 "Unknown input config overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name=None,
          field_name="shuffle",
          value=False) 
Example #8
Source File: config_util_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def testUpdateInputReaderConfigErrors(self):
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    with self.assertRaisesRegexp(ValueError,
                                 "Duplicate input name found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="same_eval_name",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(
        ValueError, "Input name name_not_exist not found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="name_not_exist",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(ValueError,
                                 "Unknown input config overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name=None,
          field_name="shuffle",
          value=False) 
Example #9
Source File: config_util_test.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def testUpdateInputReaderConfigErrors(self):
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    with self.assertRaisesRegexp(ValueError,
                                 "Duplicate input name found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="same_eval_name",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(
        ValueError, "Input name name_not_exist not found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="name_not_exist",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(ValueError,
                                 "Unknown input config overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name=None,
          field_name="shuffle",
          value=False) 
Example #10
Source File: config_util_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def testUpdateInputReaderConfigErrors(self):
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    with self.assertRaisesRegexp(ValueError,
                                 "Duplicate input name found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="same_eval_name",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(
        ValueError, "Input name name_not_exist not found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="name_not_exist",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(ValueError,
                                 "Unknown input config overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name=None,
          field_name="shuffle",
          value=False) 
Example #11
Source File: config_util_test.py    From models with Apache License 2.0 5 votes vote down vote up
def testUpdateInputReaderConfigErrors(self):
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    with self.assertRaisesRegexp(ValueError,
                                 "Duplicate input name found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="same_eval_name",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(
        ValueError, "Input name name_not_exist not found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="name_not_exist",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(ValueError,
                                 "Unknown input config overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name=None,
          field_name="shuffle",
          value=False) 
Example #12
Source File: config_util_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def testUpdateInputReaderConfigErrors(self):
    pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
    pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    pipeline_config.eval_input_reader.add().name = "same_eval_name"
    _write_config(pipeline_config, pipeline_config_path)
    configs = config_util.get_configs_from_pipeline_file(pipeline_config_path)

    with self.assertRaisesRegexp(ValueError,
                                 "Duplicate input name found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="same_eval_name",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(
        ValueError, "Input name name_not_exist not found when overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name="name_not_exist",
          field_name="shuffle",
          value=False)

    with self.assertRaisesRegexp(ValueError,
                                 "Unknown input config overriding."):
      config_util.update_input_reader_config(
          configs,
          key_name="eval_input_configs",
          input_name=None,
          field_name="shuffle",
          value=False)