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


Python label_map_util.load_labelmap方法代碼示例

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


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

示例1: main

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def main(unused_argv):
  assert FLAGS.checkpoint_dir, '`checkpoint_dir` is missing.'
  assert FLAGS.eval_dir, '`eval_dir` is missing.'
  if FLAGS.pipeline_config_path:
    model_config, eval_config, input_config = get_configs_from_pipeline_file()
  else:
    model_config, eval_config, input_config = get_configs_from_multiple_files()

  model_fn = functools.partial(
      model_builder.build,
      model_config=model_config,
      is_training=False)

  create_input_dict_fn = functools.partial(
      input_reader_builder.build,
      input_config)

  label_map = label_map_util.load_labelmap(input_config.label_map_path)
  max_num_classes = max([item.id for item in label_map.item])
  categories = label_map_util.convert_label_map_to_categories(
      label_map, max_num_classes)

  evaluator.evaluate(create_input_dict_fn, model_fn, eval_config, categories,
                     FLAGS.checkpoint_dir, FLAGS.eval_dir) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:26,代碼來源:eval.py

示例2: test_load_bad_label_map

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def test_load_bad_label_map(self):
    label_map_string = """
      item {
        id:0
        name:'class that should not be indexed at zero'
      }
      item {
        id:2
        name:'cat'
      }
      item {
        id:1
        name:'dog'
      }
    """
    label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
    with tf.gfile.Open(label_map_path, 'wb') as f:
      f.write(label_map_string)

    with self.assertRaises(ValueError):
      label_map_util.load_labelmap(label_map_path) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:23,代碼來源:label_map_util_test.py

示例3: load_model

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def load_model(self):
        """
        Loads the detection model

        Args:

        Returns:

        """

        with self._detection_graph.as_default():
            od_graph_def = tf.GraphDef()
            with tf.gfile.GFile(self._path_to_ckpt, 'rb') as fid:
                serialized_graph = fid.read()
                od_graph_def.ParseFromString(serialized_graph)
                tf.import_graph_def(od_graph_def, name='')

        label_map = label_map_util.load_labelmap(self._path_to_labels)
        categories = label_map_util.convert_label_map_to_categories(\
            label_map, max_num_classes=self._num_classes, use_display_name=True)
        self.category_index = label_map_util.create_category_index(categories) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:23,代碼來源:detector.py

示例4: evaluate

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def evaluate(self, eval_pipeline_file, model_dir, eval_dir):
        configs = self._get_configs_from_pipeline_file(eval_pipeline_file)
        model_config = configs['model']
        eval_config = configs['eval_config']
        input_config = configs['eval_input_config']
        model_fn = functools.partial(
            model_builder.build,
            model_config=model_config,
            is_training=True)
        create_input_dict_fn = functools.partial(self.get_next, input_config)
        label_map = label_map_util.load_labelmap(input_config.label_map_path)
        max_num_classes = max([item.id for item in label_map.item])
        categories = label_map_util.convert_label_map_to_categories(
                        label_map, max_num_classes)
        evaluator.evaluate(create_input_dict_fn, model_fn, eval_config, categories,
                        model_dir, eval_dir) 
開發者ID:autoai-org,項目名稱:CVTron,代碼行數:18,代碼來源:object_detection_trainer.py

示例5: main

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def main(unused_argv):
  assert FLAGS.checkpoint_dir, '`checkpoint_dir` is missing.'
  assert FLAGS.eval_dir, '`eval_dir` is missing.'
  model_config, train_config, input_config, eval_config = get_configs_from_pipeline_file()

  model_fn = functools.partial(
      build_man_model,
      model_config=model_config,
      is_training=False)

  create_input_dict_fn = functools.partial(
      input_reader_builder.build,
      input_config)

  label_map = label_map_util.load_labelmap(input_config.label_map_path)
  max_num_classes = max([item.id for item in label_map.item])
  categories = label_map_util.convert_label_map_to_categories(
      label_map, max_num_classes)

  evaluator.evaluate(create_input_dict_fn, model_fn, eval_config, categories,
                     FLAGS.checkpoint_dir, FLAGS.eval_dir) 
開發者ID:xiaobai1217,項目名稱:MBMD,代碼行數:23,代碼來源:eval.py

示例6: main

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def main(unused_argv):
  assert FLAGS.checkpoint_dir, '`checkpoint_dir` is missing.'
  assert FLAGS.eval_dir, '`eval_dir` is missing.'
  model_config, train_config, input_config, eval_config = get_configs_from_pipeline_file()

  model_fn = functools.partial(
      build_man_model,
      model_config=model_config,
      is_training=False)

  create_input_dict_fn = functools.partial(
      input_reader.read_seq, input_config)

  label_map = label_map_util.load_labelmap(input_config.label_map_path)
  max_num_classes = max([item.id for item in label_map.item])
  categories = label_map_util.convert_label_map_to_categories(
      label_map, max_num_classes)

  visualizer_seq.evaluate(create_input_dict_fn, model_fn, eval_config, categories,
                     FLAGS.checkpoint_dir, FLAGS.eval_dir, FLAGS.image_root) 
開發者ID:xiaobai1217,項目名稱:MBMD,代碼行數:22,代碼來源:visualize_seq.py

示例7: main

# 需要導入模塊: from object_detection.utils import label_map_util [as 別名]
# 或者: from object_detection.utils.label_map_util import load_labelmap [as 別名]
def main(unused_argv):
  assert FLAGS.checkpoint_dir, '`checkpoint_dir` is missing.'
  assert FLAGS.eval_dir, '`eval_dir` is missing.'
  model_config, train_config, input_config, eval_config = get_configs_from_pipeline_file()

  model_fn = functools.partial(
      build_man_model,
      model_config=model_config,
      is_training=False)

  create_input_dict_fn = functools.partial(
      input_reader.read,
      input_config)

  label_map = label_map_util.load_labelmap(input_config.label_map_path)
  max_num_classes = max([item.id for item in label_map.item])
  categories = label_map_util.convert_label_map_to_categories(
      label_map, max_num_classes)

  visualizer.evaluate(create_input_dict_fn, model_fn, eval_config, categories,
                     FLAGS.checkpoint_dir, FLAGS.eval_dir, FLAGS.image_root) 
開發者ID:xiaobai1217,項目名稱:MBMD,代碼行數:23,代碼來源:visualize_res.py


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