This project is used for deploying people segmentation model to mobile device and learning. The people segmentation android project is here. The model is another Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation (Deeplab-V3+) implementation base on MobilenetV2 / MobilenetV3 on TensorFlow.
This project uses tf.estimator
API to do training, and many code come from TensorFlow model,
This project supports 2 dataset.
- PASCAL VOC2012
- Base dataset used for test.
- You could download the augmented segmentation dataset from DrSleep.
- Supervisely People dataset.
- People Segmentation dataset.
- More data could refer to the blog
- Download from Google Drive, baidu pan, code:
8pdv
- TensorFlow v1.12.0
- Prepare pretrained MobilenetV2 model(optional)
bash prepare.sh
- Train
- train on pascal voc 2012 dataset
bash train_pascal_voc2012.sh # Tensorboard tensorboard --logdir=datasets/pascal_voc2012/exp/deeplab-v3-plus/train
- train on people segmentation dataset
mv people_segmentation.tar.gz datasets bash train_people_seg.sh # Tensorboard tensorboard --logdir=datasets/people_segmentation/exp/deeplab-v3-plus/train
- Export and Freeze model
- pascal voc 2012 dataset
bash export_pascal_voc2012.sh # Output # 1. TensorFlow Serving: datasets/pascal_voc2012/exp/deeplab-v3-plus/export/ # 2. Frozen model: datasets/pascal_voc2012/exp/deeplab-v3-plus/export/frozen_model.pb
- people segmentation dataset
bash export_people_seg.sh # Output # 1. TensorFlow Serving: datasets/people_segmentation/exp/deeplab-v3-plus/export/ # 2. Frozen model: datasets/people_segmentation/exp/deeplab-v3-plus/export/frozen_model.pb
You could modify the parameters and add new backbones network easily.
- Use
MobilenetV3
backbone: Change parameter from--backbone="MobielentV2"
to--backbone="MobilenetV3"
quant_friendly
: RemoveBN
layer afterDepthwise Convolution
, replacerelu6
withrelu
, method from A Quantization-Friendly Separable Convolution for MobileNets.
- Pascal VOC2012
Backbone | Pretrained backbone | Augmented | Input Size | ASPP | Decoder | mIOU(%) |
---|---|---|---|---|---|---|
MobilenetV2 | YES | YES | 513x513 | NO | NO | 70.51 |
- Environment: base_lr=0.007, training_steps=30000, learning_policy=poly, num_gpu=1.
- People Segmentation Dataset
Backbone | Input Size | Augmented | ASPP | Decoder | Quant-Friendly | Steps | mIOU(%) | Pretrained Model |
---|---|---|---|---|---|---|---|---|
MobilenetV2 | 256x256 | YES | NO | YES | YES | 150000 | 81.68 | model |
MobilenetV2 | 256x256 | YES | YES | YES | YES | 150000 | 83.33 | model |
MobilenetV3 | 256x256 | YES | No | YES | YES | 150000 | 81.86 | model |
MobilenetV2 | 513x513 | YES | No | YES | YES | 150000 | 89.55 | model |
- Environment: base_lr=0.05, training_steps=150000, learning_policy=poly, num_gpu=1.
Augmented
: use augmented dataset.
- Add LR-ASPP module in MobilenetV3.