"tests/python/common/test_sparse_ops-csr.py" did not exist on "7c598aac6c25fbee53e52f6bd54c2fd04bad2151"
Commit 02723f24 authored by Olga Gerasimova's avatar Olga Gerasimova Committed by Facebook GitHub Bot
Browse files

MinIoURandomCrop augmentation in d2go for detection models

Summary:
X-link: https://github.com/fairinternal/detectron2/pull/589

X-link: https://github.com/facebookresearch/detectron2/pull/4702

Pull Request resolved: https://github.com/facebookresearch/d2go/pull/443

Add MinIoURandomCrop augmentation, compare model performance.
Example of aug
{F822053068}{F822053066}{F822053051}
Data overhead is around 0.04 sec
without aug {F822053812}
with aug {F822053818}

Reviewed By: zechenghe

Differential Revision: D41804643

fbshipit-source-id: 8f13f98fa8132378a803534b59e892fbc1b3058c
parent 93301dad
...@@ -104,6 +104,11 @@ class D2GoDatasetMapper(object): ...@@ -104,6 +104,11 @@ class D2GoDatasetMapper(object):
# pass additional arguments, will only be used when the Augmentation # pass additional arguments, will only be used when the Augmentation
# takes `annotations` as input # takes `annotations` as input
inputs.annotations = dataset_dict["annotations"] inputs.annotations = dataset_dict["annotations"]
inputs.boxes = [
utils.get_bbox(obj)
for obj in dataset_dict["annotations"]
if obj.get("iscrowd", 0) == 0
]
# Crop around an instance if there are instances in the image. # Crop around an instance if there are instances in the image.
if self.crop_gen: if self.crop_gen:
crop_tfm = utils.gen_crop_transform_with_instance( crop_tfm = utils.gen_crop_transform_with_instance(
......
...@@ -27,6 +27,7 @@ D2_RANDOM_TRANSFORMS = { ...@@ -27,6 +27,7 @@ D2_RANDOM_TRANSFORMS = {
"RandomResize": d2T.RandomResize, "RandomResize": d2T.RandomResize,
"FixedSizeCrop": d2T.FixedSizeCrop, "FixedSizeCrop": d2T.FixedSizeCrop,
"ResizeScale": d2T.ResizeScale, "ResizeScale": d2T.ResizeScale,
"MinIoURandomCrop": d2T.MinIoURandomCrop,
} }
...@@ -118,6 +119,13 @@ def ResizeScaleOp( ...@@ -118,6 +119,13 @@ def ResizeScaleOp(
return build_func(cfg, arg_str, is_train, name="ResizeScale") return build_func(cfg, arg_str, is_train, name="ResizeScale")
@TRANSFORM_OP_REGISTRY.register()
def MinIoURandomCropOp(
cfg: CfgNode, arg_str: Optional[str], is_train: bool
) -> List[aug.Augmentation]:
return build_func(cfg, arg_str, is_train, name="MinIoURandomCrop")
# example repr: FixedSizeCropOp::{"crop_size": [1024, 1024]} # example repr: FixedSizeCropOp::{"crop_size": [1024, 1024]}
@TRANSFORM_OP_REGISTRY.register() @TRANSFORM_OP_REGISTRY.register()
def FixedSizeCropOp( def FixedSizeCropOp(
......
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