Skip to content

Commit

Permalink
point8->point4
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwwyyxx committed Dec 19, 2019
1 parent 9fac1a6 commit 48546d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions examples/FasterRCNN/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ def get_transform(self, img):
return ResizeTransform(h, w, newh, neww, self.interp)


def box_to_point8(boxes):
def box_to_point4(boxes):
"""
Convert boxes to its corner points.
Args:
boxes: nx4
Expand All @@ -75,7 +77,7 @@ def box_to_point8(boxes):
return b


def point8_to_box(points):
def point4_to_box(points):
"""
Args:
points: (nx4)x2
Expand Down
8 changes: 4 additions & 4 deletions examples/FasterRCNN/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from modeling.model_rpn import get_all_anchors
from modeling.model_fpn import get_all_anchors_fpn
from common import (
CustomResize, DataFromListOfDict, box_to_point8,
filter_boxes_inside_shape, np_iou, point8_to_box, polygons_to_mask,
CustomResize, DataFromListOfDict, box_to_point4,
filter_boxes_inside_shape, np_iou, point4_to_box, polygons_to_mask,
)
from config import config as cfg
from dataset import DatasetRegistry, register_coco
Expand Down Expand Up @@ -95,9 +95,9 @@ def __call__(self, roidb):
# augmentation:
tfms = self.aug.get_transform(im)
im = tfms.apply_image(im)
points = box_to_point8(boxes)
points = box_to_point4(boxes)
points = tfms.apply_coords(points)
boxes = point8_to_box(points)
boxes = point4_to_box(points)
if len(boxes):
assert klass.max() <= self.cfg.DATA.NUM_CATEGORY, \
"Invalid category {}!".format(klass.max())
Expand Down

0 comments on commit 48546d5

Please sign in to comment.