Giter Site home page Giter Site logo

lxh-123 / ccnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pathak22/ccnn

0.0 0.0 0.0 289 KB

[ICCV 2015] Framework for optimizing CNNs with linear constraints for Semantic Segmentation

License: Other

CMake 10.08% C++ 45.84% C 0.32% Shell 1.97% Python 36.58% MATLAB 5.20%

ccnn's Introduction

CCNN: Constrained Convolutional Neural Networks for Weakly Supervised Segmentation

Deepak Pathak, Philipp Krähenbühl, Trevor Darrell

CCNN is a framework for optimizing convolutional neural networks with linear constraints.

  • It has been shown to achieve state-of-the-art results on the task of weakly-supervised semantic segmentation.
  • It is written in Python and C++, and based on Caffe.
  • It has been published at ICCV 2015. It was initially described in the arXiv report.

If you find CCNN useful in your research, please cite:

@inproceedings{pathakICCV15ccnn,
    Author = {Pathak, Deepak and Kr\"ahenb\"uhl, Philipp and Darrell, Trevor},
    Title = {Constrained Convolutional Neural Networks for Weakly Supervised Segmentation},
    Booktitle = {International Conference on Computer Vision ({ICCV})},
    Year = {2015}
}

License

CCNN is released under academic, non-commercial UC Berkeley license (see LICENSE file for details).

Contents

  1. Requirements
  2. Installation
  3. Usage
  4. Scripts Information
  5. Extra Downloads

1) Requirements

  1. Requirements for Caffe and pycaffe (see: Caffe installation instructions)
  2. GCC version more than 4.7
  3. Boost version more than 1.53 (recommended). If system dependencies give issues, install anaconda dependencies:
$ conda install boost
$ conda install protobuf
  1. A good GPU (e.g., Titan, K20, K40, ...) with at least 3G of memory is sufficient.

2) Installation

  1. Clone the CCNN repository
# Make sure to clone with --recursive
git clone --recursive https://github.com/pathak22/ccnn.git
  1. Build Caffe and pycaffe
  • Now follow the Caffe installation instructions here
  • Caffe must be built with support for Python layers!
  • In your Makefile.config, make sure to have this line uncommented WITH_PYTHON_LAYER := 1
  • You can download my Makefile.config for reference.
cd ccnn/caffe-ccnn
# If you have all caffe requirements installed
# and your Makefile.config in place, then simply do:
make -j8 && make pycaffe
  1. Now build CCNN

    cd ccnn
    mkdir build
    cd build
    cmake ..
    make -j8
  • Note: If anaconda is installed, then python paths may have been messed b/w anaconda and system python.
  • I usually run this command :
cmake .. -DBOOST_ROOT=/home/pathak/anaconda -DPYTHON_LIBRARY=/home/pathak/anaconda/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR=/home/pathak/anaconda/include/python2.7/ -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
  • To verify this do : ccmake ./ inside the build folder and manually check the following things : MAKE_CXX_COMPILER, CMAKE_C_COMPILER , PYTHON_EXECUTABLE , PYTHON_INCLUDE_DIR , PYTHON_LIBRARY
  • Make sure that cmake doesn't mess the anaconda boost to system boost.
  1. Configure path (if needed) in src/user_config.py.

  2. (Optional -- I don't do it) If everything runs fine, set CMAKE_BUILD_TYPE using ccmake . to Release. This prevents eigen from checking all assertions etc. and works faster.

3) Usage

Demo CCNN.

cd ccnn
bash ./models/scripts/download_ccnn_models.sh
# This will populate the `ccnn/models/` folder with trained models.
python ./src/demo.py

Train CCNN.

cd ccnn
bash ./models/scripts/download_pretrained_models.sh
# This will populate the `ccnn/models/` folder with imagenet pre-trained models.
python ./src/train.py 2> log.txt

Test CCNN.

cd ccnn
python ./src/test.py  # To test IOU with CRF post-processing
python ./src/test_argmax.py  # To test IOU without CRF

4) Scripts Information

Model Prototxts:

  • models/fcn_8s/ : Atrous algorithm based 8-strided VGG, described here.
  • models/fcn_32s/ : 32-strided VGG

Configure:

  • src/config.py : Set glog-minlevel accordingly to get desired caffe output to terminal

Helper Scripts:

  • src/extras/ : These scripts are not needed to run the code. They are simple helper scripts to create data, to prepare pascal test server file, to add pascal cmap to segmentation outputs etc.

5) Extra Downloads

ccnn's People

Contributors

pathak22 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.