[ICCV 2015] Framework for optimizing CNNs with linear constraints for Semantic Segmentation
Deepak Pathak, Philipp Krähenbühl, Trevor Darrell
CCNN is a framework for optimizing convolutional neural networks with linear constraints.
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}
}
CCNN is released under academic, non-commercial UC Berkeley license (see LICENSE file for details).
Caffe
and pycaffe
(see: Caffe installation instructions)$ conda install boost
$ conda install protobuf
# Make sure to clone with --recursive
git clone --recursive https://github.com/pathak22/ccnn.git
WITH_PYTHON_LAYER := 1
cd ccnn/caffe-ccnn
# If you have all caffe requirements installed
# and your Makefile.config in place, then simply do:
make -j8 && make pycaffe
Now build CCNN
cd ccnn
mkdir build
cd build
cmake ..
make -j8
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
ccmake ./
inside the build folder and manually check the following things :
MAKE_CXX_COMPILER, CMAKE_C_COMPILER , PYTHON_EXECUTABLE , PYTHON_INCLUDE_DIR , PYTHON_LIBRARY
Configure path (if needed) in src/user_config.py
.
(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.
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
Model Prototxts:
models/fcn_8s/
: Atrous algorithm based 8-strided VGG, described here.models/fcn_32s/
: 32-strided VGGConfigure:
src/config.py
: Set glog-minlevel accordingly to get desired caffe output to terminalHelper 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.