本文整理匯總了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)
示例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