RetinaNet

RetinaNet is a one-stage detector trained with focal loss, which down-weights easy negatives so a dense grid of anchors no longer needs a separate proposal stage to stay accurate. LibreYOLO ports the torchvision implementation for detection.

Tasks
detection
Sizes
r50, r50v2 at 800 px
Install
pip install libreyolo
Support tier
Inference only, since v. Predict, validate and export only. Training features do not apply.
Upstream
RetinaNet by PyTorch, BSD-3-Clause. Paper, source
Licenses
Code BSD-3-Clause, weights BSD-3-Clause. Commercial use

Install

RetinaNet 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
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreRetinaNetr50v2.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes:    print(box.cls, box.conf, box.xyxy)
CLI
libreyolo predict model=LibreRetinaNetr50v2.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 iou set the confidence and NMS thresholds; RetinaNet keeps its upstream NMS step over the dense anchor grid. See prediction for sources, streaming and result handling.

Variants

Two sizes, both ResNet-50 with a feature pyramid: r50 is the original head, and r50v2 replaces it with a GroupNorm head and a wider P6 block fed from the backbone's last stage instead of the FPN output.

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("LibreRetinaNetr50v2.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])
CLI
libreyolo val model=LibreRetinaNetr50v2.pt data=my-dataset.yaml

Export

TaskONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX: supported. Detection to TorchScript: not supportedDetection to ExecuTorch: not supportedDetection to TensorRT: not supportedDetection to OpenVINO: not supportedDetection 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

RetinaNet exports to ONNX only, at batch size 1. RetinaNet resizes to a variable, aspect-preserved input, so LibreYOLO forces dynamic=True regardless of what is passed, to keep the graph valid for sources of different shapes. An exported .onnx file loads back through LibreYOLO() on its file suffix and returns the same Results.

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreRetinaNetr50v2.pt")model.export(format="onnx", imgsz=800)
CLI
libreyolo export model=LibreRetinaNetr50v2.pt format=onnx imgsz=800
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("LibreRetinaNetr50v2.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)

Checkpoints

Every published weight file for this family.

FileInput (px)Weights license
Detection
LibreRetinaNetr50.pt800bsd-3-clause
LibreRetinaNetr50v2.pt800bsd-3-clause

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
RetinaNet, PyTorch
Upstream license
BSD-3-Clause
LibreYOLO code
MIT
Weights
BSD-3-Clause, republished at huggingface.co/LibreYOLO
Interpretation
BSD-3-Clause is a permissive license, so this code can be used in commercial and closed-source products with no obligation on your own application code. It asks only that you keep the copyright notice and disclaimer with any copy you redistribute, and it carries no patent grant. The two published checkpoints used for parity testing are not distributed in the LibreYOLO source tree: torchvision's own documentation notes that a pretrained model's terms may depend on its training data, so each Hugging Face mirror ships the BSD text on that implied basis and repeats the caveat rather than issuing an explicit checkpoint-specific grant.

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.