Image Segmentation
KerasFormers
Keras
PyTorch
JAX
TensorFlow
mobilevit
deeplabv3
semantic-segmentation
Instructions to use zeromodels/mobilevit_s_deeplabv3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use zeromodels/mobilevit_s_deeplabv3 with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use zeromodels/mobilevit_s_deeplabv3 with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/mobilevit_s_deeplabv3") - Notebooks
- Google Colab
- Kaggle
| pipeline_tag: image-segmentation | |
| license: apple-amlr | |
| base_model: apple/deeplabv3-mobilevit-small | |
| library_name: kerasformers | |
| tags: | |
| - keras | |
| - kerasformers | |
| - mobilevit | |
| - deeplabv3 | |
| - image-segmentation | |
| - semantic-segmentation | |
| - arxiv:2110.02178 | |
| - arxiv:2206.02680 | |
| - pytorch | |
| - jax | |
| - tf | |
| ## ***See [our collection](https://huggingface.co/collections/kerasformers/mobilevit-v1-and-v2-6a6a900d3e9e4847e4242a72) for MobileViT / MobileViTV2 DeepLabV3 segmentation.*** | |
| # Run MobileViT DeepLabV3 with Keras 3: JAX, PyTorch, or TensorFlow | |
| [](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/mobilevit/) [](https://huggingface.co/collections/kerasformers/mobilevit-v1-and-v2-6a6a900d3e9e4847e4242a72) | |
| # kerasformers/mobilevit_s_deeplabv3 | |
| Papers: [MobileViT (arXiv:{PAPER_ARXIV})]({PAPER_URL}) · [MobileViTV2 (arXiv:2206.02680)](https://arxiv.org/abs/2206.02680) · [HF Papers](https://huggingface.co/papers/2110.02178) | |
| MobileViT backbone + **DeepLabV3 ASPP** head for Pascal VOC semantic segmentation (21 classes). **Resolution is 512**, not the 256 used by ImageNet classification checkpoints. Always load the processor with `from_weights` so resize/crop match. | |
| For more details on the model, please go to the upstream [model card](https://huggingface.co/apple/deeplabv3-mobilevit-small). | |
| Pure-**Keras 3** conversion of [`apple/deeplabv3-mobilevit-small`](https://huggingface.co/apple/deeplabv3-mobilevit-small) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**. | |
| This is a **semantic segmentation** checkpoint (`MobileViTSemanticSegment`). | |
| ## ✨ Quick start | |
| ```python | |
| import os | |
| os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow" | |
| from PIL import Image | |
| from kerasformers.models.mobilevit import ( | |
| MobileViTSemanticSegment, | |
| MobileViTImageProcessor, | |
| ) | |
| model = MobileViTSemanticSegment.from_weights("kerasformers/mobilevit_s_deeplabv3") | |
| processor = MobileViTImageProcessor.from_weights("kerasformers/mobilevit_s_deeplabv3") | |
| image = Image.open("your_image.jpg").convert("RGB") | |
| output = model(processor(image)["pixel_values"], training=False) | |
| result = processor.post_process_semantic_segmentation( | |
| output, target_size=(image.height, image.width) | |
| ) | |
| print(result["segmentation"].shape) # (H, W) class ids | |
| ``` | |
| Load any DeepLabV3 MobileViT variant the same way with `from_weights("kerasformers/<variant>")`: | |
| | Variant | Hub | Family | | |
| |---|---|---| | |
| | `mobilevit_xxs_deeplabv3` | [`kerasformers/mobilevit_xxs_deeplabv3`](https://huggingface.co/kerasformers/mobilevit_xxs_deeplabv3) | MobileViT v1 | | |
| | `mobilevit_xs_deeplabv3` | [`kerasformers/mobilevit_xs_deeplabv3`](https://huggingface.co/kerasformers/mobilevit_xs_deeplabv3) | MobileViT v1 | | |
| | `mobilevit_s_deeplabv3` | [`kerasformers/mobilevit_s_deeplabv3`](https://huggingface.co/kerasformers/mobilevit_s_deeplabv3) | MobileViT v1 | | |
| | `mobilevitv2_100_deeplabv3` | [`kerasformers/mobilevitv2_100_deeplabv3`](https://huggingface.co/kerasformers/mobilevitv2_100_deeplabv3) | MobileViT v2 | | |
| | `mobilevitv2_150_deeplabv3` | [`kerasformers/mobilevitv2_150_deeplabv3`](https://huggingface.co/kerasformers/mobilevitv2_150_deeplabv3) | MobileViT v2 | | |
| ## Tips | |
| - Set `KERAS_BACKEND` **before** importing Keras / kerasformers. | |
| - Do not reuse a classification processor: seg checkpoints need 544/512. | |
| - v1 imports from `mobilevit`; v2 from `mobilevitv2`. | |
| - See [docs](https://imvision12.github.io/KerasFormers/mobilevit/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/). | |
| - Upstream: `MobileViTSemanticSegment.from_weights("hf:apple/deeplabv3-mobilevit-small")`. | |
| ## Special Thanks | |
| A huge thank you to the Apple MobileViT authors for creating and releasing these models. | |
| License: see YAML / upstream card. | |