• Stars
    star
    804
  • Rank 54,645 (Top 2 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tensorflow Implementation of the Semantic Segmentation DeepLab_V3 CNN

DOI

DeepLab_V3 Image Semantic Segmentation Network

Implementation of the Semantic Segmentation DeepLab_V3 CNN as described at Rethinking Atrous Convolution for Semantic Image Segmentation.

For a complete documentation of this implementation, check out the blog post.

Dependencies

  • Python 3.x
  • Numpy
  • Tensorflow 1.10.1

Downloads

Evaluation

Pre-trained model.

Place the checkpoints folder inside ./tboard_logs. If the folder does not exist, create it.

Retraining

Original datasets used for training.

Place the tfrecords files inside ./dataset/tfrecords. Create the folder if it does not exist.

Training and Eval

Once you have the training and validation TfRefords files, just run the command bellow. Before running Deeplab_v3, the code will look for the proper ResNets checkpoints inside ./resnet/checkpoints, if the folder does not exist, it will first be downloaded.

python train.py --starting_learning_rate=0.00001 --batch_norm_decay=0.997 --crop_size=513 --gpu_id=0 --resnet_model=resnet_v2_50

Check out the train.py file for more input argument options. Each run produces a folder inside the tboard_logs directory (create it if not there).

To evaluate the model, run the test.py file passing to it the model_id parameter (the name of the folder created inside tboard_logs during training).

Note: Make sure the test.tfrecords is downloaded and placed inside ./dataset/tfrecords.

python test.py --model_id=16645

Retraining

To use a different dataset, you just need to modify the CreateTfRecord.ipynb notebook inside the dataset/ folder, to suit your needs.

Also, be aware that originally Deeplab_v3 performs random crops of size 513x513 on the input images. This crop_size parameter can be configured by changing the crop_size hyper-parameter in train.py.

Datasets

To create the dataset, first make sure you have the Pascal VOC 2012 and/or the Semantic Boundaries Dataset and Benchmark datasets downloaded.

Note: You do not need both datasets.

  • If you just want to test the code with one of the datasets (say the SBD), run the notebook normally, and it should work.

After, head to dataset/ and run the CreateTfRecord.ipynb notebook.

The custom_train.txt file contains the name of the images selected for training. This file is designed to use the Pascal VOC 2012 set as a TESTING set. Therefore, it doesn't contain any images from the VOC 2012 val dataset. For more info, see the Training section of Deeplab Image Semantic Segmentation Network.

Obs. You can skip that part and direct download the datasets used in this experiment - See the Downloads section

Serving

For full documentation on serving this Semantic Segmentation CNN, refer to How to deploy TensorFlow models to production using TF Serving.

All the serving scripts are placed inside: ./serving/.

To export the model and to perform client requests do the following:

  1. Create a python3 virtual environment and install the dependencies from the serving_requirements.txt file;

  2. Using the python3 env, run deeplab_saved_model.py. The exported model should reside into ./serving/model/;

  3. Create a python2 virtual environment and install the dependencies from the client_requirements.txt file;

  4. From the python2 env, run the deeplab_client.ipynb notebook;

Results

  • Pixel accuracy: ~91%
  • Mean Accuracy: ~82%
  • Mean Intersection over Union (mIoU): ~74%
  • Frequency weighed Intersection over Union: ~86

Results

More Repositories

1

SimCLR

PyTorch implementation of SimCLR: A Simple Framework for Contrastive Learning of Visual Representations
Jupyter Notebook
2,100
star
2

PyTorch-BYOL

PyTorch implementation of Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning
Jupyter Notebook
457
star
3

blog-resources

This repo will contain the resources available in my blog for learning
Jupyter Notebook
92
star
4

face-similarity

Face-similarity CNN using Tensorflow Eager execution.
Python
70
star
5

SimCLR-tensorflow

TensorFlow Implementation of SimCLR: A Simple Framework for Contrastive Learning of Visual Representations
Python
23
star
6

cnn_denoiser

Jupyter Notebook
19
star
7

tensorflow2.0-papis-workshop

Jupyter Notebook
9
star
8

dense-net

Tensorflow implementation of Densely Connected Convolutional Networks - DenseNet
Python
9
star
9

fishers-linear-discriminant

Implementation of Fisher's Linear Discriminant (LDA)
Jupyter Notebook
9
star
10

sthalles.github.io

SCSS
7
star
11

logistic-regression

Jupyter Notebook
5
star
12

CLoVE

Official PyTroch implementation for Self-supervised Learning of Contextualized Local Visual Embeddings (CLoVE)
Python
5
star
13

carp

Official PyTorch implementation of Representation Learning via Consistent Assignment of Views over Random Partitions (CARP)
Python
4
star
14

PIRL

TensorFlow implementation of Self-Supervised Learning of Pretext-Invariant Representations - PIRL
Jupyter Notebook
4
star
15

computer-vision

Jupyter Notebook
3
star
16

aerial-image-segmentation

Python
2
star
17

vision-transformer

PyTorch Vision Transformer Implementation
Python
1
star
18

asynchronous-advantage-actor-critic

Python
1
star
19

tensorflow-tutorials

Tensorflow Colab Notebooks used for training.
Jupyter Notebook
1
star
20

xor-lstm

Build an LSTM model for learning the XOR function.
Jupyter Notebook
1
star
21

resume

my resumes
TeX
1
star
22

MaSSL

Official PyTroch implementation for *Learning from Memory: A Non-Parametric Memory Augmented Self-Supervised Learning of Visual Features*
1
star