All Projects → conradry → Copy Paste Aug

conradry / Copy Paste Aug

Licence: mit
Copy-paste augmentation for segmentation and detection tasks

Projects that are alternatives of or similar to Copy Paste Aug

Siamese Mask Rcnn
Siamese Mask R-CNN model for one-shot instance segmentation
Stars: ✭ 257 (+94.7%)
Mutual labels:  object-detection, jupyter-notebook, instance-segmentation
Detectorch
Detectorch - detectron for PyTorch
Stars: ✭ 566 (+328.79%)
Mutual labels:  object-detection, jupyter-notebook, instance-segmentation
Dataaugmentationforobjectdetection
Data Augmentation For Object Detection
Stars: ✭ 812 (+515.15%)
Mutual labels:  object-detection, jupyter-notebook, data-augmentation
Tensorflow2.0 Examples
🙄 Difficult algorithm, Simple code.
Stars: ✭ 1,397 (+958.33%)
Mutual labels:  object-detection, jupyter-notebook
Text Detection Using Yolo Algorithm In Keras Tensorflow
Implemented the YOLO algorithm for scene text detection in keras-tensorflow (No object detection API used) The code can be tweaked to train for a different object detection task using YOLO.
Stars: ✭ 87 (-34.09%)
Mutual labels:  object-detection, jupyter-notebook
Soccer Ball Detection Yolov2
YOLOv2 trained against custom dataset
Stars: ✭ 97 (-26.52%)
Mutual labels:  object-detection, jupyter-notebook
Panet
PANet for Instance Segmentation and Object Detection
Stars: ✭ 1,170 (+786.36%)
Mutual labels:  object-detection, instance-segmentation
Robust Physical Attack
Physical adversarial attack for fooling the Faster R-CNN object detector
Stars: ✭ 115 (-12.88%)
Mutual labels:  object-detection, jupyter-notebook
Kerasobjectdetector
Keras Object Detection API with YOLK project 🍳
Stars: ✭ 113 (-14.39%)
Mutual labels:  object-detection, jupyter-notebook
Bmaskr Cnn
Boundary-preserving Mask R-CNN (ECCV 2020)
Stars: ✭ 116 (-12.12%)
Mutual labels:  object-detection, instance-segmentation
Swa object detection
SWA Object Detection
Stars: ✭ 128 (-3.03%)
Mutual labels:  object-detection, instance-segmentation
Fcos tensorflow
FCOS: Fully Convolutional One-Stage Object Detection.
Stars: ✭ 87 (-34.09%)
Mutual labels:  object-detection, jupyter-notebook
Tracktor
Python and OpenCV based object tracking software
Stars: ✭ 76 (-42.42%)
Mutual labels:  object-detection, jupyter-notebook
Airbnb Amenity Detection
Repo for 42 days project to replicate/improve Airbnb's amenity (object) detection pipeline.
Stars: ✭ 101 (-23.48%)
Mutual labels:  object-detection, jupyter-notebook
Data generator object detection 2d
A data generator for 2D object detection
Stars: ✭ 73 (-44.7%)
Mutual labels:  object-detection, data-augmentation
Colab Mask Rcnn
How to run Object Detection and Segmentation on a Video Fast for Free
Stars: ✭ 114 (-13.64%)
Mutual labels:  object-detection, jupyter-notebook
Mask rcnn pytorch
Mask R-CNN for object detection and instance segmentation on Pytorch
Stars: ✭ 123 (-6.82%)
Mutual labels:  object-detection, instance-segmentation
Robust Detection Benchmark
Code, data and benchmark from the paper "Benchmarking Robustness in Object Detection: Autonomous Driving when Winter is Coming" (NeurIPS 2019 ML4AD)
Stars: ✭ 128 (-3.03%)
Mutual labels:  object-detection, jupyter-notebook
Paz
Hierarchical perception library in Python for pose estimation, object detection, instance segmentation, keypoint estimation, face recognition, etc.
Stars: ✭ 131 (-0.76%)
Mutual labels:  object-detection, instance-segmentation
Dda
Differentiable Data Augmentation Library
Stars: ✭ 65 (-50.76%)
Mutual labels:  jupyter-notebook, data-augmentation

Copy-Paste

Unofficial implementation of the copy-paste augmentation from Simple Copy-Paste is a Strong Data Augmentation Method for Instance Segmentation.

The augmentation function is built to integrate easily with albumentations. An example for creating a compatible torchvision dataset is given for COCO. Core functionality for image, masks, and bounding boxes is finished; keypoints are not yet supported. In general, you can use the CopyPaste augmentation just as you would any other albumentations augmentation function. There are a few usage limitations of note.

Usage Notes

  1. BboxParams cannot have label_fields. To attach class labels to a bounding box, directly append it to the bounding box coordinates. (I.e. (x1, y1, x2, y2, class_id)).
  2. Bounding boxes passed to the CopyPaste augmentation must also include the index of the corresponding mask in the 'masks' list. (I.e. the bounding box looks like (x1, y1, x2, y2, class_id, mask_index)). An example is given for COCO.
  3. The CopyPaste augmentation expects 6 keyword arguments instead of three:
output = transforms(image=image, masks=masks, bboxes=bboxes)
--->instead
output = transforms(
    image=image, masks=masks, bboxes=bboxes,
    paste_image=paste_image, paste_masks=paste_masks, paste_bboxes=paste_bboxes
  )
  1. After pasting objects, the original bounding boxes may be occluded. To make things easier, the original bounding boxes are just extracted from the updated masks.

Integration with Torchvision datasets

The idea is to have a standard torchvision dataset that's decorated to add seamlessly integrate the copy-paste functionality.

The dataset class looks like:

from copy_paste import copy_paste_class
from torch.utils.data import Dataset

@copy_paste_class
class SomeVisionDataset(Dataset):
    def __init__(self, *args):
        super(SomeVisionDataset, self).__init__(*args)

    def __len__(self):
        return length

    def load_example(self, idx):
        image_data_dict = load_some_data(idx)
        transformed_data_dict = self.transforms(**image_data_dict)
        return transformed_data_dict

The only difference from a regular torchvision dataset is the decorator and the load_example method instead of __getitem__.

To compose transforms with copy-paste augmentation (bbox params are NOT optional):

import albumentations as A
from albumentations.pytorch.transforms import ToTensorV2
from copy_paste import CopyPaste

transform = A.Compose([
      A.RandomScale(scale_limit=(-0.9, 1), p=1), #LargeScaleJitter from scale of 0.1 to 2
      A.PadIfNeeded(256, 256, border_mode=0), #constant 0 border
      A.RandomCrop(256, 256),
      A.HorizontalFlip(p=0.5),
      CopyPaste(blend=True, sigma=1, pct_objects_paste=0.5, p=1)
    ], bbox_params=A.BboxParams(format="coco")
)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].