All Projects → JanMarcelKezmann → TensorFlow-Advanced-Segmentation-Models

JanMarcelKezmann / TensorFlow-Advanced-Segmentation-Models

Licence: other
A Python Library for High-Level Semantic Segmentation Models based on TensorFlow and Keras with pretrained backbones.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to TensorFlow-Advanced-Segmentation-Models

Segmentation models.pytorch
Segmentation models with pretrained backbones. PyTorch.
Stars: ✭ 4,584 (+7062.5%)
Mutual labels:  segmentation, image-segmentation, unet, semantic-segmentation, pspnet, fpn, segmentation-models
Segmentation models
Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
Stars: ✭ 3,575 (+5485.94%)
Mutual labels:  segmentation, image-segmentation, unet, pspnet, fpn, segmentation-models
Multiclass Semantic Segmentation Camvid
Tensorflow 2 implementation of complete pipeline for multiclass image semantic segmentation using UNet, SegNet and FCN32 architectures on Cambridge-driving Labeled Video Database (CamVid) dataset.
Stars: ✭ 67 (+4.69%)
Mutual labels:  segmentation, fcn, image-segmentation, unet, semantic-segmentation
FCN-Segmentation-TensorFlow
FCN for Semantic Image Segmentation achieving 68.5 mIoU on PASCAL VOC
Stars: ✭ 34 (-46.87%)
Mutual labels:  segmentation, fcn, image-segmentation, semantic-segmentation
Segmentation
Tensorflow implementation : U-net and FCN with global convolution
Stars: ✭ 101 (+57.81%)
Mutual labels:  segmentation, fcn, unet, semantic-segmentation
Keras Unet
Helper package with multiple U-Net implementations in Keras as well as useful utility tools helpful when working with image semantic segmentation tasks. This library and underlying tools come from multiple projects I performed working on semantic segmentation tasks
Stars: ✭ 196 (+206.25%)
Mutual labels:  segmentation, image-segmentation, unet, semantic-segmentation
image-segmentation
Mask R-CNN, FPN, LinkNet, PSPNet and UNet with multiple backbone architectures support readily available
Stars: ✭ 62 (-3.12%)
Mutual labels:  unet, semantic-segmentation, pspnet, fpn
Entity
EntitySeg Toolbox: Towards Open-World and High-Quality Image Segmentation
Stars: ✭ 313 (+389.06%)
Mutual labels:  segmentation, image-segmentation, semantic-segmentation
Efficient Segmentation Networks
Lightweight models for real-time semantic segmentationon PyTorch (include SQNet, LinkNet, SegNet, UNet, ENet, ERFNet, EDANet, ESPNet, ESPNetv2, LEDNet, ESNet, FSSNet, CGNet, DABNet, Fast-SCNN, ContextNet, FPENet, etc.)
Stars: ✭ 579 (+804.69%)
Mutual labels:  segmentation, image-segmentation, semantic-segmentation
Hyperdensenet
This repository contains the code of HyperDenseNet, a hyper-densely connected CNN to segment medical images in multi-modal image scenarios.
Stars: ✭ 124 (+93.75%)
Mutual labels:  segmentation, fcn, image-segmentation
Segmentation-Series-Chaos
Summary and experiment includes basic segmentation, human segmentation, human or portrait matting for both image and video.
Stars: ✭ 75 (+17.19%)
Mutual labels:  segmentation, semantic-segmentation, deeplab
Bcdu Net
BCDU-Net : Medical Image Segmentation
Stars: ✭ 314 (+390.63%)
Mutual labels:  segmentation, unet, semantic-segmentation
Keras unet plus plus
keras implementation of unet plus plus
Stars: ✭ 166 (+159.38%)
Mutual labels:  segmentation, image-segmentation, unet
Fcn
Chainer Implementation of Fully Convolutional Networks. (Training code to reproduce the original result is available.)
Stars: ✭ 211 (+229.69%)
Mutual labels:  segmentation, fcn, semantic-segmentation
Seg Mentor
TFslim based semantic segmentation models, modular&extensible boutique design
Stars: ✭ 43 (-32.81%)
Mutual labels:  segmentation, fcn, semantic-segmentation
etos-deepcut
Deep Extreme Cut http://www.vision.ee.ethz.ch/~cvlsegmentation/dextr . a tool to do automatically object segmentation from extreme points.
Stars: ✭ 24 (-62.5%)
Mutual labels:  semantic-segmentation, deeplab, pspnet
ResUNetPlusPlus-with-CRF-and-TTA
ResUNet++, CRF, and TTA for segmentation of medical images (IEEE JBIHI)
Stars: ✭ 98 (+53.13%)
Mutual labels:  image-segmentation, unet, semantic-segmentation
celldetection
Cell Detection with PyTorch.
Stars: ✭ 44 (-31.25%)
Mutual labels:  unet, semantic-segmentation, fpn
Brain-MRI-Segmentation
Smart India Hackathon 2019 project given by the Department of Atomic Energy
Stars: ✭ 29 (-54.69%)
Mutual labels:  segmentation, image-segmentation, unet
Brain-Tumor-Segmentation-using-Topological-Loss
A Tensorflow Implementation of Brain Tumor Segmentation using Topological Loss
Stars: ✭ 28 (-56.25%)
Mutual labels:  segmentation, fcn, image-segmentation

TensorFlow Advanced Segmentation Models

A Python Library for High-Level Semantic Segmentation Models.

Preface

Since the breakthrough of Deep Learning and Computer Vision was always one of the core problems that researcher all over the world have worked on, to create better models every day. One Computer Vision area that got huge attention in the last couple of years is Semantic Segmentation. The task to segment every pixel on a given image led to the invention of many great models starting with the classical U-Net up to now more and more complex neural network structures. But even though many new algorithms were developed, the distribution of easy to use open source libraries which contain High-Level APIs that make the technology accessible for everyone is still far behind the huge amount of research that is published continuously.

Inspired by qubvel's segmentation_models this repository builds upon his work and extends it by a variety of recently developed models which achieved great results on the Cityscapes, PASCAL VOC 2012, PASCAL Context, ADE20K dataset and many more.

The library contains to date 14 different Semantic Segmentation Model Architecters for multi-class semantic segmentation as well as many on imagenet pretrained backbones. An important new feature is the upgrade to Tensorflow 2.x including the use of the advanced model subclassing feauture to build customized segmentation models. Further are now all system platforms compatible with the library this means that tasm can run on Windows, Linux and MacOS as well.

Main Library Features

  • High Level API
  • 14 Segmentation Model Architectures for multi-class semantic segmentation
    • New: HRNet + OCR Model
  • Many already pretrained backbones for each architecture
  • Many useful segmentation losses (Dice, Focal, Tversky, Jaccard and many more combinations of them)
  • New: Models can be used as Subclassed or Functional Model
  • New: TASM works now on all platforms, i.e. Windows, Linux, MacOS with Intel or Apple Silicon Chips

Table of Contents

Installation and Setup

To get the repository running just check the following requirements.

Requirements Windows or Linus

  1. Python 3.6 or higher
  2. tensorflow >= 2.3.0 (>= 2.0.0 is sufficient if no efficientnet backbone is used)
  3. numpy
  4. matplotlib

MacOS

  1. Python 3.9 or higher
  2. tensorflow-macos >= 2.5.0
  3. numpy >= 1.21.0
  4. matplotlib

Furthermore just execute the following command to download and install the git repository.

Clone Repository

$ git clone https://github.com/JanMarcelKezmann/TensorFlow-Advanced-Segmentation-Models.git

or directly install it:
Pip Install Repository

$ pip install git+https://github.com/JanMarcelKezmann/TensorFlow-Advanced-Segmentation-Models.git

Training Pipeline

Please check that Tensorflow is installed on your computer.

To import the library just use the standard python import statement:

import tensorflow_advanced_segmentation_models as tasm

Then pick any model backbone from the list below and define weights, height and width:

BACKBONE_NAME = "efficientnetb3"
WEIGHTS = "imagenet"
HEIGHT = 320
WIDTH = 320

Load the data

TrainingGenerator, ValidationGenerator = get_data(...)

Create the base model that works as backbone for the segmentation model:

base_model, layers, layer_names = tasm.create_base_model(name=BACKBONE_NAME, weights=WEIGHTS, height=HEIGHT, width=WIDTH)

Define a Model and compile it with an appropriate loss:

model = tasm.DANet(n_classes=3, base_model=base_model, output_layers=layers, backbone_trainable=False)
model.compile(tf.keras.optimizers.Adam(0.0001), loss=tasm.losses.CategoricalFocalLoss, tasm.metrics.IOUScore(threshold=0.5))

If you want to use the Functional Model class define instead:

model = tasm.DANet(n_classes=3, base_model=base_model, output_layers=layers, backbone_trainable=False).model()
model.compile(tf.keras.optimizers.Adam(0.0001), loss=tasm.losses.CategoricalFocalLoss, tasm.metrics.IOUScore(threshold=0.5))

Now finally train the model:

history = model.fit(
    TrainingGenerator
    batch_size=8,
    epochs=50,
    validation_data=ValidationGenerator
)

You can use the fit_generator method too, e.g. if you want to apply augmentations to the data. For complete training pipelines, go to the Examples folder

Examples

  • [Jupyter Notebook] Multi-class (3 classes) segmentation (sky, building, background) on CamVid dataset here
  • [Jupyter Notebook] Multi-class (11 classes) segmentation on CamVid dataset here
  • [Jupyter Notebook] Multi-class (11 classes) segmentation on CamVid dataset with a custom training loophere
  • [Jupyter Notebook] Two-class (2 classes) segmentation on Caltech-Birds-2010 dataset here

Models and Backbones

Models

Backbones (For Details see here.)

Type Names
VGG 'vgg16' 'vgg19'
ResNet 'resnet50' 'resnet50v2' 'resnet101' 'resnet101v2' 'resnet152' 'resnet152v2'
Xception 'xception'
MobileNet 'mobilenet' 'mobilenetv2'
NASNet 'nasnetlarge' 'nasnetmobile'
DenseNet 'densenet121' 'densenet169' 'densenet201'
EfficientNet 'efficientnetb0' 'efficientnetb1' 'efficientnetb2' 'efficientnetb3' 'efficientnetb4' 'efficientnetb5' 'efficientnetb6' efficientnetb7'
All backbones have weights trained on 2012 ILSVRC ImageNet dataset.

Further Model Information

A new feature makes it possible to define the model as a Subclassed Model or as a Functional Model instead. To define the model as a Subclassed Model just write: tasm.UNet to define the UNet or replace it with any other model. If you want to define the Functional Model instead just append .model(), i.e. tasm.UNet.model(). This provides further TensorFlow features like saving the model in the "tf" format.

Citing

@misc{Kezmann:2020,
  Author = {Jan-Marcel Kezmann},
  Title = {Tensorflow Advanced Segmentation Models},
  Year = {2020},
  Publisher = {GitHub},
  Journal = {GitHub repository},
  Howpublished = {\url{https://github.com/JanMarcelKezmann/TensorFlow-Advanced-Segmentation-Models}}
} 

License

Project is distributed under MIT License.

References

Thank you for all the papers that made this repository possible and especially thank you Pavel Yakubovskiy's initial segmentation models repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].