Beispiel #1
0
  def test_invalid_box_data(self):
    with self.assertRaises(ValueError):
      np_box_list.BoxList([0, 0, 1, 1])

    with self.assertRaises(ValueError):
      np_box_list.BoxList(np.array([[0, 0, 1, 1]], dtype=int))

    with self.assertRaises(ValueError):
      np_box_list.BoxList(np.array([0, 1, 1, 3, 4], dtype=float))

    with self.assertRaises(ValueError):
      np_box_list.BoxList(np.array([[0, 1, 1, 3], [3, 1, 1, 5]], dtype=float))
Beispiel #2
0
 def test_get_field_with_nonexited_field(self):
   boxes = np.array([[3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0],
                     [0.0, 0.0, 20.0, 20.0]],
                    dtype=float)
   boxlist = np_box_list.BoxList(boxes)
   with self.assertRaises(ValueError):
     boxlist.get_field('scores')
Beispiel #3
0
 def test_get_field_with_existed_field(self):
   boxes = np.array([[3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0],
                     [0.0, 0.0, 20.0, 20.0]],
                    dtype=float)
   boxlist = np_box_list.BoxList(boxes)
   self.assertTrue(np.allclose(boxlist.get_field('boxes'), boxes))
Beispiel #4
0
 def test_has_field_with_nonexisted_field(self):
   boxes = np.array([[3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0],
                     [0.0, 0.0, 20.0, 20.0]],
                    dtype=float)
   boxlist = np_box_list.BoxList(boxes)
   self.assertFalse(boxlist.has_field('scores'))
Beispiel #5
0
 def test_num_boxes(self):
   boxes = np.array([[0., 0., 100., 100.], [10., 30., 50., 70.]], dtype=float)
   boxlist = np_box_list.BoxList(boxes)
   expected_num_boxes = 2
   self.assertEquals(boxlist.num_boxes(), expected_num_boxes)