How facebookresearch/swav works
This repository implements SwAV self-supervised visual pretraining, alongside DeepCluster-v2 training, pretrained-backbone distribution, and supervised evaluation workflows. The main path transforms each image into multiple crops, encodes views, computes cluster assignments and swapped-prediction loss, then updates and saves the model. Separate evaluation programs measure frozen-feature linear performance and semi-supervised fine-tuning. The graph follows documented entry points and sampled calls; omitted source details limit finer-grained training and evaluation links.
Main entry points: main_deepclusterv2.py DeepCluster entry · main_swav.py SwAV entry · resnet50.py ResNet backbone · hubconf.py Torch Hub models
Components 16
Pretraining
- SwAV entry
main_swav.py - SwAV training
main_swav.py - DeepCluster entry
main_deepclusterv2.py - DeepCluster training
main_deepclusterv2.py - SwAV checkpoints
main_swav.py - Cluster memory
main_deepclusterv2.py - Runtime utilities
src/utils.py
Models and data
- Multi-crop views
src/multicropdataset.py - ResNet backbone
src/resnet50.py
Evaluation
- Linear evaluation
eval_linear.py - Semi-supervised evaluation
eval_semisup.py
Model distribution
- Torch Hub models
hubconf.py - Pretrained weights
Other components
- Researcher
- ImageNet images
- Downstream user
Connections 29
- Researcher → SwAV entry: starts training
- Researcher → DeepCluster entry: starts training
- SwAV entry → Multi-crop views: builds dataset
- ImageNet images → Multi-crop views: loads images
- SwAV entry → ResNet backbone: builds model
- SwAV entry → Runtime utilities: initializes runtime
- SwAV entry → SwAV training: runs epochs
- SwAV training → ResNet backbone: encodes views
- SwAV training → SwAV checkpoints: saves queue and checkpoints
- SwAV entry → SwAV checkpoints: restores state
- DeepCluster entry → Multi-crop views: builds dataset
- DeepCluster entry → ResNet backbone: builds model
- DeepCluster entry → Runtime utilities: initializes runtime
- DeepCluster entry → Cluster memory: loads memory
- DeepCluster entry → DeepCluster training: runs epochs
- DeepCluster training → ResNet backbone: encodes views
- DeepCluster training → Cluster memory: updates assignments
- DeepCluster entry → SwAV checkpoints: saves checkpoints
- Researcher → Linear evaluation: runs evaluation
- Linear evaluation → ResNet backbone: builds backbone
- Linear evaluation → SwAV checkpoints: loads pretrained state
- Researcher → Semi-supervised evaluation: runs fine-tuning
- Semi-supervised evaluation → ResNet backbone: builds model
- Semi-supervised evaluation → SwAV checkpoints: loads pretrained state
- Downstream user → Torch Hub models: requests model
- Torch Hub models → ResNet backbone: constructs backbone
- Torch Hub models → Pretrained weights: downloads weights
- Pretrained weights → Torch Hub models: provides parameters
- Torch Hub models → Downstream user: returns model