GitPedia

Lightly train

All-in-one training for vision models (YOLO, ViTs, RT-DETR, DINOv3): pretraining, fine-tuning, distillation.

From lightly-ai·Updated June 27, 2026·View on GitHub·

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. The project is written primarily in Python, distributed under the GNU Affero General Public License v3.0 license, first published in 2025. It has gained significant community traction with 1,599 stars and 88 forks on GitHub. Key topics include: computer-vision, contrastive-learning, deep-learning, depth-estimation, dinov2.

Latest release: v0.16.1
June 26, 2026View Changelog →

LightlyTrain - SOTA Pretraining, Fine-tuning and Distillation

Python
Docker
Documentation
Discord

Train Better Models, Faster

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

bash
pip install lightly-train

Workflows

Tasks

<details open> <summary><strong>Object Detection</strong></summary>

Train LTDETR detection models with DINOv2, DINOv3, or EdgeCrafter ECViT backbones.

COCO Results

ModelVal mAP<sub>50:95</sub>Latency (ms)Params (M)Input Size
picodet-s-coco26.7*2.2*1.17416×416
picodet-l-coco32.0*2.4*3.75416×416
ltdetrv2-s-coco (NEW)50.75.49.9640×640
dinov3/vitt16-ltdetr-coco49.85.410.1640×640
dinov3/vitt16plus-ltdetr-coco52.57.018.1640×640
dinov3/vits16-ltdetr-coco55.410.536.4640×640
dinov3/convnext-tiny-ltdetr-coco54.413.361.1640×640
dinov3/convnext-small-ltdetr-coco56.917.782.7640×640
dinov3/convnext-base-ltdetr-coco58.624.7121.0640×640
dinov3/convnext-large-ltdetr-coco60.042.3230.0640×640

*Picodet models are in preview and we report preliminary results.

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

Documentation
Colab

python
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,)
</details> <details> <summary><strong>Panoptic Segmentation</strong></summary>

Train state-of-the-art panoptic segmentation models with DINOv3 backbones using the EoMT
method from CVPR 2025.

COCO Results

ImplementationModelVal PQAvg. Latency (ms)Params (M)Input Size
LightlyTraindinov3/vitt16-eomt-panoptic-coco38.013.56.0640×640
LightlyTraindinov3/vittplus16-eomt-panoptic-coco41.414.17.7640×640
LightlyTraindinov3/vits16-eomt-panoptic-coco46.821.223.4640×640
LightlyTraindinov3/vitb16-eomt-panoptic-coco53.239.492.5640×640
LightlyTraindinov3/vitl16-eomt-panoptic-coco57.080.1315.1640×640
LightlyTraindinov3/vitl16-eomt-panoptic-coco-128059.0500.1315.11280×1280
EoMT (CVPR 2025 paper, current SOTA)dinov3/vitl16-eomt-panoptic-coco-128058.9-315.11280×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

Documentation
Colab

python
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,)
</details> <details> <summary><strong>Instance Segmentation</strong></summary>

Train state-of-the-art instance segmentation models with DINOv3 backbones using the EoMT
method from CVPR 2025.

COCO Results

ImplementationModelVal mAP maskAvg. Latency (ms)Params (M)Input Size
LightlyTraindinov3/vitt16-eomt-inst-coco25.412.76.0640×640
LightlyTraindinov3/vitt16plus-eomt-inst-coco27.613.37.7640×640
LightlyTraindinov3/vits16-eomt-inst-coco32.619.421.6640×640
LightlyTraindinov3/vitb16-eomt-inst-coco40.339.785.7640×640
LightlyTraindinov3/vitl16-eomt-inst-coco46.280.0303.2640×640
EoMT (CVPR 2025 paper, current SOTA)dinov3/vitl16-eomt-inst-coco45.9-303.2640×640

Tiny models are trained for 48 epochs, while all other models are trained for 12 epochs
on the COCO 2017 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 are
optimized using torch.compile.

Usage

Documentation
Colab

python
import lightly_train if __name__ == "__main__": # Train an instance segmentation model with a DINOv3 backbone lightly_train.train_instance_segmentation( out="out/my_experiment", model="dinov3/vitb16-eomt-inst-coco", data={ "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") results = model.predict("image.jpg") results["labels"] # Class labels, tensor of shape (num_instances,) 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,)
</details> <details> <summary><strong>Semantic Segmentation</strong></summary>

Train state-of-the-art semantic segmentation models with DINOv2 or DINOv3 backbones
using the EoMT method from CVPR 2025.

COCO-Stuff Results

ImplementationModelVal mIoUAvg. Latency (ms)Params (M)Input Size
LightlyTraindinov3/vitt32-eomt-coco34.04.26.0512×512
LightlyTraindinov3/vitt32plus-eomt-coco36.04.47.7512×512
LightlyTraindinov3/vits32-eomt-coco42.45.421.6512×512
LightlyTraindinov3/vitb32-eomt-coco48.39.485.7512×512
LightlyTraindinov3/vitl32-eomt-coco51.217.5303.2512×512
LightlyTraindinov3/vitt16-eomt-coco37.96.06.0512×512
LightlyTraindinov3/vitt16plus-eomt-coco39.56.47.7512×512
LightlyTraindinov3/vits16-eomt-coco45.011.321.6512×512
LightlyTraindinov3/vitb16-eomt-coco50.123.185.7512×512
LightlyTraindinov3/vitl16-eomt-coco52.549.0303.2512×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

ImplementationModelVal mIoUAvg. Latency (ms)Params (M)Input Size
LightlyTraindinov3/vits16-eomt-cityscapes78.653.821.61024×1024
LightlyTraindinov3/vitb16-eomt-cityscapes81.0114.985.71024×1024
LightlyTraindinov3/vitl16-eomt-cityscapes84.4256.4303.21024×1024
EoMT (CVPR 2025 paper, current SOTA)dinov2/vitl16-eomt84.2-3191024×1024

Average latency is measured on a single NVIDIA T4 GPU with batch size 1. All models are
optimized using torch.compile.

Usage

Documentation
Colab

python
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.
</details> <details> <summary><strong>Image Classification</strong></summary>

Train multiclass or multilabel image classification models with any backbone.

Usage

Documentation
Colab

python
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,)
</details> <details> <summary><strong>Depth Estimation</strong></summary>

Run monocular depth inference with Depth Anything V2 and V3 models. Training support
will be released soon!

Usage

Documentation
Colab

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

</details> <details> <summary><strong>Distillation (DINOv2/v3)</strong></summary>

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.

Benchmark Results

Usage

Documentation
Google Colab

python
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")
</details> <details> <summary><strong>Pretraining (DINOv2 Foundation Models)</strong></summary>

With LightlyTrain you can train your very own foundation model like DINOv2 on your data.

ImageNet-1K Results

ImplementationModelVal ImageNet k-NN
LightlyTraindinov2/vitl1681.9%
DINOv2dinov2/vitl1681.6%

Models are pretrained on ImageNet-1k for 100 epochs and evaluated with a k-NN classifier
on the ImageNet validation set.

Usage

Documentation

python
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", )
</details> <details> <summary><strong>Autolabeling</strong></summary>

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

ImplementationModelAutolabelVal mIoUParams (M)Input Size
LightlyTraindinov3/vits16-eomt0.46621.6518×518
LightlyTraindinov3/vits16-eomt-ade20k0.53321.6518×518
LightlyTraindinov3/vitb16-eomt0.54485.7518×518
LightlyTraindinov3/vitb16-eomt-ade20k0.57385.7518×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

Documentation

python
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 # └── …
</details>

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

ModelObject<br>DetectionInstance<br>SegmentationPanoptic<br>SegmentationSemantic<br>SegmentationImage<br>Classification
DINOv3🔗🔗🔗🔗🔗
DINOv2🔗🔗🔗🔗🔗
EdgeCrafter🔗
Any🔗

Distillation & Pretraining

ModelDistillationPretraining
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

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

PlanPriceEligibility
Startup$5,000 / year< $1M revenue or < 10 employees
Growth$10,000 / year< $10M revenue or < 100 employees
EnterpriseCustom> $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!

Contact

Website
<br>
Discord
<br>
GitHub
<br>
X
<br>
YouTube
<br>
LinkedIn

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from lightly-ai/lightly-train via the GitHub API.Last fetched: 6/28/2026