Lightly
A python library for self-supervised learning on images.
Install / Use
/learn @lightly-ai/LightlyREADME
<a name="top"></a>

LightlySSL is a computer vision framework for self-supervised learning.
For a commercial version with more features, including Docker support and pretraining models for embedding, classification, detection, and segmentation tasks with a single command, please contact sales@lightly.ai.
We've also built a whole platform on top, with additional features for active learning and data curation. If you're interested in the Lightly Worker Solution to easily process millions of samples and run powerful algorithms on your data, check out lightly.ai. It's free to get started!
News 🚀
- March 23, 2026 - Check out our latest open-source project LightlyStudio to visualize, annotate, and manage your data with ease! 🔍
- April 15, 2025 - We are excited to announce that you can now leverage SSL and distillation pretraining in just a few lines of code! We've worked hard to make self-supervised learning even more accessible with our new project LightlyTrain. Head over there to get started and supercharge your models! ⚡️
Features
This self-supervised learning framework offers the following features:
- Modular framework, which exposes low-level building blocks such as loss functions and model heads.
- Easy to use and written in a PyTorch-like style.
- Supports custom backbone models for self-supervised pre-training.
- Support for distributed training using PyTorch Lightning.
Supported Models
You can find sample code for all the supported models here. We provide PyTorch, PyTorch Lightning, and PyTorch Lightning distributed examples for all models to kickstart your project.
Models:
| Model | Year | Paper | Docs | Colab (PyTorch) | Colab (PyTorch Lightning) |
|----------------|------|-------|------|-----------------|----------------------------|
| AIM | 2024 | paper | docs | |
|
| Barlow Twins | 2021 | paper | docs |
|
|
| BYOL | 2020 | paper | docs |
|
|
| DCL & DCLW | 2021 | paper | docs |
|
|
| DenseCL | 2021 | paper | docs |
|
|
| DINO | 2021 | paper | docs |
|
|
| DINOv2 | 2023 | paper | docs |
|
|
| iBOT | 2021 | paper | docs |
|
|
| MAE | 2021 | paper | docs |
|
|
| MSN | 2022 | paper | docs |
|
|
| MoCo | 2019 | paper | docs |
|
|
| NNCLR | 2021 | [paper
