DeepLab is a state-of-art deep learning model for semantic image segmentation.
Model is based on the original TF frozen graph. It is possible to load pretrained weights into this model. Weights are directly imported from original TF checkpoint.
Segmentation results of original TF model. Output Stride = 8
Segmentation results of this repo model with loaded weights and OS = 8
Results are identical to the TF model
Segmentation results of this repo model with loaded weights and OS = 16
Results are still good
Model will return tensor of shape (batch_size, height, width, num_classes)
. To obtain labels, you need to apply argmax to logits at exit layer.
from deeplab.model import Deeplabv3
deeplab_model = Deeplabv3(input_shape=(384, 384, 3), classes=4)
Alternatively you can use None as shape
deeplab_model = Deeplabv3(input_shape=(None, None, 3), classes=4)
After that you will get a usual Keras model which you can train using .fit
and .fit_generator
methods.
Useful parameters can be found in the original repository.
Important notes:
- This model doesn’t provide default weight decay, user needs to add it themselves.
- Due to huge memory use with
OS=8
, Xception backbone should be trained withOS=16
and only inferenced withOS=8
. - User can freeze feature extractor for Xception backbone (first 356 layers) and only fine-tune decoder. Right now (March 2019), there is a problem with finetuning Keras models with BN. You can read more about it here.
There are 2 available backbones. Xception backbone is more accurate, but has 25 times more parameters than MobileNetv2.
For MobileNetv2 there are pretrained weights only for alpha=1
. However, you can initiate model with different values of alpha.