Giter VIP home page Giter VIP logo

gfs_seg's Introduction

PyTorch Generalized Few-Shot Semantic Segmentation

Introduction

This repository is a PyTorch implementation for generalized few-shot semantic segmentation. It is developed based on this repo for semantic segmentation / scene parsing.

Usage

  1. Requirement:

    • Hardware: better with >=11G GPU memory
    • Software: PyTorch>=1.1.0, Python3, tensorboardX,

    env.yml is an environment file that works on Dart machine. You can clone the environment by running:

    conda env create -f env.yml
  2. Clone the repository:

    git clone [email protected]:Yinan-Zhao/gfs_seg.git
  3. Dataset and Initialization:

    • Download PASCAL and COCO datasets from here and put them under folder datasets(you can alternatively modify the relevant paths specified in folder config). COCO and pascal should be found under datasets.

      cd semseg
      mkdir -p datasets
      
    • Download ImageNet pre-trained models and put them under folder initmodel for weight initialization. Remember to use the right dataset format detailed in FAQ.md.

  4. The First Training Stage: Base Training

    • Specify the gpu id used in config and the fold id, then do training:

      sh tool/train_normal.sh pascal pspnet50_normal_split0
      sh tool/train_normal.sh coco pspnet50_normal_split0

      If split id is specified as 100, it will train with all the training images.

  5. The Second Training Stage: Few-Shot Fine-tuning

    • Specify weight as the trained model we obtain in the first base training stage and # of shots in config, then do fine-tuning:

      sh tool/train_finetune.sh pascal pspnet50_normal_finetune_split0_shot10_lr1e2
      sh tool/train_finetune.sh coco pspnet50_normal_finetune_split0_shot10_lr1e2
  6. Test:

    • Download trained segmentation models and put them under folder specified in config or modify the specified paths.

    • For full testing (get listed performance):

      sh tool/test_normal.sh coco pspnet50_normal_finetune_split0_shot5_lr1e2
  7. Visualization: tensorboardX incorporated for better visualization.

    tensorboard --logdir=exp/voc2012/pspnet50_normal_finetune_split0_shot5_lr1e2/

Resources:

  • Trained Models
  • Method Figure
  • Few-shot object detection (paper), Few-shot image classification (paper1), (paper2)
  • Data analysis tool: t-SNE
  • Datasets: attributes (names and colors) are in folder data and some sample lists can be accessed.
  • Some FAQs from the original repo: FAQ.md.

Next Steps:

  • Similarity and difference between different few-shot tasks (semantic segmentation, object detection and image classification). Although fine-tuning based approaches have shown success in each task, the set of parameters that need to fine-tuned are different (for segmentation we fine-tune all the layers after the ResNet backbone while for object detection only the last conv layer is fine-tuned). The different set of parameters that need to be fine-tuned indicates the difference in terms of the generalization of the learned features.

Contact:

gfs_seg's People

Contributors

yinan-zhao avatar

Stargazers

Joe Nevaeh avatar smiler avatar

Watchers

 avatar Josh Myers-Dean avatar

Forkers

joshmyersdean

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.