Code Monkey home page Code Monkey logo

nas-segm-pytorch's Introduction

Neural Architecture Search of Semantic Segmentation Models (in PyTorch)

PWC PWC PWC PWC PWC PWC

This repository provides official models from two papers:

  1. Fast Neural Architecture Search of Compact Semantic Segmentation Models via Auxiliary Cells, available here;
  2. Template-Based Automatic Search of Compact Semantic Segmentation Architectures, available here.

For citations:

Fast Neural Architecture Search of Compact Semantic Segmentation Models via Auxiliary Cells
Vladimir Nekrasov, Hao Chen, Chunhua Shen, Ian Reid
CVPR, 2019

and

Template-Based Automatic Search of Compact Semantic Segmentation Architectures
Vladimir Nekrasov, Chunhua Shen, Ian Reid
WACV, 2020

Updates

22 May, 2020: Added the search script for the WACV 2020 experiments on CityScapes.

05 April, 2020 : Added decoder design and pre-trained segmentation models from the WACV 2020 paper "Template-Based Automatic Search of Compact Semantic Segmentation Architectures".

Getting Started

For flawless reproduction of our results, the Ubuntu OS is recommended. The models have been tested using Python 3.6.

Dependencies

pip3
Cython
cv2
jupyter-notebook
matplotlib
numpy
Pillow
torch>=1.0
torchvision

Inference Examples

For the ease of reproduction, we have embedded all our examples inside Jupyter notebooks.

CVPR 2019 Segmentation

Please refer to results on PASCAL VOC

CVPR 2019 Depth Estimation

Please refer to results on NYUD-v2

WACV 2020 Segmentation CityScapes

Please refer to results on CityScapes

WACV 2020 Segmentation CamVid

Please refer to results on CamVid

Note on the runtime of WACV 2020 models

In the paper we wrongly claimed that the latency of arch0 and arch1 on 2048x1048 inputs were 95.7±0.721 and 145±0.215, correspondingly (on a single 1080Ti). These numbers were incorrect as the model was in the training regime and not in the evaluation mode (model.eval() in PyTorch). Below are the characteristics of the discovered architectures with correct latency:

arch0 arch1
Number of parameters (19 output classes) 280147 268235
Latency, ms on 2048x1024 inputs 52.25±0.03 97.11±0.24
Latency, ms on 480x360 inputs 8.97±0.10 11.51±0.14

Search

If you would like to search for architectures yourself, please follow the instructions below:

CVPR 2019 (PASCAL VOC)

Prepare data

You would need to have PASCAL VOC segmentation dataset expanded with annotations from BSD.

After that, run in your terminal:

mkdir data/datasets
ln -s /path_to_voc/VOCdevkit data/datasets/

Running search

We rely on a Cython-based script for calculating mean IoU. In order to build the corresponding files, run the following:

cd src
python helpers/setup.py build_ext --build-lib=./helpers/

After that, you can execute ./examples/search/search.sh that will start the search process.

[!] Please note that all the hyperparameters were tuned for running the search process on 2 GPUs, each with at least 11GB of memory. In case when your setup differs, you would need to tune the hyperparameters accordingly.

Checking the results

We output the log-file with all information on the search process. You can easily see top-performing architectures using the following command: python src/helpers/num_uq.py path_to_genotypes.out

WACV 2020 (CityScapes)

Prepare data

You would need to have the CityScapes segmentation dataset.

After that, run in your terminal:

mkdir data/datasets
ln -s /path_to_cityscapes/cs/ data/datasets/

Running search

After that, you can execute ./examples/search/search_wacv.sh that will start the search process.

[!] Please note that all the hyperparameters were tuned for running the search process on 2 1080Ti GPUs. In case when your setup differs, you would need to tune the hyperparameters accordingly.

License

This project is free to use for non-commercial purposes - see the LICENSE file for details.

Acknowledgments

  • University of Adelaide and Australian Centre for Robotic Vision (ACRV) for making this project happen
  • HPC Phoenix cluster at the University of Adelaide for making the training of the models possible
  • PyTorch developers
  • Yerba mate tea

nas-segm-pytorch's People

Contributors

drsleep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nas-segm-pytorch's Issues

zero reward?

Thanks for the open code!
When performing the search procedure, i always got zero reward after epoch 69. Is it normal?

reward: 0.6049, epoch: 69, params: 2152613, epoch_time: 27.7015, genotype: [[3, [1, 0, 9, 9], [4, 1, 7, 1], [0, 7, 10, 5]], [[3, 3], [4, 4], [3, 3]]]

reward: 0.0000, epoch: 70, params: 2277317, epoch_time: 7.8641, genotype: [[6, [0, 1, 3, 1], [0, 4, 0, 10], [2, 2, 6, 10]], [[1, 0], [2, 3], [2, 0]]]

reward: 0.0000, epoch: 71, params: 2088101, epoch_time: 7.4487, genotype: [[0, [0, 1, 7, 1], [4, 1, 4, 3], [5, 2, 7, 7]], [[3, 1], [4, 2], [2, 5]]]

reward: 0.0000, epoch: 72, params: 2147717, epoch_time: 7.7244, genotype: [[9, [1, 0, 6, 10], [3, 0, 2, 4], [4, 2, 1, 10]], [[1, 3], [0, 3], [2, 3]]]

Optimize the search for inferencing

@DrSleep Thank you for your hard work,

My goal is to search for an architecture that balance accuracy and high inferencing speed on cpu.

  • Is there an option to limit the search space to not exceed a certain limit of parameters flops adds?
  • How to inference an image using cpu only?

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.