LightlySSL

Learn from images and video without labels

Pretrain vision backbones with 28 self-supervised methods, or train a latent world model that plans from raw frames. All in plain PyTorch.

$ pip install lightly
# the example scripts live in the repository
$ git clone https://github.com/lightly-ai/lightly.git
# pretrain a ResNet-18 with SimCLR on CIFAR-10
$ python lightly/examples/pytorch/simclr.py
# or with Lightning on several GPUs
$ python lightly/examples/pytorch_lightning_distributed/simclr.py

What’s new

Four agents planned by LeWM pass through a door to reach their goals

New in 1.6

Latent world models with LeWM

A world model learns how a scene responds to actions. LeWM learns it from raw frames and actions, then plans by imagining the outcome of each move in its own embedding space.

Each agent (orange) gets only a picture of its goal (white box). It learned from random play: no rewards, no labels, no map of the room.

New in 1.6

CAPI

Masked image modeling that predicts the cluster assignments of masked patches instead of their pixels.

CAPI

New in 1.5.26

Pixio, FroSSL and DetConS

Three more methods: a masked autoencoder variant, Frobenius norm minimization, and object-level contrastive learning.

Pixio

New in 1.5.25

LeJEPA

Invariance plus SIGReg: no negative samples, momentum encoders or stop-gradients.

LeJEPA

Start here

Get started

Install LightlySSL and learn the main concepts.

Installing LightlySSL
Tutorials

Step-by-step notebooks, from data loading to fine-tuning.

Tutorial 1: Structure Your Input
Methods

Reference implementations in PyTorch and Lightning.

Models
Python API

Losses, heads, transforms and data utilities.

lightly

All methods

More from Lightly

LightlyTrain

Pretrain and fine-tune vision foundation models with a few lines of code.

https://docs.lightly.ai/train/stable/index.html
LightlyStudio

Label, curate and inspect your datasets.

https://docs.lightly.ai/studio/
Discord

Join the community and our weekly paper sessions.

https://discord.gg/xvNJW94
GitHub

Star the repo, file issues and contribute.

https://github.com/lightly-ai/lightly