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


Python metrics.compute_cor_loc方法代碼示例

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


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

示例1: test_compute_cor_loc

# 需要導入模塊: from object_detection.utils import metrics [as 別名]
# 或者: from object_detection.utils.metrics import compute_cor_loc [as 別名]
def test_compute_cor_loc(self):
    num_gt_imgs_per_class = np.array([100, 1, 5, 1, 1], dtype=int)
    num_images_correctly_detected_per_class = np.array([10, 0, 1, 0, 0],
                                                       dtype=int)
    corloc = metrics.compute_cor_loc(num_gt_imgs_per_class,
                                     num_images_correctly_detected_per_class)
    expected_corloc = np.array([0.1, 0, 0.2, 0, 0], dtype=float)
    self.assertTrue(np.allclose(corloc, expected_corloc)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:10,代碼來源:metrics_test.py

示例2: test_compute_cor_loc_nans

# 需要導入模塊: from object_detection.utils import metrics [as 別名]
# 或者: from object_detection.utils.metrics import compute_cor_loc [as 別名]
def test_compute_cor_loc_nans(self):
    num_gt_imgs_per_class = np.array([100, 0, 0, 1, 1], dtype=int)
    num_images_correctly_detected_per_class = np.array([10, 0, 1, 0, 0],
                                                       dtype=int)
    corloc = metrics.compute_cor_loc(num_gt_imgs_per_class,
                                     num_images_correctly_detected_per_class)
    expected_corloc = np.array([0.1, np.nan, np.nan, 0, 0], dtype=float)
    self.assertAllClose(corloc, expected_corloc) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:10,代碼來源:metrics_test.py

示例3: evaluate

# 需要導入模塊: from object_detection.utils import metrics [as 別名]
# 或者: from object_detection.utils.metrics import compute_cor_loc [as 別名]
def evaluate(self):
    """Compute evaluation result.

    Returns:
      average_precision_per_class: float numpy array of average precision for
          each class.
      mean_ap: mean average precision of all classes, float scalar
      precisions_per_class: List of precisions, each precision is a float numpy
          array
      recalls_per_class: List of recalls, each recall is a float numpy array
      corloc_per_class: numpy float array
      mean_corloc: Mean CorLoc score for each class, float scalar
    """
    if (self.num_gt_instances_per_class == 0).any():
      logging.warn(
          'The following classes have no ground truth examples: %s',
          np.squeeze(np.argwhere(self.num_gt_instances_per_class == 0)))
    for class_index in range(self.num_class):
      if self.num_gt_instances_per_class[class_index] == 0:
        continue
      scores = np.concatenate(self.scores_per_class[class_index])
      tp_fp_labels = np.concatenate(self.tp_fp_labels_per_class[class_index])
      precision, recall = metrics.compute_precision_recall(
          scores, tp_fp_labels, self.num_gt_instances_per_class[class_index])
      self.precisions_per_class.append(precision)
      self.recalls_per_class.append(recall)
      average_precision = metrics.compute_average_precision(precision, recall)
      self.average_precision_per_class[class_index] = average_precision

    self.corloc_per_class = metrics.compute_cor_loc(
        self.num_gt_imgs_per_class,
        self.num_images_correctly_detected_per_class)

    mean_ap = np.nanmean(self.average_precision_per_class)
    mean_corloc = np.nanmean(self.corloc_per_class)
    return (self.average_precision_per_class, mean_ap,
            self.precisions_per_class, self.recalls_per_class,
            self.corloc_per_class, mean_corloc) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:40,代碼來源:object_detection_evaluation.py

示例4: test_compute_cor_loc

# 需要導入模塊: from object_detection.utils import metrics [as 別名]
# 或者: from object_detection.utils.metrics import compute_cor_loc [as 別名]
def test_compute_cor_loc(self):
    num_gt_imgs_per_class = np.array([100, 1, 5, 1, 1], dtype=int)
    num_images_correctly_detected_per_class = np.array(
        [10, 0, 1, 0, 0], dtype=int)
    corloc = metrics.compute_cor_loc(num_gt_imgs_per_class,
                                     num_images_correctly_detected_per_class)
    expected_corloc = np.array([0.1, 0, 0.2, 0, 0], dtype=float)
    self.assertTrue(np.allclose(corloc, expected_corloc)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:10,代碼來源:metrics_test.py

示例5: test_compute_cor_loc_nans

# 需要導入模塊: from object_detection.utils import metrics [as 別名]
# 或者: from object_detection.utils.metrics import compute_cor_loc [as 別名]
def test_compute_cor_loc_nans(self):
    num_gt_imgs_per_class = np.array([100, 0, 0, 1, 1], dtype=int)
    num_images_correctly_detected_per_class = np.array(
        [10, 0, 1, 0, 0], dtype=int)
    corloc = metrics.compute_cor_loc(num_gt_imgs_per_class,
                                     num_images_correctly_detected_per_class)
    expected_corloc = np.array([0.1, np.nan, np.nan, 0, 0], dtype=float)
    self.assertAllClose(corloc, expected_corloc) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:10,代碼來源:metrics_test.py


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