Image segmentation models with pre-trained backbones with Keras.
Project description
Segmentation models Zoo
Segmentation models with pretrained backbones
Unet and FPN like models
Backbone model | Name | Weights | UNet | FPN |
---|---|---|---|---|
VGG16 | vgg16 |
imagenet |
+ | + |
VGG19 | vgg19 |
imagenet |
+ | + |
ResNet18 | resnet18 |
imagenet |
+ | + |
ResNet34 | resnet34 |
imagenet |
+ | + |
ResNet50 | resnet50 |
imagenet imagenet11k-places365ch |
+ | + |
ResNet101 | resnet101 |
imagenet |
+ | + |
ResNet152 | resnet152 |
imagenet imagenet11k |
+ | + |
ResNeXt50 | resnext50 |
imagenet |
+ | + |
ResNeXt101 | resnext101 |
imagenet |
+ | + |
DenseNet121 | densenet121 |
imagenet |
+ | + |
DenseNet169 | densenet169 |
imagenet |
+ | + |
DenseNet201 | densenet201 |
imagenet |
+ | + |
Inception V3 | inceptionv3 |
imagenet |
+ | + |
Inception ResNet V2 | inceptionresnetv2 |
imagenet |
+ | + |
Installation
- Clone repositoriy to your project
$ git clone https://github.com/qubvel/segmentation_models.git
- Update submodules
$ cd segmentation_models
$ git submodule update --init --recursive
Code examples
Train Unet model:
from segmentation_models import Unet
# prepare data
x, y = ...
# prepare model
model = Unet(backbone_name='resnet34', encoder_weigths='imagenet')
model.compile('Adam', 'binary_crossentropy', ['binary_accuracy'])
# train model
model.fit(x, y)
Train FPN model:
from segmentation_models import FPN
model = FPN(backbone_name='resnet34', encoder_weigths='imagenet')
Useful trick
Freeze encoder weights for fine-tuning during first epochs of training:
from segmentation_models import FPN
from segmentation_models.utils import set_trainable
model = FPN(backbone_name='resnet34', encoder_weigths='imagenet', freeze_encoder=True)
model.compile('Adam', 'binary_crossentropy', ['binary_accuracy'])
# pretrain model decoder
model.fit(x, y, epochs=2)
# release all layers for training
set_trainable(model) # set all layers trainable and recompile model
# continue training
model.fit(x, y, epochs=100)
TODO
- Update Unet API
- Update FPN API
- Add Linknet models
- Add PSP models
- Add DPN backbones
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
segmentation_models-0.1.0.tar.gz
(20.9 kB
view hashes)
Built Distribution
Close
Hashes for segmentation_models-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6c585903f0977ccd8f38fdfa6e17f0fc06ce2604fa35a5eca0cd04529895354 |
|
MD5 | ba955314c4fa7350e20c730c0a54d91c |
|
BLAKE2b-256 | b6a684231e49716b3dbb1353c86c82fc631034e8f97bb2f317c4aab363741bac |
Close
Hashes for segmentation_models-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f28a474e926e6cfe3c8006393d46ce68207321e152bca0f8b49a29c7b402229b |
|
MD5 | 1926198ae454b87631ab7788c9c166e5 |
|
BLAKE2b-256 | 965702e6035b7a30ee93a227e69055a211086dd30438d04c5a8b1925aba8011e |