NOTE : The final purpose is Using deeplabv3_plus_nv2 to do portrait segmantation !
From tensorflow/models/research/deeplab, we can know details of Deeplab v3+ (paper).
The TensorFlow DeepLab Model Zoo provides four pre_train models. Using Mibilenetv2 as feature exstractor and according to offical demo (run on Calab), I have given a tensorflow segmentation demo in my demo_mobilenetv2_deeplabv3.
These codes are implementation of mobiletv2_deeplab_v3 on pytorch.
In demo_mobilenetv2_deeplabv3, use function save_graph()
to get tensorflow graph to folder pre_train, then run tensorboard --logdir=pre_train
to open tensorboard in browser:
the net architecture mainly contains: mobilenetv2、aspp.
the mobilenetv2 in deeplabv3 is little different from original architecture at output stride and 1th block. Attention these blockks (1th 4th 6th) in code .
+-------------------------------------------+-------------------------+
| output stride
+===========================================+=========================+
| original MobileNet_v2_OS_32 | 32 |
+-------------------------------------------+-------------------------+
| self.interverted_residual_setting = [ | |
| # t, c, n, s | |
| [1, 16, 1, 1], | pw -> dw -> pw-linear |
| [6, 24, 2, 2], | |
| [6, 32, 3, 2], | |
| [6, 64, 4, 2], | stride = 2 |
| [6, 96, 3, 1], | |
| [6, 160, 3, 2], | stride = 2 |
| [6, 320, 1, 1], | |
| ] | |
+-------------------------------------------+-------------------------+
| MobileNet_v2_OS_8 | 8 |
+-------------------------------------------+-------------------------+
| self.interverted_residual_setting = [ | |
| # t, c, n, s | |
| [1, 16, 1, 1], | dw -> pw-linear |
| [6, 24, 2, 2], | |
| [6, 32, 3, 2], | |
| [6, 64, 4, 1], | stride = 1 |
| [6, 96, 3, 1], | |
| [6, 160, 3, 1], | stride = 1 |
| [6, 320, 1, 1], | |
| ] | |
+-------------------------------------------+-------------------------+
- add test codes
- add pre_train model