コード例 #1
0
 def test_volume(self):
     boxes = np.array(
         [[_degree_to_radians(0.1), 10.0, 20.0, 30.0, 5.0, 6.0, 4.0],
          [_degree_to_radians(0.2), 4.0, 5.0, 10.0, 1.0, 2.0, 3.0],
          [_degree_to_radians(-0.2), 4.0, 5.0, 1.0, 1.0, 2.0, 3.0]],
         dtype=np.float32)
     (_, length, height, width, _) = _decompose_box_tensor(boxes)
     boxes_volume = np_box_ops.volume(length=length,
                                      height=height,
                                      width=width)
     self.assertAllClose(boxes_volume, [6000, 200, 20])
コード例 #2
0
def volume(boxlist):
    """Computes area of boxes.

  Args:
    boxlist: BoxList3d holding N boxes.

  Returns:
    A numpy array with shape [N*1] representing box volumes.
  """
    return np_box_ops.volume(length=boxlist.get_length(),
                             height=boxlist.get_height(),
                             width=boxlist.get_width())