Commit 48546d57 authored by Yuxin Wu's avatar Yuxin Wu

point8->point4

parent 9fac1a6c
......@@ -62,8 +62,10 @@ class CustomResize(ImageAugmentor):
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
......@@ -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
......
......@@ -18,8 +18,8 @@ from tensorpack.utils.argtools import log_once
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
......@@ -95,9 +95,9 @@ class TrainingDataPreprocessor:
# 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())
......
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