BarlowTwins#
- class stable_pretraining.methods.BarlowTwins(encoder_name: str | Module = 'vit_small_patch16_224', projector_dims: Sequence[int] = (8192, 8192, 8192), lambd: float = 0.0051, low_resolution: bool = False, pretrained: bool = False)[source]#
Bases:
ModuleBarlow Twins self-supervised learning.
- Parameters:
encoder_name – timm model name or pre-built
nn.Module.projector_dims – Hidden + output dims (default
(8192, 8192, 8192)matches the ResNet50 recipe).lambd – Off-diagonal weight in the cross-correlation loss (default
5.1e-3from the paper).low_resolution – Adapt first conv for low-res input.
pretrained – Load pretrained timm weights.