预训练与微调需另行下载 DINOv2/v3 等预训练权重;商用或生产部署需单独申请商业许可;实例分割数据格式需在 yolo 与 coco 中显式指定。
lightly-train
lightly-aiAGPL-3.0活跃维护一站式视觉模型训练工具,支持 YOLO、ViT、RT-DETR、DINOv3 等模型的预训练、微调与知识蒸馏,省去自己搭训练流程的麻烦。
All-in-one training for vision models (YOLO, ViTs, RT-DETR, DINOv3): pretraining, fine-tuning, distillation.
pip install lightly-trainREADME 未说明最低显存要求;基准延迟在单张 NVIDIA T4 上以 TensorRT FP16 测得,并支持 MIGraphX 导出用于 AMD GPU。
一站式视觉模型训练框架,覆盖预训练、微调与蒸馏,支持 YOLO、ViT、DETR 系列
一站式视觉模型训练工具,支持 YOLO、ViT、RT-DETR、DINOv3 等模型的预训练、微调与知识蒸馏,省去自己搭训练流程的麻烦。
核心能力
- 用 DINOv2/v3 在无标注数据上预训练视觉基础模型
- 微调 LTDETR/LTDETRv2 做检测与实例分割
- 支持 EoMT 方法做 DINOv2/v3 语义分割
- 蒸馏 DINOv3 权重训练自定义小模型
- 导出 ONNX/TensorRT 并附 C++ 推理示例
容易踩的坑
- v0.18.0最新正式版2026-10-24 · 2026-10-24 13:24 UTC
Added
- Add C++ inference recipes for LT-DETR object detection with ONNX Runtime (CUDA execution provider) and TensorRT, both with zero-copy GPU input/output.
- Add export and inference examples for LT-DETR object detection with MIGraphX on AMD GPUs.
- Add multi-scale feature support to torchvision (ResNet, ConvNeXt, ShuffleNetV2) and ECViT backbones. The torchvision backbones are now available for linear semantic segmentation, for example with
model="torchvision/resnet50-linear". - Add an optional
faster-coco-evalbackend that makes the object detection mAP computation during validation ~5x faster with identical results. Install it withpip install "lightly-train[faster-coco-eval]"and it is used automatically. Select the backend explicitly withmetric_args={"map": {"backend": ...}}. - Add
gradient_accumulation_stepstolightly_train.pretrain(). Known limitation: withgradient_accumulation_steps > 1, thedinoanddenseclmethods update their teacher/key encoder, center, and queues on every micro-batch instead of once per optimizer step. - Add opt-in activation checkpointing for DINOv2, DINOv3, and ECViT backbones during pretraining with
activation_checkpoint_args={"enabled": True}. Reduces peak GPU memory by ~30% on ViT-S/14. - Make the aspect ratio range of the random resized crop configurable with
min_ratioandmax_ratio:transform_args={"random_resize": {...}}for pretraining andtransform_args={"random_crop": {...}}for classification fine-tuning. The default stays(3 / 4, 4 / 3). - Restore the DINOv3.1 pretraining method.
Changed
- Fine-tuning now requires
torchmetrics>=1.5and fails with a clear error otherwise, for example when SuperGradients is installed. Object detection previously ran on older versions but reported mAP from an outdated implementation that does not match COCO eval. - Pretraining now raises an error for
trainer_args={"accumulate_grad_batches": ...}. Usegradient_accumulation_stepsinstead. - The licensing docs and the license notice stored in checkpoints and ONNX exports now state that AGPL-3.0 also covers trained model weights.
Fixed
- Fix DINOv3
-notpretrainedmodel names silently loading pretrained weights. Every DINOv3 backbone size now has a workingdinov3/<size>-notpretrained-ltdetranddinov3/<size>-notpretrained-linearmodel name. Also adddinov2/vits14-noreg-notpretrained-ltdetr. - Fix
dinov3/<size>-eupe-ltdetrmodel names loading non-EUPE weights. - Fix
transform_args={"random_resize": None}during pretraining still center cropping images that are not roughly square. - Fix
data_time,batch_timeanddata_waitmetrics on CUDA. - Support the timm model families added in timm 1.0.29 and 1.0.30 (
cpubone,lowformer,lcnetv2,deepseek_vit,qwen3_vit,iformer,efficientvim).
What's Changed
- Add C++ inference recipes for LT-DETR object detection by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/909
- Make dinov31 available again by @liopeer in https://github.com/lightly-ai/lightly-train/pull/920
- Update object detection benchmark plot by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/923
- MIGraphX Support by @liopeer in https://github.com/lightly-ai/lightly-train/pull/912
- Add gradient_accumulation_steps to pretrain/train API by @tetelias in https://github.com/lightly-ai/lightly-train/pull/743
- Add activation checkpointing for ViT backbones by @XAheli in https://github.com/lightly-ai/lightly-train/pull/930
- Fix broken "Monitor training progress" docs link by @minutechreview in https://github.com/lightly-ai/lightly-train/pull/934
- Fix LT-DETRv2-S mAP in object detection benchmark plot by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/938
- Fix misleading data_time / batch_time / data_wait metrics o
- v0.17.02026-07-28 · 2026-07-28 19:22 UTC
查看更新说明
[0.17.0] - 2026-07-28
Added
Changed
- Raise the default mixup and mosaic probability from
0.5to0.75forltdetrv2-s/m/l/xobject detection models. Other LTDETR models are unaffected. - Lower the default
backbone_lr_factorfrom0.05to0.0025forltdetrv2-m/l/xobject detection models.ltdetrv2-sand other LTDETR models are unaffected.
Deprecated
Removed
Fixed
- Fix incorrect TensorRT inference for LT-DETR object detection and instance
segmentation. TensorRT's optimizer/fusion pass around the
GridSampleops used by deformable attention silently produced wrong activations, corrupting detections and masks, even with parser-compatible mode names. Deployment/export now replacesgrid_samplewith a gather-based bilinear equivalent that contains noGridSampleop, so neither the parser mode-name issue nor the optimizer bug can apply; training keeps the faster fusedgrid_sample.
Security
What's Changed
- feat: add ltdetrv2-m-coco and ltdetrv2-l-coco checkpoint aliases by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/887
- Add aligned delta1 to metric depth benchmarks by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/913
- Update README with LTDETRv2 m/l benchmark results by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/894
- docs: add ltdetrv2 m/l COCO benchmarks and checkpoints by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/900
- Document LTDETRv2 instance segmentation by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/906
- Match ltdetrv2 mixup/mosaic and backbone LR to benchmark recipe by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/914
- Fix LT-DETR ONNX verification by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/916
- Fix TensorRT GridSample inference for LT-DETR by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/917
- Fix object detection export notebook inference by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/918
- release v0.17.0 by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/919
Full Changelog: https://github.com/lightly-ai/lightly-train/compare/v0.16.4...v0.17.0
- Raise the default mixup and mosaic probability from
- v0.16.42026-07-24 · 2026-07-24 18:25 UTC
查看更新说明
[0.16.4] - 2026-07-24
Added
- Add TIPSv2 vision backbones:
dinov2/vitb14-tipsv2,dinov2/vitl14-tipsv2,dinov2/vitso400m14-tipsv2, anddinov2/vitg14-tipsv2. - Add LTDETRv2 instance segmentation with
ltdetrv2-seg-s/m/l/xmodels and COCO-pretrained checkpoints for fine-tuning or out-of-the-box inference. - Add SAHI inference for LTDETRv2 instance segmentation through
model.predict_sahi().
Changed
- Warn when a built-in distillation teacher is used with non-ImageNet input normalization, which can produce invalid teacher features.
Removed
- Remove the DINOv3.1 pretraining method.
Fixed
- Preserve exponential-moving-average updates when resuming training, preventing a spurious validation-metric drop after the first resumed update.
- Skip degenerate predicted boxes during validation visualization and log a warning instead of crashing.
- Restore installation and package imports by using a released LightlySSL dependency.
What's Changed
- Install git in Docker image by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/899
- Add TIPSv2 Support by @guarin in https://github.com/lightly-ai/lightly-train/pull/701
- Preserve EMA updates when resuming training by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/892
- Add SAHI inference for LT-DETRv2 instance segmentation by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/895
- Add documentation on normalization for distillation by @liopeer in https://github.com/lightly-ai/lightly-train/pull/901
- Add LTDETRv2 segmentation COCO checkpoints and defaults by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/902
- Add benchmark script for inference by @liopeer in https://github.com/lightly-ai/lightly-train/pull/897
- Reorganize task sections across the README and documentation by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/905
- fix: skip degenerate predicted boxes in val visualization instead of crashing by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/907
- Update README for LTDETRv2 instance segmentation by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/908
- Remove dinov31 by @liopeer in https://github.com/lightly-ai/lightly-train/pull/910
- Bump version to 0.16.4 by @liopeer in https://github.com/lightly-ai/lightly-train/pull/911
Full Changelog: https://github.com/lightly-ai/lightly-train/compare/v0.16.3...v0.16.4
- Add TIPSv2 vision backbones:
- v0.16.32026-07-22 · 2026-07-22 09:33 UTC
查看更新说明
[0.16.3] - 2026-07-22
Added
- Add support for LingBot Vision backbones
dinov3/vits16-lingbot,dinov3/vitb16-lingbot, anddinov3/vitl16-lingbot. - Add LingBot Vision backbones to the DINOv3 EoMT semantic, panoptic, and instance
segmentation tasks:
dinov3/vits16-lingbot-eomt,dinov3/vitb16-lingbot-eomt, anddinov3/vitl16-lingbot-eomt. - Add tiny, tiny-plus, and small Depth Anything V3 depth estimation models — the
smallest and fastest so far, distilled from ViT-L:
dinov3/dav3-relative-tiny,dinov3/dav3-relative-tiny-plus,dinov2/dav3-relative-small,dinov3/dav3-metric-tiny,dinov3/dav3-metric-tiny-plus, anddinov2/dav3-metric-small.
Changed
- ONNX export for LT-DETR object detection now returns raw logits and normalized bounding boxes. Postprocessing is supposed to be applied outside the graph.
Deprecated
Removed
- Remove the DINOv3 EoMT semantic segmentation training
model_args.patch_sizeoption. The patch size is now determined by the selected model name; use adinov3/vit*32-eomtmodel, such asdinov3/vits32-eomt-coco, to train with patch size 32.
Fixed
- Fix ONNX export verification for task models:
Tensor.is_floating_pointwas referenced without calling it, so the always-truthy bound method forced integer outputs (e.g. labels) through the float comparison path instead of the intended exact-match check.
Security
What's Changed
- docs(settings): document nancapture debug utility by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/842
- Fix uncalled
Tensor.is_floating_pointin ONNX export verification by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/855 - Add model registry for eomt instance segmentation by @liopeer in https://github.com/lightly-ai/lightly-train/pull/857
- Refactor YAML loading for datasets by @liopeer in https://github.com/lightly-ai/lightly-train/pull/852
- Model registry for EoMT Semantic Segmentation by @liopeer in https://github.com/lightly-ai/lightly-train/pull/859
- Add DINOv3 ViT-Tiny/TinyPlus and ViT-S depth estimation inference variants by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/863
- Add model registry for picodet by @liopeer in https://github.com/lightly-ai/lightly-train/pull/862
- Add ONNX and TensorRT export for LT-DETR instance segmentation by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/861
- Add PCA feature visualization notebook by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/865
- Add debugging tools tutorial by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/856
- Integrate Jupyter notebooks into documentation by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/864
- Use weakly typed networks by default for TensorRT export by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/870
- Model registries for panoptic models by @liopeer in https://github.com/lightly-ai/lightly-train/pull/868
- Apply all EdgeCrafter spatial feature blocks by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/871
- Add LingBot-Vision Support by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/874
- Use LT-DETRv2 models in task training tests by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/866
- Add: dinov31 DINOv2 post-train method with PaKA dense-relational loss by @IgorSusmelj in https://github.com/lightly-ai/lightly-train/pull/837
- Uploading Depth Anything v3 Checkpoints by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/858
- feat(ltdetr): enforce 4 px min bbox guard in train transforms (TRN-2312) by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/869
- Add: adamw8bit optimizer support for lower memory usage by @IgorSusmelj in htt
- Add support for LingBot Vision backbones
- v0.16.22026-07-10 · 2026-07-10 08:46 UTC
查看更新说明
[0.16.2] - 2026-07-10
Added
- Add
NaNCapturefor fine-tuning debugging: when a NaN/Inf is detected in parameter gradients during training, save a self-contained capture (model state dict + TrainModel class/init kwargs + the step's microbatches + RNG state) toout_dir/debug/nan_capture/rank{R}/nan_capture.ptand halt training. Replay vialightly_train._debug.nan_capture.load_nan_capture(dir).replay()to deterministically reproduce the failure in a notebook/REPL. Enable withdebug_args.nancapture.enabled=True. - Add ONNX and TensorRT export for depth estimation models via the
export_onnxandexport_tensorrtmethods ofDepthAnythingDepthEstimation. - Add a
process_res_methodargument to depth estimationpredict/predict_batch:"square_resize"(default),"upper_bound_resize", or"lower_bound_resize".
Changed
- Consolidate the separate Depth Anything V2/V3 depth estimation task models into a
single config-driven
DepthAnythingDepthEstimationmodel. - Depth estimation
predict/predict_batchnow default tosquare_resize(previously aspect-preserving upper/lower-bound per model), changing default depth outputs. Passprocess_res_method="upper_bound_resize"/"lower_bound_resize"to restore the previous geometry.
Removed
- Removes the
DINOv3LTDETRObjectDetectionandDINOv2LTDETRObjectDetectionclasses in favor of the newLTDETRObjectDetectionclass. For the user, this changes nothing, since they don't use the class directly, but only its methods, which will remain available.
Fixed
- Fixed an issue with legacy LT-DETR checkpoints that used a [0,1] normalization instead of the now-default ImageNet normalization.
What's Changed
- Consolidate Depth Estimation Tasks (attempt 2) by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/823
- Add 0.16.0 LTDETRv2 news entry to index by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/825
- Configs for LTDETR OD by @liopeer in https://github.com/lightly-ai/lightly-train/pull/819
- Rename everything in LT-DETR from DINOv3 to Generic by @liopeer in https://github.com/lightly-ai/lightly-train/pull/820
- feat: integrate HF DebugUnderflowOverflow into fine-tuning by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/814
- Reduce Double-Truth for LT-DETR Checkpoints and Aliases by @liopeer in https://github.com/lightly-ai/lightly-train/pull/831
- Add ONNX/TensorRT Support to Depth Estimation by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/824
- Completely Reproduce DINOv2 LT-DETR in Generic One by @liopeer in https://github.com/lightly-ai/lightly-train/pull/830
- Refactor task model for instance segmentation to remove DINOv3 by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/833
- Refactor EoMT segmentation transforms into a shared package by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/834
- feat: add NaN capture and replay for fine-tuning by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/826
- docs(_debug): document debug_args training setting by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/829
- docs: add model instability debugging page by @gabrielfruet in https://github.com/lightly-ai/lightly-train/pull/813
- Refactor Object Detection Transforms by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/835
- Refactor Image Processing for Depth Estimation by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/846
- Add LightlyTrain Banner to Readme by @mrpositron in https://github.com/lightly-ai/lightly-train/pull/848
- Add Instance Segmentation Transforms by @yutong-xiang-97 in https://github.com/lightly-ai/lightly-train/pull/836
- Add
train_model.pyfor LTDETR instance segmentation by @yutong-xiang-97 in https://github.com/lightly-ai/lightly
- Add
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
LightlyTrain is the leading framework for transforming your data into state-of-the-art computer vision models. It covers the entire model development lifecycle from pretraining DINOv2/v3 vision foundation models on your unlabeled data to fine-tuning transformer and YOLO models on detection and segmentation tasks for edge deployment.
Struggling to get good results with pre-training? Talk to one of our experts Contact us
Using LightlyTrain at work, in production, on the edge, or to build proprietary models? You likely need a Commercial License. Contact us to request a license for commercial use.
Also check out LightlyStudio to easily visualize your annotations and predictions.
News
- [0.18.0] -
2026-10-24: 🚀 Deploy LT-DETR anywhere: New
C++ inference recipes
for ONNX Runtime and TensorRT with zero-copy GPU I/O, and MIGraphX export for AMD
GPUs. Also new: multi-scale features for torchvision and ECViT backbones, gradient
accumulation, activation checkpointing, and ~5x faster mAP validation with
faster-coco-eval. - [0.17.0] - 2026-07-28: LTDETRv2 for instance segmentation: Train state-of-the-art LTDETRv2 instance segmentation models with ECViT backbones from EdgeCrafter, matching the accuracy of the original ECSeg implementation while being 10-20% faster! ONNX and TensorRT export is also out-of-the-box!
- [0.16.0] - 2026-06-25: ⚡ Upgraded LTDETRv2 for object detection: Following the success of LTDETR, LightlyTrain's DETR model, we release LTDETRv2 with significant architectural and performance improvements! It supports using ECViT backbones from EdgeCrafter and ONNX/TensorRT export for faster inference!
- [0.15.0] - 2026-04-14: 🔎 Distillationv3: Better generalizing distillation method that performs equally well across dense and global tasks and across all models, from ViTs to hybrids to CNNs (+support for custom teachers!). 🔎
- [0.14.0] - 2026-01-19: 🐣 PicoDet, Tiny Models, and ONNX/TensorRT FP16 Support: PicoDet object detection models for low-power embedded devices! All tasks now support tiny DINOv3 models and ONNX/TensorRT export in FP16 precision for faster inference! 🐣
- [0.13.0] - 2025-12-15: 🐥 New Tiny Object Detection Models: We release tiny DINOv3 models pretrained on COCO for object detection! 🐥
- [0.12.0] - 2025-11-06: 💡 New DINOv3 Object Detection: Run inference or fine-tune DINOv3 models for object detection! 💡
- [0.11.0] - 2025-08-15: 🚀 New DINOv3 Support: Pretrain your own model with distillation from DINOv3 weights. Or fine-tune our SOTA EoMT semantic segmentation model with a DINOv3 backbone! 🚀
- [0.10.0] - 2025-08-04: 🔥 Train state-of-the-art semantic segmentation models with our new DINOv2 semantic segmentation fine-tuning method! 🔥
- [0.9.0] - 2025-07-21: DINOv2 pretraining is now officially available!
Installation
Install LightlyTrain on Python 3.8+ for Windows, Linux or MacOS with:
pip install lightly-train
Workflows

Train LTDETR detection models with DINOv2, DINOv3, or EdgeCrafter ECViT backbones.
COCO Results
| Model | Val mAP50:95 | Latency (ms) | Params (M) | Input Size |
|---|---|---|---|---|
| ltdetrv2-s-coco (NEW) | 50.7 | 5.4 | 9.9 | 640×640 |
| ltdetrv2-m-coco (NEW) | 53.1 | 7.95 | 21.1 | 640×640 |
| ltdetrv2-l-coco (NEW) | 56.0 | 10.78 | 33.6 | 640×640 |
| dinov3/vitt16-ltdetr-coco | 49.8 | 5.4 | 10.1 | 640×640 |
| dinov3/vitt16plus-ltdetr-coco | 52.5 | 7.0 | 18.1 | 640×640 |
| dinov3/vits16-ltdetr-coco | 55.4 | 10.5 | 36.4 | 640×640 |
| dinov3/convnext-tiny-ltdetr-coco | 54.4 | 13.3 | 61.1 | 640×640 |
| dinov3/convnext-small-ltdetr-coco | 56.9 | 17.7 | 82.7 | 640×640 |
| dinov3/convnext-base-ltdetr-coco | 58.6 | 24.7 | 121.0 | 640×640 |
| dinov3/convnext-large-ltdetr-coco | 60.0 | 42.3 | 230.0 | 640×640 |
Models are trained on the COCO 2017 dataset and evaluated on the validation set with
single-scale testing. Latency is measured with TensorRT on a NVIDIA T4 GPU with batch
size 1. All models are optimized using tensorrt==10.13.3.9.

Usage
import lightly_train
if __name__ == "__main__":
# Train with our most recent LT-DETRv2 detector based on DINOv3 and EdgeCrafter.
lightly_train.train_object_detection(
out="out/my_experiment",
model="ltdetrv2-s-coco",
data={
"path": "my_data_dir",
"train": "images/train",
"val": "images/val",
"names": {
0: "person",
1: "bicycle",
2: "car",
# ...
},
},
)
# Load model and run inference
model = lightly_train.load_model("out/my_experiment/exported_models/exported_best.pt")
# Or use one of the models provided by LightlyTrain
# model = lightly_train.load_model("ltdetrv2-s-coco")
results = model.predict("image.jpg")
results["labels"] # Class labels, tensor of shape (num_boxes,)
results["bboxes"] # Bounding boxes in (xmin, ymin, xmax, ymax) absolute pixel
# coordinates of the original image. Tensor of shape (num_boxes, 4).
results["scores"] # Confidence scores, tensor of shape (num_boxes,)
Train state-of-the-art instance segmentation models with our new LTDETRv2 family built on EdgeCrafter ECViT backbones.
COCO Results

| Model | Val mAP50:95 mask | Avg. Latency (ms) | Params (M) | Input Size |
|---|---|---|---|---|
| ltdetrv2-seg-s-coco | 0.427 | 6.96 | 11.32 | 640×640 |
| ltdetrv2-seg-m-coco | 0.458 | 9.82 | 22.31 | 640×640 |
| ltdetrv2-seg-l-coco | 0.475 | 11.41 | 34.85 | 640×640 |
| ltdetrv2-seg-x-coco | 0.479 | 12.06 | 41.93 | 640×640 |
Training follows the protocol in the original
EdgeCrafter paper. The s and m sizes train for
~74 epochs, while the l and x sizes train for ~50 epochs on the COCO 2017 dataset
and are evaluated on the validation set. Average latency is measured using TensorRT
version 10.13.3.9 and FP16 precision on a single NVIDIA T4 GPU with batch size 1.
Usage
import lightly_train
if __name__ == "__main__":
# Train an instance segmentation model with our new LTDETRv2 family
lightly_train.train_instance_segmentation(
out="out/my_experiment",
model="ltdetrv2-seg-s-coco",
data={
"format": "yolo", # either "yolo" or "coco"
"path": "my_data_dir",
"train": "images/train",
"val": "images/val",
"names": {
0: "background",
1: "vehicle",
2: "pedestrian",
# ...
},
},
)
model = lightly_train.load_model("out/my_experiment/exported_models/exported_best.pt")
# Or use one of the models provided by LightlyTrain
# model = lightly_train.load_model("ltdetrv2-seg-s-coco")
results = model.predict("image.jpg")
results["labels"] # Class labels, tensor of shape (num_instances,)
results["bboxes"] # Bounding boxes in (xmin, ymin, xmax, ymax) absolute pixel
# coordinates of the original image. Tensor of shape (num_instances, 4).
results["masks"] # Binary masks, tensor of shape (num_instances, height, width).
# Height and width correspond to the original image size.
results["scores"] # Confidence scores, tensor of shape (num_instances,)
Train state-of-the-art semantic segmentation models with DINOv2 or DINOv3 backbones using the EoMT method from CVPR 2025.
COCO-Stuff Results
| Implementation | Model | Val mIoU | Avg. Latency (ms) | Params (M) | Input Size |
|---|---|---|---|---|---|
| LightlyTrain | dinov3/vitt32-eomt-coco | 34.0 | 4.2 | 6.0 | 512×512 |
| LightlyTrain | dinov3/vitt32plus-eomt-coco | 36.0 | 4.4 | 7.7 | 512×512 |
| LightlyTrain | dinov3/vits32-eomt-coco | 42.4 | 5.4 | 21.6 | 512×512 |
| LightlyTrain | dinov3/vitb32-eomt-coco | 48.3 | 9.4 | 85.7 | 512×512 |
| LightlyTrain | dinov3/vitl32-eomt-coco | 51.2 | 17.5 | 303.2 | 512×512 |
| LightlyTrain | dinov3/vitt16-eomt-coco | 37.9 | 6.0 | 6.0 | 512×512 |
| LightlyTrain | dinov3/vitt16plus-eomt-coco | 39.5 | 6.4 | 7.7 | 512×512 |
| LightlyTrain | dinov3/vits16-eomt-coco | 45.0 | 11.3 | 21.6 | 512×512 |
| LightlyTrain | dinov3/vitb16-eomt-coco | 50.1 | 23.1 | 85.7 | 512×512 |
| LightlyTrain | dinov3/vitl16-eomt-coco | 52.5 | 49.0 | 303.2 | 512×512 |
Models are trained for 12 epochs with num_queries=200 on the COCO-Stuff dataset and
evaluated on the validation set with single-scale testing. Average latency is measured
on a single NVIDIA T4 GPU with batch size 1. All models optimized using torch.compile.
Cityscapes Results
| Implementation | Model | Val mIoU | Avg. Latency (ms) | Params (M) | Input Size |
|---|---|---|---|---|---|
| LightlyTrain | dinov3/vits16-eomt-cityscapes | 78.6 | 53.8 | 21.6 | 1024×1024 |
| LightlyTrain | dinov3/vitb16-eomt-cityscapes | 81.0 | 114.9 | 85.7 | 1024×1024 |
| LightlyTrain | dinov3/vitl16-eomt-cityscapes | 84.4 | 256.4 | 303.2 | 1024×1024 |
| EoMT (CVPR 2025 paper, current SOTA) | dinov2/vitl16-eomt | 84.2 | - | 319 | 1024×1024 |
Average latency is measured on a single NVIDIA T4 GPU with batch size 1. All models are
optimized using torch.compile.
Usage
import lightly_train
if __name__ == "__main__":
# Train a semantic segmentation model with a DINOv3 backbone
lightly_train.train_semantic_segmentation(
out="out/my_experiment",
model="dinov3/vits16-eomt",
data={
"train": {
"images": "my_data_dir/train/images",
"masks": "my_data_dir/train/masks",
},
"val": {
"images": "my_data_dir/val/images",
"masks": "my_data_dir/val/masks",
},
"classes": {
0: "background",
1: "road",
2: "building",
# ...
},
},
)
# Load model and run inference
model = lightly_train.load_model("out/my_experiment/exported_models/exported_best.pt")
# Or use one of the models provided by LightlyTrain
# model = lightly_train.load_model("dinov3/vits16-eomt")
masks = model.predict("image.jpg")
# Masks is a tensor of shape (height, width) with class labels as values.
# It has the same height and width as the input image.
Train state-of-the-art panoptic segmentation models with DINOv3 backbones using the EoMT method from CVPR 2025.
COCO Results
| Implementation | Model | Val PQ | Avg. Latency (ms) | Params (M) | Input Size |
|---|---|---|---|---|---|
| LightlyTrain | dinov3/vitt16-eomt-panoptic-coco | 38.0 | 13.5 | 6.0 | 640×640 |
| LightlyTrain | dinov3/vittplus16-eomt-panoptic-coco | 41.4 | 14.1 | 7.7 | 640×640 |
| LightlyTrain | dinov3/vits16-eomt-panoptic-coco | 46.8 | 21.2 | 23.4 | 640×640 |
| LightlyTrain | dinov3/vitb16-eomt-panoptic-coco | 53.2 | 39.4 | 92.5 | 640×640 |
| LightlyTrain | dinov3/vitl16-eomt-panoptic-coco | 57.0 | 80.1 | 315.1 | 640×640 |
| LightlyTrain | dinov3/vitl16-eomt-panoptic-coco-1280 | 59.0 | 500.1 | 315.1 | 1280×1280 |
| EoMT (CVPR 2025 paper, current SOTA) | dinov3/vitl16-eomt-panoptic-coco-1280 | 58.9 | - | 315.1 | 1280×1280 |
Tiny models are trained for 48 epochs, small and base models for 24 epochs and large
models for 12 epochs on the COCO 2017 dataset and evaluated on the validation set with
single-scale testing. Avg. Latency is measured on a single NVIDIA T4 GPU with batch size
1. All models are optimized using torch.compile.
Usage
import lightly_train
if __name__ == "__main__":
# Train an panoptic segmentation model with a DINOv3 backbone
lightly_train.train_panoptic_segmentation(
out="out/my_experiment",
model="dinov3/vitb16-eomt-panoptic-coco",
data={
"train": {
"images": "images/train",
"masks": "annotations/train",
"annotations": "annotations/train.json",
},
"val": {
"images": "images/val",
"masks": "annotations/val",
"annotations": "annotations/val.json",
},
},
)
model = lightly_train.load_model("out/my_experiment/exported_models/exported_best.pt")
results = model.predict("image.jpg")
results["masks"] # Masks with (class_label, segment_id) for each pixel, tensor of
# shape (height, width, 2). Height and width correspond to the
# original image size.
results["segment_ids"] # Segment ids, tensor of shape (num_segments,).
results["scores"] # Confidence scores, tensor of shape (num_segments,)
Run monocular depth inference with Depth Anything V2 and V3 models.
The ViT-S, ViT-TinyPlus, and ViT-Tiny models were distilled from the ViT-L model by the LightlyTrain team.
Metric Depth Results
Depth accuracy is evaluated zero-shot on the NYUv2 test split (654 images) with the eigen crop and a depth range of 0.1 m to 10 m. NYUv2 was not used during training. Metric models are scored directly against the ground-truth depth:
| Model | Params (M) | δ1 | Aligned δ1 | AbsRel | RMSE |
|---|---|---|---|---|---|
dinov3/dav3-metric-tiny (LightlyTrain-distilled) | 6.2M | 0.818 | 0.915 | 0.131 | 0.506 |
dinov3/dav3-metric-tiny-plus (LightlyTrain-distilled) | 7.9M | 0.846 | 0.923 | 0.123 | 0.457 |
dinov2/dav3-metric-small (LightlyTrain-distilled) | 24.7M | 0.912 | 0.938 | 0.099 | 0.377 |
dinov2/dav3-metric-large | 334.2M | 0.950 | 0.948 | 0.078 | 0.339 |
The reported scores are:
- δ1: fraction of pixels whose predicted depth is within 25% of the ground truth,
i.e.
max(pred/gt, gt/pred) < 1.25. Higher is better. - Aligned δ1: same as δ1, but after a per-image least-squares scale-and-shift alignment to the ground truth, the same alignment used for the relative models.
- AbsRel: mean absolute error relative to the ground-truth depth,
mean(|pred - gt| / gt). Lower is better. - RMSE: root-mean-square error in meters. Lower is better.
Inference Speed
Inference time of the distilled relative models, measured with FP16 TensorRT engines on an NVIDIA T4 GPU:
| Model | Input Size | Params (M) | Avg inference time |
|---|---|---|---|
dinov3/dav3-relative-tiny | 576×576 | 6.2M | 5.27 ms |
dinov3/dav3-relative-tiny-plus | 576×576 | 7.9M | 5.49 ms |
dinov2/dav3-relative-small | 504×504 | 24.7M | 9.17 ms |
Usage
import lightly_train
# Load a depth model provided by LightlyTrain
model = lightly_train.load_model("dinov2/dav3-relative-large")
# Predict a relative-depth map
depth = model.predict("image.jpg")
# depth is a tensor of shape (height, width) matching the input image.
Metric depth (in meters) and the full list of available models are covered in the documentation.
Train multiclass or multilabel image classification models with any backbone.
Usage
import lightly_train
if __name__ == "__main__":
# Train an image classification model with a DINOv3 backbone
lightly_train.train_image_classification(
out="out/my_experiment",
model="dinov3/vitt16",
data={
"train": "my_data_dir/train/",
"val": "my_data_dir/val/",
"classes": {
0: "cat",
1: "car",
2: "dog",
# ...
},
},
)
model = lightly_train.load_model("out/my_experiment/exported_models/exported_best.pt")
results = model.predict("image.jpg", topk=1, threshold=0.5)
results["labels"] # Class labels, tensor of shape (topk,)
results["scores"] # Confidence scores, tensor of shape (topk,)
Pretrain any model architecture with unlabeled data by distilling the knowledge from DINOv2 or DINOv3 foundation models into your model. On the COCO dataset, YOLOv8-s models pretrained with LightlyTrain achieve high performance across all tested label fractions. These improvements hold for other architectures like YOLOv11, RT-DETR, and Faster R-CNN. See our announcement post for more benchmarks and details.

Usage
import lightly_train
if __name__ == "__main__":
# Distill the knowledge from a DINOv3 teacher into a YOLOv8 model
lightly_train.pretrain(
out="out/my_experiment",
data="my_data_dir",
model="ultralytics/yolov8s",
method="distillation",
method_args={
"teacher": "dinov3/vitb16",
},
)
# Load model for fine-tuning
model = YOLO("out/my_experiment/exported_models/exported_last.pt")
model.train(data="coco8.yaml")
With LightlyTrain you can train your very own foundation model like DINOv2 on your data.
ImageNet-1K Results
| Implementation | Model | Val ImageNet k-NN |
|---|---|---|
| LightlyTrain | dinov2/vitl16 | 81.9% |
| DINOv2 | dinov2/vitl16 | 81.6% |
Models are pretrained on ImageNet-1k for 100 epochs and evaluated with a k-NN classifier on the ImageNet validation set.
Usage
import lightly_train
if __name__ == "__main__":
# Pretrain a DINOv2 vision foundation model
lightly_train.pretrain(
out="out/my_experiment",
data="my_data_dir",
model="dinov2/vitb14",
method="dinov2",
)
LightlyTrain provides simple commands to autolabel your unlabeled data using DINOv2 or DINOv3 pretrained models. This allows you to efficiently boost performance of your smaller models by leveraging all your unlabeled images.
ADE20K Results
| Implementation | Model | Autolabel | Val mIoU | Params (M) | Input Size |
|---|---|---|---|---|---|
| LightlyTrain | dinov3/vits16-eomt | ❌ | 0.466 | 21.6 | 518×518 |
| LightlyTrain | dinov3/vits16-eomt-ade20k | ✅ | 0.533 | 21.6 | 518×518 |
| LightlyTrain | dinov3/vitb16-eomt | ❌ | 0.544 | 85.7 | 518×518 |
| LightlyTrain | dinov3/vitb16-eomt-ade20k | ✅ | 0.573 | 85.7 | 518×518 |
The better results with auto-labeling were achieved by fine-tuning a ViT-H+ on the ADE20K dataset, which reaches 0.595 validation mIoU. This model was then used to autolabel 100k images from the SUN397 dataset. Using these labels, we subsequently fine-tuned the smaller models, and then used the ADE20k dataset for validation.
Usage
import lightly_train
if __name__ == "__main__":
# Autolabel your data with a DINOv3 semantic segmentation model
lightly_train.predict_semantic_segmentation(
out="out/my_autolabeled_data",
data="my_data_dir",
model="dinov3/vitb16-eomt-coco",
# Or use one of your own model checkpoints
# model="out/my_experiment/exported_models/exported_best.pt",
)
# The autolabeled masks will be saved in this format:
# out/my_autolabeled_data
# ├── <image name>.png
# ├── <image name>.png
# └── …
Features
- Python, Command Line, and Docker support
- Built for high performance including multi-GPU and multi-node support
- Monitor training progress with MLflow, TensorBoard, Weights & Biases, and more
- Runs fully on-premises with no API authentication
- Export models in their native format for fine-tuning or inference
- Export models in ONNX or TensorRT format for edge deployment
Models
LightlyTrain supports the following model and workflow combinations.
Fine-tuning
| Model | ObjectDetection | InstanceSegmentation | PanopticSegmentation | SemanticSegmentation | ImageClassification |
|---|---|---|---|---|---|
| DINOv3 | ✅ 🔗 | ✅ 🔗 | ✅ 🔗 | ✅ 🔗 | ✅ 🔗 |
| DINOv2 | ✅ 🔗 | ✅ 🔗 | ✅ 🔗 | ✅ 🔗 | ✅ 🔗 |
| EdgeCrafter | ✅ 🔗 | ✅ 🔗 | |||
| Any | ✅ 🔗 |
Distillation & Pretraining
| Model | Distillation | Pretraining |
|---|---|---|
| DINOv3 | ✅ 🔗 | |
| DINOv2 | ✅ 🔗 | ✅ 🔗 |
| Torchvision ResNet, ConvNext, ShuffleNetV2 | ✅ 🔗 | ✅ 🔗 |
| TIMM models | ✅ 🔗 | ✅ 🔗 |
| Ultralytics YOLOv5–YOLO26, RT-DETR | ✅ 🔗 | ✅ 🔗 |
| RT-DETR, RT-DETRv2 | ✅ 🔗 | ✅ 🔗 |
| RF-DETR | ✅ 🔗 | ✅ 🔗 |
| YOLOv12 | ✅ 🔗 | ✅ 🔗 |
| Custom PyTorch Model | ✅ 🔗 | ✅ 🔗 |
Contact us if you need support for additional models.
LightlyTrain in Research
- Unlabeled to Accurate: Self-Supervised Learning for Land Use Classification in Sentinel-2 Imagery
- Vision Foundry: A System for Training Foundational Vision AI Models (independent project; cites LightlyTrain as related work only)
- EdgeCrafter: Compact ViTs for Edge Dense Prediction via Task-Specialized Distillation
- Real-Time Object Detection Meets DINOv3
Usage Events
LightlyTrain collects anonymous usage events to help us improve the product. We only
track training method, model architecture, and system information (OS, GPU, CI,
Container). To opt-out, set the environment variable:
export LIGHTLY_TRAIN_EVENTS_DISABLED=1
License
LightlyTrain offers flexible licensing options to suit your specific needs:
-
AGPL-3.0 License: Perfect for open-source projects, academic research, and community contributions. Share your innovations with the world while benefiting from community improvements.
-
Commercial License: Ideal for businesses and organizations that need proprietary development freedom. Enjoy all the benefits of LightlyTrain while keeping your code and models private. Includes model training and runtime license.
-
Free Community License: Available for students, researchers, startups in early stages, or anyone exploring or experimenting with LightlyTrain. Empower the next generation of innovators with full access to the world of pretraining.
Commercial Pricing
| Plan | Price | Eligibility |
|---|---|---|
| Startup | $5,000 / year | < $1M revenue or < 10 employees |
| Growth | $10,000 / year | < $10M revenue or < 100 employees |
| Enterprise | Custom | > $10M revenue or > 100 employees |
All commercial plans include a license for model training, edge deployment, and inference. Enterprise plans include priority support, a joint Slack channel, co-development engineering, and influence on the product roadmap.
Contact us to get started — we'll find the right option for your project!