提交 4a333692 编写于 作者: Y Yan Li 提交者: Francisco Massa

quick fix for area (#98)

* quick fix for area

* Update bounding_box.py
上级 b4182125
......@@ -224,9 +224,16 @@ class BoxList(object):
return self
def area(self):
TO_REMOVE = 1
box = self.bbox
area = (box[:, 2] - box[:, 0] + TO_REMOVE) * (box[:, 3] - box[:, 1] + TO_REMOVE)
if self.mode == 'xyxy':
TO_REMOVE = 1
box = self.bbox
area = (box[:, 2] - box[:, 0] + TO_REMOVE) * (box[:, 3] - box[:, 1] + TO_REMOVE)
elif self.mode == 'xywh':
box = self.bbox
area = box[:, 2] * box[:, 3]
else:
raise RuntimeError("Should not be here")
return area
def copy_with_fields(self, fields):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册