Ejemplo n.º 1
0
 def test_compute_bboxes_from_scoremaps_degenerate(self):
     scoremap = np.zeros([3, 3], dtype=np.float)
     scoremap_threshold_list = np.arange(0, 1, 0.2)
     boxes = compute_bboxes_from_scoremaps(scoremap,
                                           scoremap_threshold_list)
     self.assertListEqual(boxes, [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
                                  [0, 0, 0, 0], [0, 0, 0, 0]])
Ejemplo n.º 2
0
 def test_compute_bboxes_from_scoremaps_multimodal(self):
     # array has shape array[y][x]
     scoremap = np.array(
         [[0.4, 0.0, 0.2, 0.2, 0.2], [0.4, 0.4, 0.0, 0.4, 0.0],
          [0.0, 0.0, 0.0, 0.4, 0.0], [1.0, 0.6, 0.8, 0.2, 0.2]],
         dtype=np.float)
     scoremap_threshold_list = np.arange(0, 1, 0.2)
     boxes = compute_bboxes_from_scoremaps(scoremap,
                                           scoremap_threshold_list)
     self.assertListEqual(boxes, [[0, 0, 4, 3], [0, 0, 2, 2], [0, 3, 3, 3],
                                  [2, 3, 3, 3], [0, 3, 1, 3]])
Ejemplo n.º 3
0
 def test_compute_bboxes_from_scoremaps_unimodal(self):
     # array has shape array[y][x]
     scoremap = np.array(
         [[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.4, 0.4, 0.4, 0.6],
          [0.0, 0.4, 1.0, 0.8, 0.6], [0.0, 0.4, 0.4, 0.4, 0.6]],
         dtype=np.float)
     scoremap_threshold_list = np.arange(0, 1, 0.2)
     boxes = compute_bboxes_from_scoremaps(scoremap,
                                           scoremap_threshold_list)[0]
     boxes = [box[0].tolist() for box in boxes]
     self.assertListEqual(boxes, [[1, 1, 4, 3], [1, 1, 4, 3], [2, 1, 4, 3],
                                  [2, 2, 4, 3], [2, 2, 3, 3]])