Deformable DETR

Deformable DETR replaces DETR's dense cross-attention with sparse, multi-scale sampling around each reference point, which is what made transformer detectors practical to train. LibreYOLO ships five sizes for detection, inference only.

Tasks
detection
Sizes
r50ss, r50ssdc5, r50, r50refine, r50twostage at 800 px
Install
pip install libreyolo
Support tier
Inference only, since v. Predict, validate and export only. Training features do not apply.
Upstream
Deformable DETR by SenseTime, Apache-2.0. Paper, source
Licenses
Code Apache-2.0, weights Apache-2.0. Commercial use

Install

Deformable DETR needs no optional extra. Everything it imports is in the base install, using a pure-PyTorch multi-scale deformable attention core.

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
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreDeformableDETRr50.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes:    print(box.cls, box.conf, box.xyxy)
CLI
libreyolo predict model=LibreDeformableDETRr50.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 for sources, streaming and result handling.

Deformable DETR is inference-only in LibreYOLO. Upstream trains with Hungarian matching and a focal classification loss; that recipe is not implemented here, so train() raises NotImplementedError.

Variants

Five checkpoints cover the released configurations, all at the same input resolution. r50ss restricts attention to a single feature scale; r50ssdc5 adds a dilated C5 backbone stage on top of that. r50 is the default multi-scale configuration, sampling across four feature-map levels. r50refine adds iterative bounding box refinement across decoder layers, and r50twostage generates its initial region proposals from the encoder output instead of learned queries.

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
from libreyolo import LibreYOLO model = LibreYOLO("LibreDeformableDETRr50.pt") # val() returns a plain dict, not an objectmetrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])print(metrics["metrics/precision"], metrics["metrics/recall"])
CLI
libreyolo val model=LibreDeformableDETRr50.pt data=my-dataset.yaml

Export

TaskONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX: supported. Detection to TorchScript: supported. Detection to ExecuTorch: supported. Detection to TensorRT: supported. Detection to OpenVINO: supported. Detection to Paddle: not supportedDetection to MNN: not supportedDetection to RKNN: not supportedDetection to ncnn: not supportedDetection to TFLite: not supportedDetection to CoreML: not supportedDetection to Core AI: not supported

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 lists the arguments every format accepts.

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreDeformableDETRr50.pt")model.export(format="onnx", imgsz=800)model.export(format="tensorrt", imgsz=800, half=True)
CLI
libreyolo export model=LibreDeformableDETRr50.pt format=onnx imgsz=800libreyolo export model=LibreDeformableDETRr50.pt format=tensorrt imgsz=800 half=True
Use the exported file
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("LibreDeformableDETRr50.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)

Checkpoints

Every published weight file for this family.

FileInput (px)Weights license
Detection
LibreDeformableDETRr50ss.pt800apache-2.0
LibreDeformableDETRr50ssdc5.pt800apache-2.0
LibreDeformableDETRr50.pt800apache-2.0
LibreDeformableDETRr50twostage.pt800apache-2.0
LibreDeformableDETRr50refine.pt800apache-2.0

Every file above exists in the LibreYOLO org today and downloads on first use.

Licensing

Check the license on the Hugging Face repository of the specific weights you download. Every checkpoint in the LibreYOLO org carries one, and they are not always the same across a family. That repository is the authoritative source; the summary below describes what applied when this page was last verified.

This is a description of the licenses involved, not legal advice. If the answer matters commercially, read the licenses yourself and take your own counsel.

Original work
Deformable DETR, SenseTime
Upstream license
Apache-2.0
LibreYOLO code
MIT
Weights
Apache-2.0, republished at 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 five checkpoints are converted from SenseTime's own Hugging Face mirrors, each of which declares apache-2.0 in its model card; that declaration, not the original repository's Google Drive release links, is the redistribution basis.

Citation

@article{zhu2020deformable,
  title={Deformable DETR: Deformable Transformers for End-to-End Object Detection},
  author={Zhu, Xizhou and Su, Weijie and Lu, Lewei and Li, Bin and Wang, Xiaogang and Dai, Jifeng},
  journal={arXiv preprint arXiv:2010.04159},
  year={2020}
}

Copied from the authors' citation block at github.com/fundamentalvision/Deformable-DETR#citing-deformable-detr.

Verified against LibreYOLO v1.5.0. Support tables, checkpoints and benchmark numbers on this page are generated from the released library and the published weights, not written by hand.