Python object_detection.utils.per_image_evaluation.PerImageEvaluation() Examples
The following are 30
code examples of object_detection.utils.per_image_evaluation.PerImageEvaluation().
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.per_image_evaluation
, or try the search function
.
Example #1
Source File: per_image_evaluation_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #2
Source File: per_image_evaluation_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #3
Source File: per_image_evaluation_test.py From object_detector_app with MIT License | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #4
Source File: per_image_evaluation_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #5
Source File: per_image_evaluation_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #6
Source File: per_image_evaluation_test.py From object_detector_app with MIT License | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #7
Source File: per_image_evaluation_test.py From object_detector_app with MIT License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #8
Source File: per_image_evaluation_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #9
Source File: per_image_evaluation_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #10
Source File: per_image_evaluation_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #11
Source File: per_image_evaluation_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #12
Source File: per_image_evaluation_test.py From vehicle_counting_tensorflow with MIT License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #13
Source File: per_image_evaluation_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #14
Source File: per_image_evaluation_test.py From HereIsWally with MIT License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #15
Source File: per_image_evaluation_test.py From HereIsWally with MIT License | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #16
Source File: per_image_evaluation_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #17
Source File: per_image_evaluation_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #18
Source File: per_image_evaluation_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #19
Source File: per_image_evaluation_test.py From HereIsWally with MIT License | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #20
Source File: per_image_evaluation_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #21
Source File: per_image_evaluation_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #22
Source File: per_image_evaluation_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #23
Source File: per_image_evaluation_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
def test_compute_corloc_with_very_large_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.9 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 0], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #24
Source File: per_image_evaluation_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def test_compute_corloc_with_normal_iou_threshold(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3], [0, 0, 5, 5]], dtype=float) detected_scores = np.array([0.9, 0.9, 0.1, 0.9], dtype=float) detected_class_labels = np.array([0, 1, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3, 3], [0, 0, 6, 6]], dtype=float) groundtruth_class_labels = np.array([0, 0, 2], dtype=int) is_class_correctly_detected_in_image = eval1._compute_cor_loc( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels) expected_result = np.array([1, 0, 1], dtype=int) self.assertTrue(np.array_equal(expected_result, is_class_correctly_detected_in_image))
Example #25
Source File: per_image_evaluation_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #26
Source File: per_image_evaluation_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold1 = 0.5 matching_iou_threshold2 = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval1 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold1, nms_iou_threshold, nms_max_output_boxes) self.eval2 = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold2, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float)
Example #27
Source File: per_image_evaluation_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 5 votes |
def test_tp_fp(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [10, 10, 5, 5], [0, 0, 2, 2], [5, 10, 10, 5], [10, 5, 5, 10], [0, 0, 3, 3]], dtype=float) detected_scores = np.array([0.8, 0.1, 0.8, 0.9, 0.7, 0.8], dtype=float) detected_class_labels = np.array([0, 1, 1, 2, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3.5, 3.5]], dtype=float) groundtruth_class_labels = np.array([0, 2], dtype=int) groundtruth_groundtruth_is_difficult_list = np.zeros(2, dtype=float) scores, tp_fp_labels, _ = eval1.compute_object_detection_metrics( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels, groundtruth_groundtruth_is_difficult_list) expected_scores = [np.array([0.8], dtype=float)] * 3 expected_tp_fp_labels = [np.array([True]), np.array([False]), np.array([True ])] for i in range(len(expected_scores)): self.assertTrue(np.allclose(expected_scores[i], scores[i])) self.assertTrue(np.array_equal(expected_tp_fp_labels[i], tp_fp_labels[i]))
Example #28
Source File: per_image_evaluation_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 5 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float) self.groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 10, 10]], dtype=float)
Example #29
Source File: per_image_evaluation_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def setUp(self): num_groundtruth_classes = 1 matching_iou_threshold_high_iou = 0.5 matching_iou_threshold_low_iou = 0.1 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 self.eval_high_iou = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold_high_iou, nms_iou_threshold, nms_max_output_boxes) self.eval_low_iou = per_image_evaluation.PerImageEvaluation( num_groundtruth_classes, matching_iou_threshold_low_iou, nms_iou_threshold, nms_max_output_boxes) self.detected_boxes = np.array([[0, 0, 1, 1], [0, 0, 2, 2], [0, 0, 3, 3]], dtype=float) self.detected_scores = np.array([0.6, 0.8, 0.5], dtype=float) detected_masks_0 = np.array([[0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 0, 0]], dtype=np.uint8) detected_masks_1 = np.array([[1, 0, 0, 0], [1, 1, 0, 0], [0, 0, 0, 0]], dtype=np.uint8) detected_masks_2 = np.array([[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 0, 0]], dtype=np.uint8) self.detected_masks = np.stack( [detected_masks_0, detected_masks_1, detected_masks_2], axis=0)
Example #30
Source File: per_image_evaluation_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 5 votes |
def test_tp_fp(self): num_groundtruth_classes = 3 matching_iou_threshold = 0.5 nms_iou_threshold = 1.0 nms_max_output_boxes = 10000 eval1 = per_image_evaluation.PerImageEvaluation(num_groundtruth_classes, matching_iou_threshold, nms_iou_threshold, nms_max_output_boxes) detected_boxes = np.array([[0, 0, 1, 1], [10, 10, 5, 5], [0, 0, 2, 2], [5, 10, 10, 5], [10, 5, 5, 10], [0, 0, 3, 3]], dtype=float) detected_scores = np.array([0.8, 0.1, 0.8, 0.9, 0.7, 0.8], dtype=float) detected_class_labels = np.array([0, 1, 1, 2, 0, 2], dtype=int) groundtruth_boxes = np.array([[0, 0, 1, 1], [0, 0, 3.5, 3.5]], dtype=float) groundtruth_class_labels = np.array([0, 2], dtype=int) groundtruth_groundtruth_is_difficult_list = np.zeros(2, dtype=float) groundtruth_groundtruth_is_group_of_list = np.array( [False, False], dtype=bool) scores, tp_fp_labels, _ = eval1.compute_object_detection_metrics( detected_boxes, detected_scores, detected_class_labels, groundtruth_boxes, groundtruth_class_labels, groundtruth_groundtruth_is_difficult_list, groundtruth_groundtruth_is_group_of_list) expected_scores = [np.array([0.8], dtype=float)] * 3 expected_tp_fp_labels = [np.array([True]), np.array([False]), np.array([True ])] for i in range(len(expected_scores)): self.assertTrue(np.allclose(expected_scores[i], scores[i])) self.assertTrue(np.array_equal(expected_tp_fp_labels[i], tp_fp_labels[i]))