Commit 4a333692 authored by Yan Li's avatar Yan Li Committed by Francisco Massa

quick fix for area (#98)

* quick fix for area

* Update bounding_box.py
parent b4182125
...@@ -224,9 +224,16 @@ class BoxList(object): ...@@ -224,9 +224,16 @@ class BoxList(object):
return self return self
def area(self): def area(self):
TO_REMOVE = 1 if self.mode == 'xyxy':
box = self.bbox TO_REMOVE = 1
area = (box[:, 2] - box[:, 0] + TO_REMOVE) * (box[:, 3] - box[:, 1] + TO_REMOVE) 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 return area
def copy_with_fields(self, fields): def copy_with_fields(self, fields):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment