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

point8->point4

parent 9fac1a6c
...@@ -62,8 +62,10 @@ class CustomResize(ImageAugmentor): ...@@ -62,8 +62,10 @@ class CustomResize(ImageAugmentor):
return ResizeTransform(h, w, newh, neww, self.interp) 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: Args:
boxes: nx4 boxes: nx4
...@@ -75,7 +77,7 @@ def box_to_point8(boxes): ...@@ -75,7 +77,7 @@ def box_to_point8(boxes):
return b return b
def point8_to_box(points): def point4_to_box(points):
""" """
Args: Args:
points: (nx4)x2 points: (nx4)x2
......
...@@ -18,8 +18,8 @@ from tensorpack.utils.argtools import log_once ...@@ -18,8 +18,8 @@ from tensorpack.utils.argtools import log_once
from modeling.model_rpn import get_all_anchors from modeling.model_rpn import get_all_anchors
from modeling.model_fpn import get_all_anchors_fpn from modeling.model_fpn import get_all_anchors_fpn
from common import ( from common import (
CustomResize, DataFromListOfDict, box_to_point8, CustomResize, DataFromListOfDict, box_to_point4,
filter_boxes_inside_shape, np_iou, point8_to_box, polygons_to_mask, filter_boxes_inside_shape, np_iou, point4_to_box, polygons_to_mask,
) )
from config import config as cfg from config import config as cfg
from dataset import DatasetRegistry, register_coco from dataset import DatasetRegistry, register_coco
...@@ -95,9 +95,9 @@ class TrainingDataPreprocessor: ...@@ -95,9 +95,9 @@ class TrainingDataPreprocessor:
# augmentation: # augmentation:
tfms = self.aug.get_transform(im) tfms = self.aug.get_transform(im)
im = tfms.apply_image(im) im = tfms.apply_image(im)
points = box_to_point8(boxes) points = box_to_point4(boxes)
points = tfms.apply_coords(points) points = tfms.apply_coords(points)
boxes = point8_to_box(points) boxes = point4_to_box(points)
if len(boxes): if len(boxes):
assert klass.max() <= self.cfg.DATA.NUM_CATEGORY, \ assert klass.max() <= self.cfg.DATA.NUM_CATEGORY, \
"Invalid category {}!".format(klass.max()) "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