Skip to content

This is a data augmentation for object detection, using bounding boxes.

Notifications You must be signed in to change notification settings

seareale/BboxCutMix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

BboxCutMix

This is a data augmentation for object detection, using bounding boxes.


Introduction

There were no-objects images during training when using Mosaic[1] because of image center position of objects. So we implemented a augmentation pasting bboxes in the empty space of a training image(BboxCutMix).

An example of BboxCutMix

The distribution of bounding box sizes



Details

There is already a method using bounding boxes like copy-paste[2]. But BboxCutMix has two differences from copy-paste.

  1. Make hard to find a bounding box when training using offset margin.
  2. Have full edge information(no-occluded objects).

Data augmentation results

The detailed procedure of BboxCutMix is shown in the image below. The offset margin was added to prevent easy finding out a bounding box. And we applied data augmentations for each cropped objects. Finally, cropped objects are inserted into the training image.

The procedure of BboxCutMix



How to use

  1. run the command
$ pip install -r requirements.txt
  1. initialize variables and add the code in your Dataset class like below.
from bbox_cutmix import * 
from torch.utils.data import Dataset 

    class customDataset(Dataset):
        ...
        self.ims = ...        # training images (list | (#_img, H, W, C))
        self.im_files = ...   # path of traning images (list)
        self.img_size = ...   # traning images size (int)
        self.indices = ...    # range(0, #_img)
        self.labels = ...     # labels of traning data (list | (#_img, #_obj, class, x, y, w, h))# load image
        if bbox_cutmix:
            # h, w are height and width of img
            img, labels = bbox_cutmix(self, img, labels, h, w)
        …


References

  1. Zhiwei et al, AMRNet: Chips Augmentation in Aerial Images Object Detection, https://arxiv.org/abs/2009.07168
  2. Golnaz et al, Simple Copy-Paste is a Strong Data Augmentation Method for Instance Segmentation, https://arxiv.org/abs/2012.07177


About

This is a data augmentation for object detection, using bounding boxes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages