示例#1
0
 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)
示例#2
0
 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)