Home

Awesome

Semantic Segmentation (Keras)


Keras implementation of semantic segmentation FCNs

Update Logs

2019-02-22: implemented several common FCNs and support Geo-tiff Images (especially for remote sensing images).

2019-03-07: tested on VOC2012 dataset (multi-class, rgb inputs) and Inria dataset (binary class, rgb inputs).

TODO

Backbones(Encoders) that have been implemented

Backbones to be implemented

FCNs that have been implemented

FCNs to be implemented


Folder Structures

.  
├── core  
│   ├── __init__.py 
|   |
│   ├── configures.py
|   | 
│   ├── encoder   
│   |   ├── __init__.py  
│   |   ├── resnet_v2.py  
│   |   ├── resnet_v2_separable.py  
│   |   ├── vggs.py  
│   |   └── xceptions.py  
│   |  
│   ├── nets  
│   |   ├── __init__.py  
│   |   ├── deeplabs.py  
│   |   ├── dense_aspp.py  
│   |   ├── fcns.py  
│   |   ├── pspnets.py  
│   |   ├── refinenets.py  
│   |   ├── segnets.py  
│   |   └── unets.py  
│   |  
│   └── utils  
│       ├── __init__.py  
│       |
│       ├── data_utils  
│       |   ├── __init__.py  
│       |   ├── image_io_utils.py  
│       |   ├── label_transform_utils.py  
│       |   ├── image_augmentation_utils.py  
|       |   ├── directory_iterator.py  
│       |   └── data_generator.py  
│       |  
│       ├── loss_utils.py  
│       ├── metric_utils.py  
│       ├── model_utils.py  
│       ├── net_utils.py  
│       ├── training_utils.py  
│       ├── predicting_utils.py  
│       └── vis_utils.py  
│     
├── data  
│   
├── examples  
│   ├── __init__.py  
│   ├── s1_generate_datasets.py  
│   ├── s2_training.py 
|   ├── directory_iterator.py 
│   └── s3_predicting.py  
│     
├── tools
|   ├── color2index.py
|   ├── generate_dataset.py
│   └── helpers.py
|
├── LICENSE  
|  
└── README.md    

Running environment

The source code was compiled in a Windows 10 platform using Python 3.6. The dependencies include:

tensorflow-gpu: 1.9, backend
Keras: 2.2.4, framework
opencv: 4.0, used for image I/O
PIL: used for image I/O
numpy: used for array operations
matplotlib: used to visualize images
tqdm: used to log iterations
GDAL: used for geo-spatial image I/O
scikit-learn: used for metric evaluation


Usage

1. Generate data sets

2. Convert colorful label to label index

The following figure shows converting colors to labels:

The following figure shows converting labels to colors:

3. Training models

dataset are organized as the following folder structure:

voc
  ├── image                         # input image
  ├── label_color                   # colorful label
  ├── label_index                   # gray indexed label
  ├── prediction                    # prediction
  ├── _temp                         # temp dir
  ├── models                        # model instance
  ├── logs                          # training logs
  ├── train.txt                     # training file names
  └── val.txt                       # validation file names

3. Applying Predicting

4. Evaluation

5. Additional

Dataset

Contact

Penghua Liu (liuph3@mail2.sysu.edu.cn), Sun Yat-sen University