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

# DINO-DETR
DINO-DETR, published by IDEA Research as DINO, combines contrastive denoising training with mixed query selection on top of Deformable DETR's sparse attention. LibreYOLO ships three sizes for detection, inference only.
Tasks: Detection. Install: pip install libreyolo.
Verified against LibreYOLO v1.5.0.

## Install

DINO-DETR needs no optional extra. Everything it imports is in the base
install, using the same pure-PyTorch multi-scale deformable attention core as
LibreYOLO's Deformable DETR family.

```bash
pip install libreyolo
```

Installing `libreyolo[hub-kernels]` is optional. Once the `kernels` package is
present, LibreYOLO fetches a compiled multi-scale deformable attention kernel
from the Hugging Face Hub at runtime and uses it in place of the pure-PyTorch
core; `LIBREYOLO_HUB_KERNELS=0` turns it back off.

## Predict

Weights download from Hugging Face on first use and are cached locally.

**Python**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

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

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

**CLI**

```bash
libreyolo predict model=LibreDINODETRr50.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg 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 query
selection; `iou` is accepted for API parity but has no effect, because the
decoder is a set predictor with no NMS step. See
[prediction](/docs/v1.6.0/predict) for sources, streaming and result handling.

DINO-DETR is inference-only in LibreYOLO. Upstream trains with contrastive
denoising and Hungarian matching; that recipe is not implemented here, so
`train()` raises `NotImplementedError`.

## Variants

Three checkpoints, all at the same input resolution. `r50` and `r50s5` share a
ResNet-50 backbone and differ in how many feature-map scales feed the decoder,
four against five. `swinl` swaps the backbone for Swin-L and also samples five
scales.

## 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("LibreDINODETRr50.pt")

# val() returns a plain dict, not an object
metrics = model.val(data="my-dataset.yaml")

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

**CLI**

```bash
libreyolo val model=LibreDINODETRr50.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.

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("LibreDINODETRr50.pt")
model.export(format="onnx", imgsz=800)
model.export(format="tensorrt", imgsz=800, half=True)
```

**CLI**

```bash
libreyolo export model=LibreDINODETRr50.pt format=onnx imgsz=800
libreyolo export model=LibreDINODETRr50.pt format=tensorrt imgsz=800 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("LibreDINODETRr50.onnx")
result = model(SAMPLE_IMAGE)

print(result.boxes.xyxy)
```

## Checkpoints

Every published weight file for this family.

| File | Input (px) | Task | Weights license |
| --- | --- | --- | --- |
| `LibreDINODETRr50.pt` | 800 | Detection | apache-2.0 |
| `LibreDINODETRr50s5.pt` | 800 | Detection | apache-2.0 |
| `LibreDINODETRswinl.pt` | 800 | Detection | apache-2.0 |

## 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: DINO-DETR, IDEA Research
- Upstream license: Apache-2.0
- Upstream source: https://github.com/IDEA-Research/DINO
- LibreYOLO code: Apache-2.0
- Weights: Apache-2.0, republished at https://huggingface.co/LibreYOLO
- Interpretation: Apache-2.0 is a permissive license, so these weights can be used in commercial and closed-source products. It asks you to keep its license text and attribution notices with any copy of the weights you redistribute, and it grants a patent license. It places no obligation on your own application code, and weights you train yourself on your own data are yours. The three checkpoints come from the authors' Google Drive release rather than a Hugging Face model card, and the upstream repository does not attach a license to the checkpoint files individually, so the redistribution basis is the repository-level Apache-2.0 declaration rather than a checkpoint-specific grant.

The three official checkpoints come from the authors' Google Drive release
folder, not a Hugging Face model card. The upstream repository declares
Apache-2.0 at the repository level but does not attach a license file or
license metadata to the checkpoints themselves, so the redistribution basis is
that repository-level declaration rather than a checkpoint-specific grant.
Every LibreYOLO mirror ships the verbatim upstream Apache-2.0 license text
alongside a notice explaining this.

## Citation

```bibtex
@misc{zhang2022dino,
      title={DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection}, 
      author={Hao Zhang and Feng Li and Shilong Liu and Lei Zhang and Hang Su and Jun Zhu and Lionel M. Ni and Heung-Yeung Shum},
      year={2022},
      eprint={2203.03605},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

@inproceedings{li2022dn,
      title={Dn-detr: Accelerate detr training by introducing query denoising},
      author={Li, Feng and Zhang, Hao and Liu, Shilong and Guo, Jian and Ni, Lionel M and Zhang, Lei},
      booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
      pages={13619--13627},
      year={2022}
}

@inproceedings{
      liu2022dabdetr,
      title={{DAB}-{DETR}: Dynamic Anchor Boxes are Better Queries for {DETR}},
      author={Shilong Liu and Feng Li and Hao Zhang and Xiao Yang and Xianbiao Qi and Hang Su and Jun Zhu and Lei Zhang},
      booktitle={International Conference on Learning Representations},
      year={2022},
      url={https://openreview.net/forum?id=oMI9PjOb9Jl}
}
```

Copied from https://github.com/IDEA-Research/DINO#bibtex
