Python object_detection.core.box_list_ops.box_voting() Examples
The following are 30
code examples of object_detection.core.box_list_ops.box_voting().
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.core.box_list_ops
, or try the search function
.
Example #1
Source File: box_list_ops_test.py From object_detection_kitti with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #2
Source File: box_list_ops_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #3
Source File: box_list_ops_test.py From object_detector_app with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #4
Source File: box_list_ops_test.py From motion-rcnn with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #5
Source File: box_list_ops_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #6
Source File: box_list_ops_test.py From vehicle_counting_tensorflow with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #7
Source File: box_list_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #8
Source File: box_list_ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #9
Source File: box_list_ops_test.py From models with Apache License 2.0 | 6 votes |
def test_box_voting(self): def graph_fn(): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) return (averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] boxes_out, scores_out, extra_field_out = self.execute(graph_fn, []) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #10
Source File: box_list_ops_test.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #11
Source File: box_list_ops_test.py From HereIsWally with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #12
Source File: box_list_ops_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #13
Source File: box_list_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #14
Source File: box_list_ops_test.py From AniSeg with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #15
Source File: box_list_ops_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #16
Source File: box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #17
Source File: box_list_ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #18
Source File: box_list_ops_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #19
Source File: box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #20
Source File: box_list_ops_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #21
Source File: box_list_ops_test.py From Elphas with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #22
Source File: box_list_ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #23
Source File: box_list_ops_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #24
Source File: box_list_ops_test.py From moveo_ros with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #25
Source File: box_list_ops_test.py From MBMD with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #26
Source File: box_list_ops_test.py From hands-detection with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #27
Source File: box_list_ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
def test_box_voting(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32)) candidates.add_field('ExtraField', tf.constant([1, 2])) pool = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5], [0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.75, 0.25, 0.3])) averaged_boxes = box_list_ops.box_voting(candidates, pool) expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]] expected_scores = [0.5, 0.3] with self.test_session() as sess: boxes_out, scores_out, extra_field_out = sess.run( [averaged_boxes.get(), averaged_boxes.get_field('scores'), averaged_boxes.get_field('ExtraField')]) self.assertAllClose(expected_boxes, boxes_out) self.assertAllClose(expected_scores, scores_out) self.assertAllEqual(extra_field_out, [1, 2])
Example #28
Source File: box_list_ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_box_voting_fails_with_negative_scores(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32)) pool = box_list.BoxList(tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32)) pool.add_field('scores', tf.constant([-0.2])) averaged_boxes = box_list_ops.box_voting(candidates, pool) with self.test_session() as sess: with self.assertRaisesOpError('Scores must be non negative'): sess.run([averaged_boxes.get()])
Example #29
Source File: box_list_ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_box_voting_fails_when_unmatched(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32)) pool = box_list.BoxList(tf.constant([[0.6, 0.6, 0.8, 0.8]], tf.float32)) pool.add_field('scores', tf.constant([0.2])) averaged_boxes = box_list_ops.box_voting(candidates, pool) with self.test_session() as sess: with self.assertRaisesOpError('Each box in selected_boxes must match ' 'with at least one box in pool_boxes.'): sess.run([averaged_boxes.get()])
Example #30
Source File: box_list_ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_box_voting_fails_with_negative_scores(self): candidates = box_list.BoxList( tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32)) pool = box_list.BoxList(tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32)) pool.add_field('scores', tf.constant([-0.2])) averaged_boxes = box_list_ops.box_voting(candidates, pool) with self.test_session() as sess: with self.assertRaisesOpError('Scores must be non negative'): sess.run([averaged_boxes.get()])