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


Python object_detection_evaluation.OpenImagesDetectionChallengeEvaluator方法代碼示例

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


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

示例1: main

# 需要導入模塊: from object_detection.utils import object_detection_evaluation [as 別名]
# 或者: from object_detection.utils.object_detection_evaluation import OpenImagesDetectionChallengeEvaluator [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_label_annotations.rename(
      columns={'Confidence': 'ConfidenceImageLabel'}, inplace=True)
  all_annotations = pd.concat([all_box_annotations, all_label_annotations])

  class_label_map, categories = _load_labelmap(parsed_args.input_class_labelmap)
  challenge_evaluator = (
      object_detection_evaluation.OpenImagesDetectionChallengeEvaluator(
          categories))

  for _, groundtruth in enumerate(all_annotations.groupby('ImageID')):
    image_id, image_groundtruth = groundtruth
    groundtruth_dictionary = utils.build_groundtruth_boxes_dictionary(
        image_groundtruth, class_label_map)
    challenge_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_dictionary(
        image_predictions, class_label_map)
    challenge_evaluator.add_single_detected_image_info(image_id,
                                                       prediction_dictionary)

  metrics = challenge_evaluator.evaluate()

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

示例2: main

# 需要導入模塊: from object_detection.utils import object_detection_evaluation [as 別名]
# 或者: from object_detection.utils.object_detection_evaluation import OpenImagesDetectionChallengeEvaluator [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_label_annotations.rename(
        columns={'Confidence': 'ConfidenceImageLabel'}, inplace=True)
    all_annotations = pd.concat([all_box_annotations, all_label_annotations])

    class_label_map, categories = _load_labelmap(parsed_args.input_class_labelmap)
    challenge_evaluator = (
        object_detection_evaluation.OpenImagesDetectionChallengeEvaluator(
            categories))

    for _, groundtruth in enumerate(all_annotations.groupby('ImageID')):
        image_id, image_groundtruth = groundtruth
        groundtruth_dictionary = utils.build_groundtruth_boxes_dictionary(
            image_groundtruth, class_label_map)
        challenge_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_dictionary(
            image_predictions, class_label_map)
        challenge_evaluator.add_single_detected_image_info(image_id,
                                                           prediction_dictionary)

    metrics = challenge_evaluator.evaluate()

    with open(parsed_args.output_metrics, 'w') as fid:
        io_utils.write_csv(fid, metrics) 
開發者ID:minerva-ml,項目名稱:open-solution-googleai-object-detection,代碼行數:34,代碼來源:oid_od_challenge_evaluation.py


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