Divyasreepat's picture
Update README.md with new model card content
c1e1d4a verified
metadata
library_name: keras-hub
license: apache-2.0
tags:
  - image-segmentation
pipeline_tag: image-segmentation

Model Overview

DeepLabv3+ model is developed by Google for semantic segmentation. This guide demonstrates how to finetune and use DeepLabv3+ model for image semantic segmentaion with KerasCV. Its architecture that combines atrous convolutions, contextual information aggregation, and powerful backbones to achieve accurate and detailed semantic segmentation. The DeepLabv3+ model has been shown to achieve state-of-the-art results on a variety of image segmentation benchmarks. This model is supported in both KerasCV and KerasHub. KerasCV will no longer be actively developed, so please try to use KerasHub. ` Weights are released under the Apache 2 License. Keras model code is released under the Apache 2 License.

Links

Installation

Keras and KerasHub can be installed with:

pip install -U -q keras-hub
pip install -U -q keras

Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the Keras Getting Started page.

Presets

The following model checkpoints are provided by the Keras team. Full code examples for each are available below.

Preset name Parameters Description
deeplab_v3_plus_resnet50_pascalvoc 39.1M DeeplabV3Plus with a ResNet50 v2 backbone. Trained on PascalVOC 2012 Semantic segmentation task, which consists of 20 classes and one background class. This model achieves a final categorical accuracy of 89.34% and mIoU of 0.6391 on evaluation dataset. This preset is only comptabile with Keras 3.

Model card

https://arxiv.org/abs/1802.02611

Example Usage

Load DeepLabv3+ presets a extension of DeepLabv3 by adding a simple yet effective decoder module to refine the segmentation results especially along object boundaries.

images = np.ones(shape=(1, 96, 96, 3))
labels = np.zeros(shape=(1, 96, 96, 2))
segmenter = keras_hub.models.DeepLabV3ImageSegmenter.from_preset(
    "deeplab_v3_plus_resnet50_pascalvoc",
)
segmenter.predict(images)

Specify num_classes to load randomly initialized segmentation head.

segmenter = keras_hub.models.DeepLabV3ImageSegmenter.from_preset(
    "deeplab_v3_plus_resnet50_pascalvoc",
    num_classes=2,
)
segmenter.preprocessor.image_size = (96, 96)
segmenter.fit(images, labels, epochs=3)
segmenter.predict(images)  # Trained 2 class segmentation.

Example Usage with Hugging Face URI

Load DeepLabv3+ presets a extension of DeepLabv3 by adding a simple yet effective decoder module to refine the segmentation results especially along object boundaries.

images = np.ones(shape=(1, 96, 96, 3))
labels = np.zeros(shape=(1, 96, 96, 2))
segmenter = keras_hub.models.DeepLabV3ImageSegmenter.from_preset(
    "hf://keras/deeplab_v3_plus_resnet50_pascalvoc",
)
segmenter.predict(images)

Specify num_classes to load randomly initialized segmentation head.

segmenter = keras_hub.models.DeepLabV3ImageSegmenter.from_preset(
    "hf://keras/deeplab_v3_plus_resnet50_pascalvoc",
    num_classes=2,
)
segmenter.preprocessor.image_size = (96, 96)
segmenter.fit(images, labels, epochs=3)
segmenter.predict(images)  # Trained 2 class segmentation.