← Open Source
conradry

copy-paste-aug

Copy-paste augmentation for segmentation and detection tasks.

Model DevelopmentDataset engineeringJupyter Notebook
Open on GitHub
Momentum
+0stars in 24 hours0.0%
571
Stars
74
Forks
+0
This week
1
Contributors
Created 2020-12-19 · Updated 2026-10-01 · #16811 today
Top developers
conradry

conradry/copy-paste-aug is ranked 16,811 with 571 stars.

Same-category comparison

conradry/copy-paste-aug is ranked 16,811 among these 8 peers; facebookresearch/omnivore is ranked 16,812.

Same-category comparison
NameRankMetrics
salesforce/PyRCA16,797
Language:
Python
Stars:
572
Forks:
70
Description:
PyRCA: A Python Machine Learning Library for Root Cause Analysis.
torrvision/siamfc-tf16,798
Language:
Python
Stars:
572
Forks:
184
Description:
SiamFC tracking in TensorFlow.
KaihuaTang/Long-Tailed-Recognition.pytorch16,804
Language:
Jupyter Notebook
Stars:
571
Forks:
70
Description:
[NeurIPS 2020] This project provides a strong single-stage baseline for Long-Tailed Classification, Detection, and Instance Segmentation (LVIS). It is also a PyTorch implementation of the NeurIPS 2020 paper 'Long-Tailed Classification by Keeping the Good and Removing the Bad Momentum Causal Effect'.
PJLab-ADG/3DTrans16,806
Language:
Python
Stars:
571
Forks:
63
Description:
An open-source codebase for exploring autonomous driving pre-training.
facebookresearch/omnivore16,812
Language:
Python
Stars:
571
Forks:
40
Description:
Omnivore: A Single Model for Many Visual Modalities.
jeya-maria-jose/UNeXt-pytorch16,815
Language:
Python
Stars:
571
Forks:
86
Description:
Official Pytorch Code base for "UNeXt: MLP-based Rapid Medical Image Segmentation Network", MICCAI 2022.
Diyago/Tabular-data-generation16,820
Language:
Python
Stars:
570
Forks:
81
Description:
We well know GANs for success in the realistic image generation. However, they can be applied in tabular data generation. We will review and examine some recent papers about tabular GANs in action.
OpenDriveLab/OpenLane16,821
Language:
C++
Stars:
570
Forks:
52
Description:
[ECCV 2022 Oral] OpenLane: Large-scale Realistic 3D Lane Dataset.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguageJupyter Notebook
CategoryModel Development
SubcategoryDataset engineering
KeywordsComputer vision, Data synthesis
Stars571
Forks74
Contributors1
Created date2020-12-19
Updated date2026-10-01
Stars in 1 day0
Stars in 7 days0
Rank16,811
Previous rank16,602
Rank change-209
7-day stars rank15,738
Previous 7-day stars rank15,749
7-day stars rank change11
Total stars rank17,460
Previous total stars rank17,431
Total stars rank change-29
README summary

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. To attach class labels to a bounding box, directly append it to the bounding box coordinates. Bounding boxes passed to the CopyPaste augmentation must also include the index of the corresponding mask in the 'masks' list. the bounding box looks like (x1, y1, x2, y2, class_id, mask_index)). The CopyPaste augmentation expects 6 keyword arguments instead of three: 4. 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 for copy-paste functionality. The dataset class looks like: The only difference from a regular torchvision dataset is the decorator and the method instead of . To compose transforms with copy-paste augmentation: **Note: bbox params are NOT optional!

Frequently asked questions

How many stars and forks are recorded?

conradry/copy-paste-aug has 571 stars and 74 forks.

What is the repository rank?

conradry/copy-paste-aug is ranked 16,811.

What language and category are recorded?

conradry/copy-paste-aug has 571 stars, uses Jupyter Notebook and belongs to Model Development.

Which repository is closest in rank?

conradry/copy-paste-aug is compared with facebookresearch/omnivore, ranked 16,812 with 571 stars.

README

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:
# typical albumentations transform
output = transforms(image=image, masks=masks, bboxes=bboxes)

# for the copy paste transform
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 for 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:

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: bbox params are NOT optional!

Nearby in the ranking
Similar items