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

# CenterNet
CenterNet models an object as the center point of its bounding box and regresses every other property from a heatmap peak, so it needs no anchors and no non-maximum-suppression step. LibreYOLO ships it as an inference-only detector.
Tasks: Detection. Install: pip install libreyolo.
Verified against LibreYOLO v1.5.0.

## Install

CenterNet 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.

**Python**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("LibreCenterNetresdcn18.pt")
result = model(SAMPLE_IMAGE, save=True)

for box in result.boxes:
    print(box.cls, box.conf, box.xyxy)
```

**CLI**

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

**DLA-34**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("LibreCenterNetdla34.pt")
result = model(SAMPLE_IMAGE, save=True)
```

The returned `Results` object is the one every family returns, so swapping in a
different detector is a one line change. `conf` and `max_det` filter the ranked
heatmap peaks; `iou` is accepted for API parity but has no effect, because
CenterNet's top-k peak decode needs no box-IoU suppression step. See
[prediction](/docs/v1.5.0/predict) for sources, streaming and result handling.

## Variants

Two backbones. `resdcn18` pairs a ResNet-18 trunk with deformable-convolution
upsampling; `dla34` pairs a DLA-34 trunk with iterative deep-aggregation
upsampling. Both feed the same three dense heads (heatmap, width/height,
offset) and the same input canvas.

## Validate

`val()` returns a dictionary of `metrics/` keys covering precision, recall,
mAP 50 and mAP 50-95, measured against any dataset in the format you trained on.

**Python**

```python
from libreyolo import LibreYOLO

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

print(metrics["metrics/mAP50-95"])
print(metrics["metrics/mAP50"])
```

**CLI**

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

## Export

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

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

ONNX export requires opset 16 or newer: the deformable-convolution upsampling
stage in both backbones lowers to the ONNX `GridSample` operator, which opset
16 introduced. Requesting an older opset raises before tracing starts.

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("LibreCenterNetresdcn18.pt")

# ONNX export needs opset 16 or newer: the deformable-convolution
# upsampling stage lowers to GridSample, which opset 16 introduced.
model.export(format="onnx", opset=18)
model.export(format="tensorrt")
```

**CLI**

```bash
libreyolo export model=LibreCenterNetresdcn18.pt format=onnx opset=18
```

**Use the exported file**

```python
from libreyolo import LibreYOLO

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

print(result.boxes.xyxy)
```

## Checkpoints

Every published weight file for this family.

| File | Input (px) | Task | Weights license |
| --- | --- | --- | --- |
| `LibreCenterNetresdcn18.pt` | 512 | Detection | mit |
| `LibreCenterNetdla34.pt` | 512 | Detection | mit |

## 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: CenterNet, UT Austin and UC Berkeley
- Upstream license: MIT
- Upstream source: https://github.com/xingyizhou/CenterNet
- LibreYOLO code: MIT
- Weights: MIT, republished at https://huggingface.co/LibreYOLO
- Interpretation: MIT is a permissive license, so these weights can be used in commercial and closed-source products. It asks only that you keep the copyright notice and license text with any copy you redistribute, and it places no obligation on your own application code. The official ResDCN-18 and DLA-34 COCO checkpoints were published by the MIT-licensed CenterNet project but carry no separate per-checkpoint license file; LibreYOLO's mirror states MIT as implied by the releasing project rather than a publisher-confirmed, checkpoint-specific grant.

The ResDCN-18 graph also credits Microsoft's MIT-licensed
human-pose-estimation.pytorch, and the DLA-34 graph credits Fisher Yu's
BSD-3-Clause DLA implementation. LibreYOLO does not vendor the original DCNv2
extension the upstream project used; native execution runs torchvision's
BSD-3-Clause `deform_conv2d` instead, and the export-only portable
implementation was authored separately for LibreYOLO.

## Citation

```bibtex
@inproceedings{zhou2019objects,
  title={Objects as Points},
  author={Zhou, Xingyi and Wang, Dequan and Kr{\"a}henb{\"u}hl, Philipp},
  booktitle={arXiv preprint arXiv:1904.07850},
  year={2019}
}
```

Copied from https://github.com/xingyizhou/CenterNet#citation
