def graph_fn(): boxes = [[0., 0., 1., 1.], [-1., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) coverage_box = box_list_ops.get_minimal_coverage_box(boxlist) return coverage_box
def test_get_minimal_coverage_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) coverage_box = box_list_ops.get_minimal_coverage_box(boxlist) with self.test_session() as sess: coverage_box_out = sess.run(coverage_box) self.assertAllClose([[0.0, 0.0, 1.0, 1.0]], coverage_box_out)
def test_get_minimal_coverage_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) coverage_box = box_list_ops.get_minimal_coverage_box(boxlist) with self.test_session() as sess: coverage_box_out = sess.run(coverage_box) self.assertAllClose([[0.0, 0.0, 1.0, 1.0]], coverage_box_out)
def test_get_minimal_coverage_box(self): boxes = [[0., 0., 1., 1.], [-1., 1., 2., 3.], [0., 2., 3., 4.]] expected_coverage_box = [[-1., 0., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) coverage_box = box_list_ops.get_minimal_coverage_box(boxlist) with self.test_session() as sess: coverage_box_out = sess.run(coverage_box) self.assertAllClose(expected_coverage_box, coverage_box_out)
def test_get_minimal_coverage_box(self): boxes = [[0., 0., 1., 1.], [-1., 1., 2., 3.], [0., 2., 3., 4.]] expected_coverage_box = [[-1., 0., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) coverage_box = box_list_ops.get_minimal_coverage_box(boxlist) with self.test_session() as sess: coverage_box_out = sess.run(coverage_box) self.assertAllClose(expected_coverage_box, coverage_box_out)
def graph_fn(): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) coverage_box = box_list_ops.get_minimal_coverage_box(boxlist) return coverage_box