/DeeplabV3-tf2.0

This project implements the SOTA image segmentation algorithm deeplab V3+ with tensorflow 2.0

Primary LanguagePython

DeeplabV3-tf2.0

This project implements the SOTA image segmentation algorithm deeplab V3+ with tensorflow2

dataset preparation

download COCO2017 dataset from here. unzip directory train2017, val2017 and annotations. generate dataset with the following command.

python3 create_dataset.py </path/to/train2017> </path/to/val2017> </path/to/annotations>

upon executing the script successfully, there will directory trainset and testset generated under the root directory of the source code.

train with dataset

train with multiple GPU with executing command

python3 train_eager_distributed.py

train with single GPU with executing command

python3 train_eager.py

or

python3 train_keras.py

save model

save model with command

python3 save_model.py

experimental results

here are some results of my model which can be downloaded here, pass code is nh9u. note that "bad marshal data (unknown type code)" error occurs when you load the model file deeplabv3plus.h5 with python3.7 or above version. the model is saved with python 3.6.9. you can load weights file deeplabv3plus_weights.h5 with any version of python.

Loss
train loss
train accuracy

Segmentation results

the result is not perfect. I just use the pretrained Resnet for other purpose. if you want to use deeplabv3+ seriously. you are welcome to tune the model base on this project.

how to predict with the pretrained model

segment your image with the following command

python3 test.py </path/to/image>