Git Product home page Git Product logo

copy-paste-for-semantic-segmentation's Introduction

typora-root-url
images

Copy-Paste-for-Semantic-Segmentation

Unofficial implementation of Copy-Paste method: Simple Copy-Paste is a Strong Data Augmentation Method for Instance Segmentation.

This repo is implementation for semantic segmentation. You can use also in instance segmentation.

We do it at VOC-like dataset. If your dataset is coco-like, you need extract mask from coco first.

More details see blog.

methods used in this repo:

  1. Random Horizontal Flip
  2. Large Scale Jittering
  3. Copy-Paste

Steps:

  1. choice source image and main image;
  2. get annotations from source image;
  3. rescale source image and it annotations;
  4. paste source image and annotations to main image and annotations;
  5. merge main annotations and source annotations;

Usage:

If use coco-like dataset, you need run get_coco_mask.py first:

usage: get_coco_mask.py [-h] [--input_dir INPUT_DIR] [--split SPLIT]

optional arguments:
  -h, --help            show this help message and exit
  --input_dir INPUT_DIR
                        coco dataset directory
  --split SPLIT         train2017 or val2017

And then, run copy_paste.py:

usage: copy_paste.py [-h] [--input_dir INPUT_DIR] [--output_dir OUTPUT_DIR]
                     [--lsj LSJ]

optional arguments:
  -h, --help            show this help message and exit
  --input_dir INPUT_DIR
                        input annotated directory
  --output_dir OUTPUT_DIR
                        output dataset directory
  --lsj LSJ             if use Large Scale Jittering

If your dataset is voc-like, just run copy_paste.py.

Examples:

example of get_coco_mask.py:

python copy_paste.py --input_dir ../dataset/coco2017 --split train2017

example of copy_paste.py:

python copy_paste.py --input_dir ../dataset/VOCdevkit2012/VOC2012 --output_dir ../dataset/VOCdevkit2012/VOC2012_copy_paste --lsj True

Results:

main image + source image:

image

main anno + source anno:

image

visualization:

vis

copy-paste-for-semantic-segmentation's People

Contributors

ailiwensong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.