CGNet: A Light-weight Context Guided Network for Semantic Segmentation [IEEE Transactions on Image Processing 2020]
MIT License
The demand of applying semantic segmentation model on mobile devices has been increasing rapidly. Current state-of-the-art networks have enormous amount of parameters, hence unsuitable for mobile devices, while other small memory footprint models follow the spirit of classification network and ignore the inherent characteristic of semantic segmentation. To tackle this problem, we propose a novel Context Guided Network (CGNet), which is a light-weight and efficient network for semantic segmentation. We first propose the Context Guided (CG) block, which learns the joint feature of both local feature and surrounding context, and further improves the joint feature with the global context. Based on the CG block, we develop CGNet which captures contextual information in all stages of the network and is specially tailored for increasing segmentation accuracy. CGNet is also elaborately designed to reduce the number of parameters and save memory footprint. Under an equivalent number of parameters, the proposed CGNet significantly outperforms existing segmentation networks. Extensive experiments on Cityscapes and CamVid datasets verify the effectiveness of the proposed approach. Specifically, without any post-processing and multi-scale testing, the proposed CGNet achieves 64.8% mean IoU on Cityscapes with less than 0.5 M parameters.
git clone https://github.com/wutianyiRosun/CGNet.git
cd CGNet
cityscapes_test_list.txt
cityscapes_train_list.txt
cityscapes_trainval_list.txt
cityscapes_val_list.txt
cityscapes_val.txt
gtCoarse
train
train_extra
val
gtFine
test
train
val
leftImg8bit
test
train
val
license.txt
camvid_test_list.txt
camvid_train_list.txt
camvid_trainval_list.txt
camvid_val_list.txt
test
testannot
train
trainannot
val
valannot
python cityscapes_train.py --gpus 0,1 --dataset cityscapes --train_type ontrain --train_data_list ./dataset/list/Cityscapes/cityscapes_train_list.txt --max_epochs 300
python cityscapes_train.py --gpus 0,1 --dataset cityscapes --train_type ontrainval --train_data_list ./dataset/list/Cityscapes/cityscapes_trainval_list.txt --max_epochs 350
python cityscapes_eval.py --gpus 0 --val_data_list ./dataset/list/Cityscapes/cityscapes_val_list.txt --resume ./checkpoint/cityscapes/CGNet_M3N21bs16gpu2_ontrain/model_cityscapes_train_on_trainset.pth
python cityscapes_test.py --gpus 0 --test_data_list ./dataset/list/Cityscapes/cityscapes_test_list.txt --resume ./checkpoint/cityscapes/CGNet_M3N21bs16gpu2_ontrainval/model_cityscapes_train_on_trainvalset.pth
56.8 ms with command "torch.cuda.synchronize()"
20.0 ms w/o command "torch.cuda.synchronize()"
python camvid_train.py
python camvid_test.py
If CGNet is useful for your research, please consider citing:
@article{wu2020cgnet,
title={Cgnet: A light-weight context guided network for semantic segmentation},
author={Wu, Tianyi and Tang, Sheng and Zhang, Rui and Cao, Juan and Zhang, Yongdong},
journal={IEEE Transactions on Image Processing},
volume={30},
pages={1169--1179},
year={2020},
publisher={IEEE}
}
This code is released under the MIT License. See LICENSE for additional details.