• Stars
    star
    226
  • Rank 175,508 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[ECCV 2020] PyTorch Implementation of some RGBD Semantic Segmentation models.

RGBD_Semantic_Segmentation_PyTorch

license PyTorch-1.0.0

Implement some state-of-the-art methods of RGBD Semantic Segmentation task in PyTorch.

Currently, we provide code of:

  • SA-Gate, ECCV 2020 [arXiv]
  • Malleable 2.5D Convolution, ECCV 2020 [arXiv]

News

  • 2020/08/16

Official code release for the paper Malleable 2.5D Convolution: Learning Receptive Fields along the Depth-axis for RGB-D Scene Parsing, ECCV 2020. [arXiv], [code]

Thanks aurora95 for his open source code!

  • 2020/07/20

Official code release for the paper Bi-directional Cross-Modality Feature Propagation with Separation-and-Aggregation Gate for RGB-D Semantic Segmentation, ECCV 2020. [arXiv], [code]

Main Results

Results on NYU Depth V2 Test Set with Multi-scale Inference

Method mIoU (%)
3DGNN 43.1
ACNet 48.3
RDFNet-101 49.1
PADNet 50.2
PAP 50.4
Malleable 2.5D 50.9
SA-Gate 52.4

Results on CityScapes Test Set with Multi-scale Inference (out method uses output stride=16 and does not use coarse-labeled data)

Method mIoU (%)
PADNet 80.3
DANet 81.5
GALD 81.8
ACFNet 81.8
SA-Gate 82.8

For more details, please refer to our paper.

Directory Tree

Your directory tree should look like this:

./
|-- furnace
|-- model
|-- DATA
-- |-- pytorch-weight
-- |-- NYUDepthv2
   |   |-- ColoredLabel
   |   |-- Depth
   |   |-- HHA
   |   |-- Label
   |   |-- RGB
   |   |-- test.txt
   |   |-- train.txt

Installation

The code is developed using Python 3.6 with PyTorch 1.0.0. The code is developed and tested using 4 or 8 NVIDIA TITAN V GPU cards. You can change the input size (image_height and image_width) or batch_size in the config.py according to your available resources.

  1. Clone this repo.

    $ git clone https://github.com/charlesCXK/RGBD_Semantic_Segmentation_PyTorch.git
    $ cd RGBD_Semantic_Segmentation_PyTorch
  2. Install dependencies.

    (1) Create a conda environment:

    $ conda env create -f rgbd.yaml
    $ conda activate rgbd

    (2) Install apex 0.1(needs CUDA)

    $ cd ./furnace/apex
    $ python setup.py install --cpp_ext --cuda_ext

Data preparation

Pretrained ResNet-101

Please download the pretrained ResNet-101 and then put it into ./DATA/pytorch-weight.

Source Link
BaiDu Cloud Link: https://pan.baidu.com/s/1Zc_ed9zdgzHiIkARp2tCcw Password: f3ew
Google Drive https://drive.google.com/drive/folders/1_1HpmoCsshNCMQdXhSNOq8Y-deIDcbKS?usp=sharing

NYU Depth V2

You could download the official NYU Depth V2 data here. After downloading the official data, you should modify them according to the structure of directories we provide. We also provide the processed data. We will delete the link at any time if the owner of NYU Depth V2 requests.

Source Link
BaiDu Cloud Link: https://pan.baidu.com/s/1iU8m20Jv9shG_wEvwpwSOQ Password: 27uj
Google Drive https://drive.google.com/drive/folders/1_1HpmoCsshNCMQdXhSNOq8Y-deIDcbKS?usp=sharing

How to generate HHA maps?

If you want to generate HHA maps from Depth maps, please refer to https://github.com/charlesCXK/Depth2HHA-python.

Training and Inference

We just take SA-Gate as an example. You could run other models in a similar way.

Training

Training on NYU Depth V2:

$ cd ./model/SA-Gate.nyu
$ export NGPUS=8
$ python -m torch.distributed.launch --nproc_per_node=$NGPUS train.py

If you only have 4 GPU cards, you could:

$ cd ./model/SA-Gate.nyu.432
$ export NGPUS=4
$ python -m torch.distributed.launch --nproc_per_node=$NGPUS train.py
  • Note that the only difference between SA-Gate.nyu/ and SA-Gate.nyu.432/ is the training/inference image crop size.
  • The tensorboard file is saved in log/tb/ directory.

Inference

Inference on NYU Depth V2:

$ cd ./model/SA-Gate.nyu
$ python eval.py -e 300-400 -d 0-7 --save_path results
  • Here, 300-400 means we evaluate on checkpoints whose ID is in [300, 400], such as epoch-300.pth, epoch-310.pth, etc.
  • The segmentation predictions will be saved in results/ and results_color/, the former stores the original predictions and the latter stores colored version. Performance in mIoU will be written to log/*.log. You will expect ~51.4% mIoU in SA-Gate.nyu and ~51.5% mIoU in SA-Gate.nyu.432. (single scale inference with no flip)
  • For multi-scale and flip inference, please set C.eval_flip = True and C.eval_scale_array = [1, 0.75, 1.25] in the config.py. Different eval_scale_array may have different performances.

Citation

Please consider citing this project in your publications if it helps your research.

@inproceedings{chen2020-SAGate,
  title={Bi-directional Cross-Modality Feature Propagation with Separation-and-Aggregation Gate for RGB-D Semantic Segmentation},
  author={Chen, Xiaokang and Lin, Kwan-Yee and Wang, Jingbo and Wu, Wayne and Qian, Chen and Li, Hongsheng and Zeng, Gang},
  booktitle={European Conference on Computer Vision (ECCV)},
  year={2020}
}
@inproceedings{xing2020-melleable,
  title={Malleable 2.5D Convolution: Learning Receptive Fields along the Depth-axis for RGB-D Scene Parsing
},
  author={Xing, Yajie and Wang, Jingbo and Zeng, Gang},
  booktitle={European Conference on Computer Vision (ECCV)},
  year={2020}
}

Acknowledgement

Thanks TorchSeg for their excellent project!

TODO

  • More encoders such as HRNet.
  • Code and data for Cityscapes.
  • More RGBD Semantic Segmentation models

More Repositories

1

TorchSemiSeg

[CVPR 2021] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision
Python
440
star
2

PyTorch_Semantic_Segmentation

Implement some models of RGB/RGBD semantic segmentation in PyTorch, easy to run. Such as FCN, RefineNet, PSPNet, RDFNet, 3DGNN, PointNet, DeepLab V3, DeepLab V3 plus, DenseASPP, FastFCN
Python
226
star
3

Depth2HHA-python

Use python3 to convert depth image into hha image
Python
145
star
4

TorchSSC

Implement some state-of-the-art methods of Semantic Scene Completion (SSC) task in PyTorch. [1] 3D Sketch-aware Semantic Scene Completion via Semi-supervised Structure Prior (CVPR 2020)
Python
48
star
5

Depth2HHA

Use MATLAB to convert depth image into HHA image. In this repo, I will use NYU Depth V2 dataset as an example.
MATLAB
41
star
6

DIP_Final-Railway_ticket_detection

Final project of PKU DIP 2018 (火车票检测与识别)
Python
12
star
7

Chinese-QA-system

Final project of 2018 WebDatamining in PKU, Automatic QA system based on Chinese WIKI. (基于中文wiki的自动问答系统)
Python
8
star
8

PageRank-Algorithm

Implement the PageRank algorithm by python 3
Python
2
star
9

LeetCode-record

My solutions for LeetCode problems
Python
1
star
10

RankClus-Algorithm-By-Python3

My Project of 2018 PKU Data Warehouse
Jupyter Notebook
1
star
11

CAM-pytorch

CAM algorithm implemented by python3 and pytorch 0.4.0
Python
1
star
12

PKU-score-script

北大学生使用的通过爬取dean实现的自动查分脚本,Python3
Python
1
star
13

PKU-Flower-Encyclopedia

2018 PKU JAVA程序设计 Project, 花卉识别 Android APP
Java
1
star