Home

Awesome

FuseNet

This repository contains PyTorch implementation of FuseNet-SF5 architecture from the paper FuseNet: incorporating depth into semantic segmentation via fusion-based CNN architecture. Initial model's capability has been extended to perform joint scene classification and semantic segmentation. Potential effects of scene classification, as an auxiliary task, on overall semantic segmentation quality (and vice versa) are investigated within the scope of this project.

Other implementations of FuseNet: [Caffe] [PyTorch]

<p align="center"><img src="images/framework_class.jpg" width="700px"/></p>

Installation

Prerequisites:

Clone the repository and install the required packages:

git clone https://github.com/zanilzanzan/FuseNet_PyTorch.git
cd FuseNet_PyTorch
pip install -r requirements.txt

Datasets

NYU-Depth V2

SUNRGBD

This section will be updated soon.

Training

Training from scratch

w/o classification head:

python fusenet_train.py --dataroot ./datasets/nyu_class_10_db.h5 --batch_size 8 --lr 0.005

w/ classification head:

python fusenet_train.py --dataroot ./datasets/nyu_class_10_db.h5 --batch_size 8 --lr 0.005 \
                        --num_epochs 200 --use_class True --name experiment_1

Resuming training from a checkpoint

w/o classification head:

python fusenet_train.py --dataroot ./datasets/nyu_class_10_db.h5 --resume_train True --batch_size 8 \
                        --load_checkpoint ./checkpoints/experiment/nyu/best_model.pth.tar --lr 0.01

w classification head:

python fusenet_train.py --dataroot ./datasets/nyu_class_10_db.h5 --resume_train True --use_class True --batch_size 8 \
                        --load_checkpoint ./checkpoints/experiment/nyu/best_model_class_0_00040.pth.tar --lr 0.01 \
                        --lambda_class_range 0.004 0.01 5

Note: When training a model that contains the classification head, by default the lambda value, which is the coefficient of the classification loss, is set to 0.001. In order to train the model for multiple sessions with multiple lambda values, following option should be added to the run command: --lambda_class_range start_value, end_value, steps_between. To train the model with only one session with one lambda value, set the start_value and the end_value the same, and the step_size to 1.

Inference

python fusenet_test.py --dataroot ./datasets/nyu_class_10_db.h5 --load_checkpoint ./checkpoints/nyu/best_model.pth.tar

Note: To visualize the resulting images within the testing process, add --vis_results True option.

<table align="center"> <tr> <td><b> Models on NYU V2 <td><b> Global <td><b> IoU <td> <b> Mean <tr> <td><a href="https://goo.gl/hcUFMy"><b> FuseNet-SF5 (PyTorch) </a><td> 66.0 <td> 33.4 <td> 44.2 <tr> <td><b> FuseNet-SF5 (CAFFE) </a><td> 66.0 <td> 32.7 <td> 43.4 </table>

Plotting loss and accuracy history graphs

Result Visualization

python fusenet_visualize.py --dataroot ./datasets/nyu_class_10_db.h5 \
                            --load_checkpoint ./checkpoints/experiment/nyu/best_model_class_0_00010.pth.tar
<p align="center" float="left"><img src="images/sample_visuals/7.png?raw=True" width="400px" style="margin:0px 45px"/> <img src="images/sample_visuals/9.png?raw=True" width="400px" style="margin:0px 45px"/></p> <p align="center" float="left"><img src="images/sample_visuals/8.png?raw=True" width="400px" style="margin:0px 45px"/> <img src="images/sample_visuals/10.png?raw=True" width="400px" style="margin:0px 45px"/></p> <p align="center" float="left"><img src="images/sample_visuals/6.png?raw=True" width="400px" style="margin:0px 45px"/> <img src="images/sample_visuals/11.png?raw=True" width="400px" style="margin:0px 45px"/></p>

Citing FuseNet

Caner Hazirbas, Lingni Ma, Csaba Domokos and Daniel Cremers, "FuseNet: Incorporating Depth into Semantic Segmentation via Fusion-based CNN Architecture", in proceedings of the 13th Asian Conference on Computer Vision, 2016.

@inproceedings{fusenet2016accv,
 author    = "C. Hazirbas and L. Ma and C. Domokos and D. Cremers",
 title     = "FuseNet: incorporating depth into semantic segmentation via fusion-based CNN architecture",
 booktitle = "Asian Conference on Computer Vision",
 year      = "2016",
 month     = "November",
}