Python object_detection.core.box_list_ops.prune_small_boxes() Examples
The following are 30
code examples of object_detection.core.box_list_ops.prune_small_boxes().
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 models with Apache License 2.0 | 6 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): def graph_fn(): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) return pruned_boxes.get() exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] pruned_boxes = self.execute_cpu(graph_fn, []) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #2
Source File: box_list_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #3
Source File: box_list_ops_test.py From hands-detection with MIT License | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #4
Source File: box_list_ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #5
Source File: box_list_ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #6
Source File: box_list_ops_test.py From MBMD with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #7
Source File: box_list_ops_test.py From MBMD with MIT License | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #8
Source File: box_list_ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #9
Source File: box_list_ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #10
Source File: box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #11
Source File: box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #12
Source File: box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #13
Source File: box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #14
Source File: box_list_ops_test.py From monopsr with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #15
Source File: box_list_ops_test.py From monopsr with MIT License | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #16
Source File: box_list_ops_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #17
Source File: box_list_ops_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #18
Source File: box_list_ops_test.py From hands-detection with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #19
Source File: box_list_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #20
Source File: box_list_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #21
Source File: box_list_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #22
Source File: box_list_ops_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #23
Source File: box_list_ops_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #24
Source File: inputs.py From models with Apache License 2.0 | 5 votes |
def assert_or_prune_invalid_boxes(boxes): """Makes sure boxes have valid sizes (ymax >= ymin, xmax >= xmin). When the hardware supports assertions, the function raises an error when boxes have an invalid size. If assertions are not supported (e.g. on TPU), boxes with invalid sizes are filtered out. Args: boxes: float tensor of shape [num_boxes, 4] Returns: boxes: float tensor of shape [num_valid_boxes, 4] with invalid boxes filtered out. Raises: tf.errors.InvalidArgumentError: When we detect boxes with invalid size. This is not supported on TPUs. """ ymin, xmin, ymax, xmax = tf.split( boxes, num_or_size_splits=4, axis=1) height_check = tf.Assert(tf.reduce_all(ymax >= ymin), [ymin, ymax]) width_check = tf.Assert(tf.reduce_all(xmax >= xmin), [xmin, xmax]) with tf.control_dependencies([height_check, width_check]): boxes_tensor = tf.concat([ymin, xmin, ymax, xmax], axis=1) boxlist = box_list.BoxList(boxes_tensor) # TODO(b/149221748) Remove pruning when XLA supports assertions. boxlist = box_list_ops.prune_small_boxes(boxlist, 0) return boxlist.get()
Example #25
Source File: box_list_ops_test.py From models with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): def graph_fn(): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) return pruned_boxes.get() exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] pruned_boxes = self.execute(graph_fn, []) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #26
Source File: box_list_ops_test.py From motion-rcnn with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #27
Source File: box_list_ops_test.py From motion-rcnn with MIT License | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #28
Source File: box_list_ops_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #29
Source File: box_list_ops_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def test_prune_small_boxes_prunes_boxes_with_negative_side(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0], [2.0, 3.0, 1.5, 7.0], # negative height [2.0, 3.0, 5.0, 1.7]]) # negative width exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)
Example #30
Source File: box_list_ops_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def test_prune_small_boxes(self): boxes = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0], [3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], [0.0, 0.0, 20.0, 20.0]]) exp_boxes = [[3.0, 4.0, 6.0, 8.0], [0.0, 0.0, 20.0, 20.0]] boxes = box_list.BoxList(boxes) pruned_boxes = box_list_ops.prune_small_boxes(boxes, 3) with self.test_session() as sess: pruned_boxes = sess.run(pruned_boxes.get()) self.assertAllEqual(pruned_boxes, exp_boxes)