2020 09 07 Alpha blend semantic segmentation - syntaxmonkey/Thesis GitHub Wiki
Alpha blend
We will attempt to perform semantic segmentation of the original image. The Semantic segmentation will be alpha blended with the original image for SLIC segmentation.
Semantic Segmentation
https://towardsdatascience.com/image-segmentation-with-six-lines-0f-code-acb870a462e8
Implementation 1:- Install pixellib: pip install pixellib Had to go through a re-install of Python. Now running on python version 3.8.
Have the sample segmentation code running.
The baseline version of the code runs against the model deeplabv3_xception_tf_dim_ordering_tf_kernels.h5. This can be downloaded here: https://github.com/ayoolaolafenwa/PixelLib/releases/download/1.1/deeplabv3_xception_tf_dim_ordering_tf_kernels.h5 This seems to have a very limited number of classes.
deeplabv3_xception65_ad320k.h5 performance
Seems to perform better: https://morioh.com/p/b04406d57772
Model download: https://github.com/ayoolaolafenwa/PixelLib/releases/download/1.3/deeplabv3_xception65_ade20k.h5
This semantic segmentation method performs best when it finds an object from its training categories, e.g. a horse. The segmentation create far more segments than expected. However, if it is an object it does not recognize, it does some odd region identification. Although not completely correct, it may still prove useful.
mask_rcnn_coco.h5 performance
Additional tutorial: https://www.analyticsvidhya.com/blog/2019/07/computer-vision-implementing-mask-r-cnn-image-segmentation/?utm_source=blog&utm_medium=introduction-image-segmentation-techniques-python
This model only highlights the objects that it recognizes.
Reducing noise of semantic segmentation
The deeplabv3 semantic segmentation can produce many smaller segments. For example, this segmentation image.
Test reducing the number of regions by testing these filters:
- Blur filter
Blur 10x10
Blur 20x20
- Bilateral filter
Bilateral(9, 75, 75)
Bilateral(20, 75, 75)
Bilateral(50, 75, 75)
- Median filter
Distance 9
Distance 19
Distance 31 --> min( ) / 20.
Distance 61 --> min( ) / 10.
Distance 121 --> min( ) / 5.
Median filter with min ( ) / 10 seems to work reasonably with deeplabv3.