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

# DexiNed
DexiNed (Dense Extreme Inception Network) is a convolutional network that predicts a dense edge-probability map from one RGB image. LibreYOLO wraps its architecture for edge detection only; no checkpoint ships with the library.
Tasks: edge. Install: pip install libreyolo.
Verified against LibreYOLO v1.5.0.

## Install

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

```bash
pip install libreyolo
```

## Predict

LibreYOLO ships no DexiNed checkpoint. The officially released weights are
trained on BIPED, whose published dataset terms restrict use to
non-commercial purposes, so LibreYOLO does not mirror them. Convert a
checkpoint you are licensed to use with `weights/convert_dexined_weights.py`,
which checks the tensor keys against the runtime architecture before writing
a file LibreYOLO can load directly:

```bash
python weights/convert_dexined_weights.py upstream.pth weights/LibreDexiNedb-edge.pt --verify
```

**Python**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("weights/LibreDexiNedb-edge.pt")
result = model(SAMPLE_IMAGE, save=True)

edges = result.edges
print(edges.array.shape)        # (H, W) float32 in [0, 1]
print(edges.binary(0.5).sum())  # thresholded edge-pixel count
```

**CLI**

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

`result.edges` holds the result: an `(H, W)` float32 array in `[0, 1]`,
with `.binary(threshold)` returning a boolean edge mask. There are no boxes,
so `conf`, `iou` and `max_det` have no effect. See
[prediction](/docs/v1.5.0/predict) for sources, streaming and result handling.

## Variants

DexiNed ships one size in LibreYOLO. LibreYOLO's benchmark harness has not
measured this family, so there are no published numbers to compare it
against.

## Validate

`val()` reports BSDS-style ODS and OIS F-measures against a paired edge
dataset: images beside same-stem edge maps, with an optional validity mask so
padded pixels never count. `imgsz` must be divisible by the network's
downsample stride, and LibreYOLO raises a clear error if it is not.

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("weights/LibreDexiNedb-edge.pt")
metrics = model.val(data="my-dataset.yaml", imgsz=352)

print(metrics["metrics/ODS"])   # optimal-dataset-scale F-measure
print(metrics["metrics/OIS"])   # optimal-image-scale F-measure
```

**CLI**

```bash
libreyolo val model=weights/LibreDexiNedb-edge.pt data=my-dataset.yaml imgsz=352
```

## Export

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

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

Edge export uses a fixed-resolution, batch-1 runtime contract: `dynamic` and a
`batch` other than 1 are rejected, and the exported graph outputs a single
fused probability map. An exported artifact loads back through `LibreYOLO()`
on its file suffix, so a `.onnx` file behaves like a checkpoint and returns
the same `Results`.

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("weights/LibreDexiNedb-edge.pt")
model.export(format="onnx", imgsz=352)
model.export(format="tensorrt", imgsz=352, half=True)
```

**CLI**

```bash
libreyolo export model=weights/LibreDexiNedb-edge.pt format=onnx imgsz=352
libreyolo export model=weights/LibreDexiNedb-edge.pt format=tensorrt imgsz=352 half=True
```

**Use the exported file**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("weights/LibreDexiNedb-edge.onnx")
result = model(SAMPLE_IMAGE)

print(result.edges.array.shape)
```

## 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: DexiNed, Xavier Soria
- Upstream license: MIT
- Upstream source: https://github.com/xavysp/DexiNed
- LibreYOLO code: MIT
- Weights: MIT, distributed by their authors. LibreYOLO does not host or mirror them.
- Interpretation: MIT is a permissive license, so the DexiNed architecture LibreYOLO ports can be used in commercial and closed-source products, with the license text and copyright notice kept alongside any copy you redistribute. LibreYOLO ships no checkpoint for this family: the officially released weights are trained on BIPED, whose published dataset terms restrict use to non-commercial purposes, and mirroring them would carry that restriction into a nominally MIT-licensed download. Convert a checkpoint you hold a license for with `weights/convert_dexined_weights.py`; the MIT code license does not change the terms attached to whatever checkpoint you convert.

LibreYOLO publishes no DexiNed checkpoint. Nothing is mirrored under the
LibreYOLO organization; convert a checkpoint you hold a license for with
`weights/convert_dexined_weights.py` instead.

## Citation

```bibtex
@INPROCEEDINGS {xsoria2020dexined,
author = {X. Soria and E. Riba and A. Sappa},
booktitle = {2020 IEEE Winter Conference on Applications of Computer Vision (WACV)},
title = {Dense Extreme Inception Network: Towards a Robust CNN Model for Edge Detection},
year = {2020},
volume = {},
issn = {},
pages = {1912-1921},
keywords = {image edge detection;convolution;training;feeds;machine learning;task analysis;kernel},
doi = {10.1109/WACV45572.2020.9093290},
url = {https://doi.ieeecomputersociety.org/10.1109/WACV45572.2020.9093290},
publisher = {IEEE Computer Society},
address = {Los Alamitos, CA, USA},
month = {mar}
}

@article{soria2023dexined_ext,
title = {Dense extreme inception network for edge detection},
journal = {Pattern Recognition},
volume = {139},
pages = {109461},
year = {2023},
issn = {0031-3203},
doi = {https://doi.org/10.1016/j.patcog.2023.109461},
url = {https://www.sciencedirect.com/science/article/pii/S0031320323001619},
author = {Xavier Soria and Angel Sappa and Patricio Humanante and Arash Akbarinia},
keywords = {Edge detection, Deep learning, CNN, Contour detection, Boundary detection, Segmentation}
}
```

Copied from https://github.com/xavysp/DexiNed#citation


## DexiNed architecture

- Base: [SVG](/diagrams/models/dexined/b-edge.svg), [interactive diagram](/diagrams/models/dexined/b-edge.html)
