Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 2.16 KB

README.md

File metadata and controls

53 lines (33 loc) · 2.16 KB

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)