Python object_detection.utils.metrics.compute_cor_loc() Examples
The following are 30
code examples of object_detection.utils.metrics.compute_cor_loc().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
object_detection.utils.metrics
, or try the search function
.
Example #1
Source File: object_detection_evaluation.py From object_detection_kitti with Apache License 2.0 | 5 votes |
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)
Example #2
Source File: metrics_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
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))
Example #3
Source File: metrics_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
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)
Example #4
Source File: metrics_test.py From Elphas with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: metrics_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
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)
Example #6
Source File: metrics_test.py From open-solution-googleai-object-detection with MIT License | 5 votes |
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))
Example #7
Source File: metrics_test.py From open-solution-googleai-object-detection with MIT License | 5 votes |
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)
Example #8
Source File: metrics_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
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))
Example #9
Source File: metrics_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
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)
Example #10
Source File: metrics_test.py From models with Apache License 2.0 | 5 votes |
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))
Example #11
Source File: metrics_test.py From models with Apache License 2.0 | 5 votes |
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)
Example #12
Source File: metrics_test.py From motion-rcnn with MIT License | 5 votes |
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))
Example #13
Source File: metrics_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
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))
Example #14
Source File: metrics_test.py From MBMD with MIT License | 5 votes |
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)
Example #15
Source File: metrics_test.py From MBMD with MIT License | 5 votes |
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))
Example #16
Source File: object_detection_evaluation.py From MBMD with MIT License | 5 votes |
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)
Example #17
Source File: metrics_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
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)
Example #18
Source File: metrics_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
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))
Example #19
Source File: metrics_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
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)
Example #20
Source File: metrics_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
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))
Example #21
Source File: object_detection_evaluation.py From hands-detection with MIT License | 5 votes |
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)
Example #22
Source File: metrics_test.py From hands-detection with MIT License | 5 votes |
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)
Example #23
Source File: metrics_test.py From hands-detection with MIT License | 5 votes |
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))
Example #24
Source File: object_detection_evaluation.py From moveo_ros with MIT License | 5 votes |
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)
Example #25
Source File: metrics_test.py From moveo_ros with MIT License | 5 votes |
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)
Example #26
Source File: metrics_test.py From moveo_ros with MIT License | 5 votes |
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))
Example #27
Source File: metrics_test.py From DOTA_models with Apache License 2.0 | 5 votes |
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))
Example #28
Source File: metrics_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
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))
Example #29
Source File: metrics_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
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)
Example #30
Source File: metrics_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
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))