← Open Source
bonlime

keras-deeplab-v3-plus

Keras implementation of Deeplab v3+ with pretrained weights.

Model DevelopmentArchitectureJupyter Notebook
Open on GitHub
Momentum
+0stars in 24 hours0.0%
1.37k
Stars
419
Forks
+0
This week
13
Contributors
Created 2018-03-16 · Updated 2026-09-08 · #10526 today
Top developers
bonlimebrianmandersonsachsbl

bonlime/keras-deeplab-v3-plus is ranked 10,526 with 1,374 stars.

Same-category comparison

bonlime/keras-deeplab-v3-plus is ranked 10,526 among these 8 peers; allenai/objaverse-xl is ranked 10,524.

Same-category comparison
NameRankMetrics
erwincoumans/tiny-differentiable-simulator10,521
Language:
C++
Stars:
1,376
Forks:
139
Description:
Tiny Differentiable Simulator is a header-only C++ and CUDA physics library for reinforcement learning and robotics with zero dependencies.
giacomelli/GeneticSharp10,522
Language:
C#
Stars:
1,376
Forks:
343
Description:
GeneticSharp is a fast, extensible, multi-platform and multithreading C# Genetic Algorithm library that simplifies the development of applications using Genetic Algorithms (GAs).
tinkoff-ai/CORL10,523
Language:
Python
Stars:
1,376
Forks:
177
Description:
High-quality single-file implementations of SOTA Offline and Offline-to-Online RL algorithms: AWAC, BC, CQL, DT, EDAC, IQL, SAC-N, TD3+BC, LB-SAC, SPOT, Cal-QL, ReBRAC.
allenai/objaverse-xl10,524
Language:
Python
Stars:
1,375
Forks:
92
Description:
🪐 Objaverse-XL is a Universe of 10M+ 3D Objects. Contains API Scripts for Downloading and Processing.
open-mmlab/mmfashion10,528
Language:
Python
Stars:
1,374
Forks:
297
Description:
Open-source toolbox for visual fashion analysis based on PyTorch.
akamaster/pytorch_resnet_cifar1010,532
Language:
Python
Stars:
1,373
Forks:
343
Description:
Proper implementation of ResNet-s for CIFAR10/100 in pytorch that matches description of the original paper.
bytedance/flux10,533
Language:
C++
Stars:
1,373
Forks:
118
Description:
A fast communication-overlapping library for tensor/expert parallelism on GPUs.
sintel-dev/Orion10,535
Language:
Python
Stars:
1,373
Forks:
208
Description:
Unsupervised time series anomaly detection library.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguageJupyter Notebook
CategoryModel Development
SubcategoryArchitecture
Stars1,374
Forks419
Contributors13
Created date2018-03-16
Updated date2026-09-08
Stars in 1 day0
Stars in 7 days0
Rank10,526
Previous rank10,523
Rank change-3
7-day stars rank12,665
Previous 7-day stars rank12,690
7-day stars rank change25
Total stars rank8,694
Previous total stars rank8,683
Total stars rank change-11
CountryRussia
README summary

Keras implementation of Deeplabv3+ **This repo is not longer maintained. I won't respond to issues but will merge PR** DeepLab is a state-of-art deep learning model for semantic image segmentation. Model is based on the original TF frozen graph. It is possible to load pretrained weights into this model. Weights are directly imported from original TF checkpoint. Segmentation results of original TF model. __Output Stride = 8__ Segmentation results of this repo model with loaded weights and __OS = 8

__ Results are identical to the TF model Segmentation results of this repo model with loaded weights and __OS = 16__ Results are still good How to get labels Model will return tensor of shape . To obtain labels, you need to apply argmax to logits at exit layer. Example of predicting on : How to use this model with custom input shape and custom number of classes After that you will get a usual Keras model which you can train using and methods

. How to train this model Useful parameters can be found in the original repository. This model doesn’t provide default weight decay, user needs to add it themselves. Due to huge memory use with , Xception backbone should be trained with and only inferenced with . User can freeze feature extractor for Xception backbone (first 356 layers) and only fine-tune decoder. Right now (March 2019), there is a problem with finetuning Keras models with BN. Known issues This model can be

retrained check this notebook. Finetuning is tricky and difficult because of the confusion between and in Keras. See this issue for a discussion and possible alternatives. How to load model In order to load model after using model. save() use this code: Xception vs MobileNetv2 There are 2 available backbones. Xception backbone is more accurate, but has 25 times more parameters than MobileNetv2. For MobileNetv2 there are pretrained weights only for . However, you can initiate model with different values of

alpha. Requirement The latest vesrion of this repo uses TF Keras, so you only need TF 2.

Frequently asked questions

How many stars and forks are recorded?

bonlime/keras-deeplab-v3-plus has 1,374 stars and 419 forks.

What is the repository rank?

bonlime/keras-deeplab-v3-plus is ranked 10,526.

What language and category are recorded?

bonlime/keras-deeplab-v3-plus has 1,374 stars, uses Jupyter Notebook and belongs to Model Development.

Which repository is closest in rank?

bonlime/keras-deeplab-v3-plus is compared with allenai/objaverse-xl, ranked 10,524 with 1,375 stars.

README

Keras implementation of Deeplabv3+

This repo is not longer maintained. I won't respond to issues but will merge PR
DeepLab is a state-of-art deep learning model for semantic image segmentation.

Model is based on the original TF frozen graph. It is possible to load pretrained weights into this model. Weights are directly imported from original TF checkpoint.

Segmentation results of original TF model. Output Stride = 8

 ![](imgs/seg_results1.png) 
 ![](imgs/seg_results2.png) 
 ![](imgs/seg_results3.png) 

Segmentation results of this repo model with loaded weights and OS = 8
Results are identical to the TF model

 ![](imgs/my_seg_results1_OS8.png) 
 ![](imgs/my_seg_results2_OS8.png) 
 ![](imgs/my_seg_results3_OS8.png) 

Segmentation results of this repo model with loaded weights and OS = 16
Results are still good

 ![](imgs/my_seg_results1_OS16.png) 
 ![](imgs/my_seg_results2_OS16.png) 
 ![](imgs/my_seg_results3_OS16.png) 

How to get labels

Model will return tensor of shape (batch_size, height, width, num_classes). To obtain labels, you need to apply argmax to logits at exit layer. Example of predicting on image1.jpg:

import numpy as np
from PIL import Image
from matplotlib import pyplot as plt

from model import Deeplabv3

# Generates labels using most basic setup.  Supports various image sizes.  Returns image labels in same format
# as original image.  Normalization matches MobileNetV2

trained_image_width=512 
mean_subtraction_value=127.5
image = np.array(Image.open('imgs/image1.jpg'))

# resize to max dimension of images from training dataset
w, h, _ = image.shape
ratio = float(trained_image_width) / np.max([w, h])
resized_image = np.array(Image.fromarray(image.astype('uint8')).resize((int(ratio * h), int(ratio * w))))

# apply normalization for trained dataset images
resized_image = (resized_image / mean_subtraction_value) - 1.

# pad array to square image to match training images
pad_x = int(trained_image_width - resized_image.shape[0])
pad_y = int(trained_image_width - resized_image.shape[1])
resized_image = np.pad(resized_image, ((0, pad_x), (0, pad_y), (0, 0)), mode='constant')

# make prediction
deeplab_model = Deeplabv3()
res = deeplab_model.predict(np.expand_dims(resized_image, 0))
labels = np.argmax(res.squeeze(), -1)

# remove padding and resize back to original image
if pad_x > 0:
    labels = labels[:-pad_x]
if pad_y > 0:
    labels = labels[:, :-pad_y]
labels = np.array(Image.fromarray(labels.astype('uint8')).resize((h, w)))

plt.imshow(labels)
plt.waitforbuttonpress()

How to use this model with custom input shape and custom number of classes

from model import Deeplabv3
deeplab_model = Deeplabv3(input_shape=(384, 384, 3), classes=4)  
#or you can use None as shape
deeplab_model = Deeplabv3(input_shape=(None, None, 3), classes=4)

After that you will get a usual Keras model which you can train using .fit and .fit_generator methods.

How to train this model

Useful parameters can be found in the original repository.

Important notes:

  1. This model doesn’t provide default weight decay, user needs to add it themselves.
  2. Due to huge memory use with OS=8, Xception backbone should be trained with OS=16 and only inferenced with OS=8.
  3. User can freeze feature extractor for Xception backbone (first 356 layers) and only fine-tune decoder. Right now (March 2019), there is a problem with finetuning Keras models with BN. You can read more about it here.

Known issues

This model can be retrained check this notebook. Finetuning is tricky and difficult because of the confusion between training and trainable in Keras. See this issue for a discussion and possible alternatives.

How to load model

In order to load model after using model.save() use this code:

from model import relu6
deeplab_model = load_model('example.h5')

Xception vs MobileNetv2

There are 2 available backbones. Xception backbone is more accurate, but has 25 times more parameters than MobileNetv2.

For MobileNetv2 there are pretrained weights only for alpha=1. However, you can initiate model with different values of alpha.

Requirement

The latest vesrion of this repo uses TF Keras, so you only need TF 2.0+ installed
tensorflow-gpu==2.0.0a0
CUDA==9.0


If you want to use older version, use following commands:

git clone https://github.com/bonlime/keras-deeplab-v3-plus/
cd keras-deeplab-v3-plus/
git checkout 714a6b7d1a069a07547c5c08282f1a706db92e20

tensorflow-gpu==1.13
Keras==2.2.4

Nearby in the ranking
Similar items