BarlowTwins¶
- class mmpretrain.models.selfsup.BarlowTwins(backbone, neck=None, head=None, target_generator=None, pretrained=None, data_preprocessor=None, init_cfg=None)[源代码]¶
BarlowTwins.
Implementation of Barlow Twins: Self-Supervised Learning via Redundancy Reduction. Part of the code is borrowed from: https://github.com/facebookresearch/barlowtwins/blob/main/main.py.
- loss(inputs, data_samples, **kwargs)[源代码]¶
The forward function in training.
- 参数:
inputs (List[torch.Tensor]) – The input images.
data_samples (List[DataSample]) – All elements required during the forward function.
- 返回:
A dictionary of loss components.
- 返回类型:
Dict[str, torch.Tensor]