GithubHelp home page GithubHelp logo

yejg2017 / deeplab-pytorch-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uvipen/deeplab-pytorch

0.0 1.0 0.0 22.15 MB

Deeplab for semantic segmentation tasks

License: MIT License

Python 100.00%

deeplab-pytorch-1's Introduction

[PYTORCH] Deeplab

Introduction

Here is my pytorch implementation of the model described in the paper DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs paper.

How to use my code

With my code, you can:

  • Train your model from scratch
  • Train your model with my trained model
  • Evaluate test images with either my trained model or yours

Requirements:

  • python 3.6
  • pytorch 0.4
  • opencv (cv2)
  • tensorboard
  • tensorboardX (This library could be skipped if you do not use SummaryWriter)
  • torchvision
  • PIL
  • numpy

Datasets:

I used 2 different datases: VOC2012 and VOCaugmented (VOC2007 + 2012) Statistics of datasets I used for experiments is shown below

Dataset #Classes #Train images #Validation images
VOC2012 20 5011 1449
VOCaugmented 20 1464 1449

Create a data folder under the repository,

cd {repo_root}
mkdir data
  • VOC: Download the voc images and annotations from VOC2007 or VOC2012. Make sure to put the files as the following structure:
    VOCDevkit
    ├── VOC2007
    │   ├── Annotations  
    │   ├── ImageSets
    │   ├── JPEGImages
    │   └── ...
    ├── VOC2012
    │   ├── Annotations  
    │   ├── ImageSets
    │   ├── JPEGImages
    │   └── ...
    └── VOCaugmented
        ├── gt  
        ├── img
        ├── list
        └── ...
    

Note: You need to put ALL images from 2 dataset VOC2007 and VOC2012 into folder VOCdevkit/VOCaugmented/img/

  • In my implementation, in every epoch, the model is saved only when its loss is the lowest one so far. You could also use early stopping, which could be triggered by specifying a positive integer value for parameter es_patience, to stop training process when validation loss has not been improved for es_patience epoches.

Trained models

You could find all trained models I have trained in Deeplab trained models

Training

I provide my pre-trained model name vietnh_trained_deeplab_voc. You could put it in the folder trained_models/, and load it before training your new model, for faster convergence.

If you want to train a new model, you could run:

  • python3 train_voc.py --dataset dataset: For example, python train_voc.py --dataset augmentedvoc

Test

By default, my test script will load trained model from folder trained_models/. You of course could change it to other folder which contains your trained model(s).

I provide 2 different test scripts:

If you want to test a trained model with a standard VOC dataset, you could run:

  • python3 test_voc.py --year year: For example, python3 test_voc.py --year 2012

If you want to test a model with some images, you could put them into the folder test_images/, then run:

  • python3 test_voc_single_images.py --input --output path/to/output/folder: For example, python3 test_voc_single_images.py --output predictions. For easy comparison, not only output images are created, but input images are also copied to output folder

Experiments:

I trained models in 2 machines, one with NVIDIA TITAN X 12gb GPU and the other with NVIDIA quadro 6000 24gb GPU.

The training/test loss curves for each experiment are shown below:

  • VOC2012 voc2012 loss
  • VOCaugmented vocaugmented loss

Results

Some output predictions for experiments for each dataset are shown below:

  • VOC2012

  • VOCaugmented

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.