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


Python vrd_evaluation.VRDPhraseDetectionEvaluator方法代碼示例

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


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

示例1: main

# 需要導入模塊: from object_detection.utils import vrd_evaluation [as 別名]
# 或者: from object_detection.utils.vrd_evaluation import VRDPhraseDetectionEvaluator [as 別名]
def main(parsed_args):
  all_box_annotations = pd.read_csv(parsed_args.input_annotations_boxes)
  all_label_annotations = pd.read_csv(parsed_args.input_annotations_labels)
  all_annotations = pd.concat([all_box_annotations, all_label_annotations])

  class_label_map = _load_labelmap(parsed_args.input_class_labelmap)
  relationship_label_map = _load_labelmap(
      parsed_args.input_relationship_labelmap)

  relation_evaluator = vrd_evaluation.VRDRelationDetectionEvaluator()
  phrase_evaluator = vrd_evaluation.VRDPhraseDetectionEvaluator()

  for _, groundtruth in enumerate(all_annotations.groupby('ImageID')):
    image_id, image_groundtruth = groundtruth
    groundtruth_dictionary = utils.build_groundtruth_vrd_dictionary(
        image_groundtruth, class_label_map, relationship_label_map)

    relation_evaluator.add_single_ground_truth_image_info(
        image_id, groundtruth_dictionary)
    phrase_evaluator.add_single_ground_truth_image_info(image_id,
                                                        groundtruth_dictionary)

  all_predictions = pd.read_csv(parsed_args.input_predictions)
  for _, prediction_data in enumerate(all_predictions.groupby('ImageID')):
    image_id, image_predictions = prediction_data
    prediction_dictionary = utils.build_predictions_vrd_dictionary(
        image_predictions, class_label_map, relationship_label_map)

    relation_evaluator.add_single_detected_image_info(image_id,
                                                      prediction_dictionary)
    phrase_evaluator.add_single_detected_image_info(image_id,
                                                    prediction_dictionary)

  relation_metrics = relation_evaluator.evaluate(
      relationships=_swap_labelmap_dict(relationship_label_map))
  phrase_metrics = phrase_evaluator.evaluate(
      relationships=_swap_labelmap_dict(relationship_label_map))

  with open(parsed_args.output_metrics, 'w') as fid:
    io_utils.write_csv(fid, relation_metrics)
    io_utils.write_csv(fid, phrase_metrics) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:43,代碼來源:oid_vrd_challenge_evaluation.py

示例2: main

# 需要導入模塊: from object_detection.utils import vrd_evaluation [as 別名]
# 或者: from object_detection.utils.vrd_evaluation import VRDPhraseDetectionEvaluator [as 別名]
def main(parsed_args):
  all_box_annotations = pd.read_csv(parsed_args.input_annotations_boxes)
  all_label_annotations = pd.read_csv(parsed_args.input_annotations_labels)
  all_annotations = pd.concat([all_box_annotations, all_label_annotations])

  class_label_map = _load_labelmap(parsed_args.input_class_labelmap)
  relationship_label_map = _load_labelmap(
      parsed_args.input_relationship_labelmap)

  relation_evaluator = vrd_evaluation.VRDRelationDetectionEvaluator()
  phrase_evaluator = vrd_evaluation.VRDPhraseDetectionEvaluator()

  for _, groundtruth in enumerate(all_annotations.groupby('ImageID')):
    image_id, image_groundtruth = groundtruth
    groundtruth_dictionary = utils.build_groundtruth_vrd_dictionary(
        image_groundtruth, class_label_map, relationship_label_map)

    relation_evaluator.add_single_ground_truth_image_info(
        image_id, groundtruth_dictionary)
    phrase_evaluator.add_single_ground_truth_image_info(image_id,
                                                        groundtruth_dictionary)

  all_predictions = pd.read_csv(parsed_args.input_predictions)
  for _, prediction_data in enumerate(all_predictions.groupby('ImageID')):
    image_id, image_predictions = prediction_data
    prediction_dictionary = utils.build_predictions_vrd_dictionary(
        image_predictions, class_label_map, relationship_label_map)

    relation_evaluator.add_single_detected_image_info(image_id,
                                                      prediction_dictionary)
    phrase_evaluator.add_single_detected_image_info(image_id,
                                                    prediction_dictionary)

  relation_metrics = relation_evaluator.evaluate()
  phrase_metrics = phrase_evaluator.evaluate()

  with open(parsed_args.output_metrics, 'w') as fid:
    utils.write_csv(fid, relation_metrics)
    utils.write_csv(fid, phrase_metrics) 
開發者ID:ambakick,項目名稱:Person-Detection-and-Tracking,代碼行數:41,代碼來源:oid_vrd_challenge_evaluation.py


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