Skip to content

hellojun12/Copy-Paste-Augmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy and Paste-Augmentation

Generic badge

Original paper by : Simple Copy-Paste is a Strong Data Augmentation

  • This function is originated from above paper
  • Scale Jittering is applied so that it could resemble more of the paper
  • Not yet supported with bounding boxes. Only semantic segementation mask is available.
Images

Copy and paste
Image
Mask

How To Use

Integrated with pytorch dataset format.

  1. First make an instance with two types of parameters

    • p : probability of applying the transform. (default=0.5)
    • scale_jittering : Scale range to use, 0 means original scale and -1 is 100% zoom in whereas 2 would be 100% zoom out. Parameters must be in shape of tuple (ex. (-2, 1)). Maximum range is (-5, 5) meaning (-500%, 500%). (default=(-2, 2))

  2. Pass in four key words (image1, mask1, image2, mask2)

    • image1 will be the image to paste in.
    • image2 is the image which implements scale jittering and expectes for the image1 to be pasted.
    Image1 Image2 CopyPaste
        from copypaste import CopyPaste
    
        copy_paste = CopyPaste(p=0.5, scale_jittering=(-2, 2))
        self.copy_paste = copy_paste(image1, mask1, image2, mask2)

About

Copy and Paste Augmentations with scale jittering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published