> This is the documentation for LibreYOLO 1.6.0. Current version: https://www.libreyolo.com/docs/models/deeplabv3

# DeepLabv3
A semantic segmentation network that pools features at several dilation rates in parallel (atrous spatial pyramid pooling) before classifying each pixel. LibreYOLO ships it for semantic segmentation only.
Tasks: Semantic segmentation. Install: pip install libreyolo.
Verified against LibreYOLO v1.5.0.

## Install

DeepLabv3 needs no optional extra. Everything it imports is in the base
install.

```bash
pip install libreyolo
```

## Predict

Weights download from Hugging Face on first use and are cached locally. The
`-sem` filename suffix is required for this family.

**Python**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("LibreDeepLabv3r50-sem.pt")
result = model(SAMPLE_IMAGE, save=True)

mask = result.semantic_mask
print(mask.data.shape)   # (H, W) class ids
print(mask.classes)      # sorted class ids present in the image
```

**CLI**

```bash
libreyolo predict model=LibreDeepLabv3r50-sem.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True
```

Semantic segmentation returns one class id per pixel, not boxes, so
`result.semantic_mask` carries a `(H, W)` array on `.data` and the list of
class ids present in the image on `.classes`. `conf`, `iou` and `max_det` are
accepted for API parity but have no effect: the model assigns a class to every
pixel by argmax, with no confidence threshold or NMS step. See
[prediction](/docs/v1.6.0/predict) for sources, streaming and result handling.

## Variants

Three backbones: dilated ResNet-50, dilated ResNet-101, and dilated
MobileNetV3-Large. This is DeepLabv3, not DeepLabv3+, so there is no decoder
stage or CRF refinement, matching torchvision's implementation rather than the
paper's own reference code.

LibreYOLO does not train DeepLabv3: `train()` raises `NotImplementedError` for
this family, which the [support tier](/docs/v1.6.0/models) above marks as inference
only. The three published checkpoints are torchvision's own COCO-with-VOC-label
weights, converted for LibreYOLO's loader.

## Validate

`val()` returns `metrics/mIoU` and `metrics/pixel_accuracy`, measured against
any dataset in the format you trained on.

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("LibreDeepLabv3r50-sem.pt")
metrics = model.val(data="my-dataset.yaml")

print(metrics["metrics/mIoU"])
print(metrics["metrics/pixel_accuracy"])
```

**CLI**

```bash
libreyolo val model=LibreDeepLabv3r50-sem.pt data=my-dataset.yaml
```

## Export

| Task | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Semantic segmentation | yes | yes |  | yes | yes |  |  |  |  |  |  |  |

A "yes" means the export is supported. An empty cell means the exporter refuses that combination.

An exported artifact loads back through `LibreYOLO()` on its file suffix, so a
`.onnx` or `.engine` file behaves like a checkpoint and returns the same
`Results`. [Export](/docs/v1.6.0/export) lists the arguments every format accepts.

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("LibreDeepLabv3r50-sem.pt")
model.export(format="onnx")
model.export(format="tensorrt", half=True)
```

**CLI**

```bash
libreyolo export model=LibreDeepLabv3r50-sem.pt format=onnx
libreyolo export model=LibreDeepLabv3r50-sem.pt format=tensorrt half=True
```

**Use the exported file**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

# The factory routes on the file suffix, so an exported artifact loads
# like any checkpoint and returns the same Results object.
model = LibreYOLO("LibreDeepLabv3r50-sem.onnx")
result = model(SAMPLE_IMAGE)

print(result.semantic_mask.data.shape)
```

## Checkpoints

Every published weight file for this family.

| File | Input (px) | Task | Weights license |
| --- | --- | --- | --- |
| `LibreDeepLabv3r50-sem.pt` |  | Semantic segmentation | bsd-3-clause |
| `LibreDeepLabv3r101-sem.pt` |  | Semantic segmentation | bsd-3-clause |
| `LibreDeepLabv3mv3-sem.pt` |  | Semantic segmentation | bsd-3-clause |

## Licensing

Check the license on the Hugging Face repository of the specific weights you download. That repository is authoritative and licenses are not always uniform across a family. This is a description of the licenses involved, not legal advice.

- Original work: DeepLabv3, PyTorch
- Upstream license: BSD-3-Clause
- Upstream source: https://github.com/pytorch/vision
- LibreYOLO code: BSD-3-Clause
- Weights: BSD-3-Clause, republished at https://huggingface.co/LibreYOLO
- Interpretation: BSD-3-Clause is a permissive license, so this code and these weights can be used in commercial and closed-source products. It asks you to keep the copyright notice, license text and a non-endorsement clause with any copy you redistribute. LibreYOLO's inference graph is torchvision's ASPP head over its ResNet-50, ResNet-101 and MobileNetV3-Large backbones; it is DeepLabv3, not DeepLabv3+, so there is no decoder or CRF, and the paper's training-only auxiliary FCN classifier is excluded. The three published checkpoints are torchvision's official COCO-with-VOC-label weights; their separate LibreYOLO Hugging Face mirrors carry BSD-3-Clause on an implied basis disclosed by torchvision rather than an explicit checkpoint-specific grant, and torchvision's own documentation notes that pretrained-model terms can depend on the training data, leaving that determination to the user.


## DeepLabv3 architecture

- r50: [SVG](/diagrams/models/deeplabv3/r50-semantic.svg), [interactive diagram](/diagrams/models/deeplabv3/r50-semantic.html)
- r101: [SVG](/diagrams/models/deeplabv3/r101-semantic.svg), [interactive diagram](/diagrams/models/deeplabv3/r101-semantic.html)
- mv3: [SVG](/diagrams/models/deeplabv3/mv3-semantic.svg), [interactive diagram](/diagrams/models/deeplabv3/mv3-semantic.html)
- ResNet shared topology: [SVG](/diagrams/models/deeplabv3/resnet-family.svg), [interactive diagram](/diagrams/models/deeplabv3/resnet-family.html)
