Semantic Segmentation is the process of assigning a label to every pixel in the image. This is in contrast to classification, where a single label is assigned to the entire picture. Semantic segmentation treats multiple objects of the same class as a single entity. On the other hand, there is another type called instance segmentation that treats multiple objects of the same class as distinct individual objects (or instances).
In this repo, I have only shown how to use different semantic segmentation architectures using different frameworks and libraries like fastai, PyTorch, segmentation_models, etc.
Before using these notebooks, run the command:
pip install -r requirements.txt
Then in the notebooks/
section there are several notebooks:
DeepLabV3.ipynb
: This notebook contains code for training deeplab model where model architecture is taken fromtorchvision
and training is implemented usingfastai
.U-Net(fastai).ipynb
: fastai is great library for classification and semantic segmentation tasks specially when it comes to U-Net.So, in this notebook I have implemented training of UNet using fastai only.U-Net(from scratch).ipynb
: In this notebook, I have not used any library build on top ofPyTorch
. I am building UNet from scratch and then training using torch only.U-Net(using smp).ipynb
: segmentation_models_pytorch is a great library built on top of pytorch to train segmentation models easily. There are several architectures implemented like FPN, U-Net, PSPNet, etc. So, this notebook shows how to train models usingsegmentation_models_pytorch
.fpn_segmentation.ipynb
: Code for trainingFeature Pyramid Network(FPN)
for segmentation usingsegmentation_models_pytorch
.
I have used these notebooks mainly in Kaggle competition for semantic Segmentation. This notebook can also be run in browser, just click on the binder badge to run these notebooks in browser without installing something.