/lbcnn.pytorch

Primary LanguagePythonMIT LicenseMIT

[work in progress] Pytorch Implementation of LBCNN

Pytorch Implementation of LBCNN [https://arxiv.org/abs/1608.06049] on various vision tasks.

Cifar10

The cifar10 codes highly reuse https://github.com/kuangliu/pytorch-cifar, I manually modified conv layer in certain model to use LBCNN.

git checkout cifar10

sh run.sh 0

ImageNet

The ImageNet codes highly reuse cifar10 example. Run the following to train a resnet101 with LBCNN.

git checkout imagenet

sh run.sh 0,1,2,3 resnet101 512

Use mmclassification

git checkout seg
cd mmclassification
CUDA_VISIBLE_DEVICES=3,4,5,6 ./tools/dist_train.sh configs/resnet/resnet50_b32x8_imagenet.py 4

Detection

Checkout to seg branch

git checkout seg

Install mmcv-full and mmdet.

cd mmcv
MMCV_WITH_OPS=1,FORCE_CUDA=1 python setup.py develop

# The mmdetection is copied from https://github.com/open-mmlab/mmdetection
# And I modified the configuration file `faster_rcnn_r50_fpn_1x_coco.py`
#   1. no pretrain model
#   2. batch per gpu = 4 instead of 2
#   3. Use schedule_20e since no pretrain
cd ../mmdetection
python setup.py develop

Then follow mmdet's documentation to run normal detection training,

Detection needs a pretrained model to get a better performace, so first pretrain on ImageNet

cd mmclassification
PYTHONPATH=${LBCNN_GIT_PATH} CUDA_VISIBLE_DEVICES=3,4,5,6 USE_LBCNN=1 ./tools/dist_train.sh configs/resnet/resnet50_b32x8_imagenet.py 4

Segmentation

Checkout to seg branch

git checkout seg

Install mmcv-full and mmsegmentation.

# Skip if already installed
cd mmcv
MMCV_WITH_OPS=1,FORCE_CUDA=1 python setup.py develop

# The mmsegmentation is copied from https://github.com/open-mmlab/mmsegmentation
# And I modified the configuration file `fcn_r50-d8_512x1024_80k_cityscapes.py`
#   1. no pretrain model
#   2. batch per gpu = 8 instead of 2
#   3. syncbn -> bn
cd ../mmsegmentation
python setup.py develop

Then follow mmseg's documentation to run normal segmentation training or run following script to run lbcnn version

cd mmsegmentation
PYTHONPATH=${LBCNN_GIT_PATH} CUDA_VISIBLE_DEVICES=6,7 USE_LBCNN=1 ./tools/dist_train.sh configs/fcn/fcn_r50-d8_512x1024_80k_cityscapes.lbcnn.py 2

References

  • Felix Juefei-Xu, Vishnu Naresh Boddeti, and Marios Savvides, Local Binary Convolutional Neural Networks,

  • IEEE Computer Vision and Pattern Recognition (CVPR), 2017. (Spotlight Oral Presentation)

  • @inproceedings{juefei-xu2017lbcnn,
       title={{Local Binary Convolutional Neural Networks}},
       author={Felix Juefei-Xu and Vishnu Naresh Boddeti and Marios Savvides},
       booktitle={IEEE Computer Vision and Pattern Recognition (CVPR)},
       month={July},
       year={2017}
    }

and

  • Felix Juefei-Xu, Changqing Zhou, Vishnu Naresh Boddeti, and Marios Savvides, Local Binary Convolutional Neural Networks and Beyond,
  • Work in Progress, 2021.