Update README.md
Browse files102 unmodified lines10310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817968 unmodified lines248249250180251252253254255256257258259260261102 unmodified lines
The checkpoint includes training state such as optimizer and scheduler information in addition to model parameters.
## Loading the Checkpoint
The checkpoint can be loaded by reconstructing the ResNet-18 backbone and SimCLR projection head used during training.
```pythonimport torchimport torch.nn as nnimport torchvisionfrom lightly.models.modules import heads
class SimCLRResNet18(nn.Module): def __init__(self): super().__init__()
resnet = torchvision.models.resnet18(weights=None) feature_dim = resnet.fc.in_features # 512
# Remove the classification head self.backbone = nn.Sequential( *list(resnet.children())[:-1] )
# SimCLR projection head: 512 -> 512 -> 128 self.projection_head = heads.SimCLRProjectionHead( feature_dim, feature_dim, 128, )
def forward(self, x): features = self.backbone(x).flatten(start_dim=1) projections = self.projection_head(features) return projections
checkpoint = torch.load( "checkpoint_100-resnet18-simclr-imagenet1k.ckpt", map_location="cpu", weights_only=False,)
model = SimCLRResNet18()model.load_state_dict(checkpoint["state_dict"], strict=True)model.eval()```
### Extracting Backbone Features
For most downstream applications, the 512-dimensional ResNet-18 representation can be extracted without using the SimCLR projection head:
```pythonwith torch.no_grad(): features = model.backbone(images).flatten(start_dim=1)
print(features.shape)# [batch_size, 512]```
The 128-dimensional SimCLR projection can instead be obtained with:
```pythonwith torch.no_grad(): projections = model(images)
print(projections.shape)# [batch_size, 128]```
Input tensors should have shape `[batch_size, 3, 224, 224]`.
### Comparative Evaluation Results
The table below reproduces the summary metrics reported in the associated paper across all VEDB-trained conditions and **reference models**. **Rows corresponding to this repository's ImageNet-1K checkpoint are bolded.**68 unmodified lines address = {New York, NY, USA}, year = {2026}, doi = {10.32470/0416gfsq}}}```
**Proceedings:** [Diaz & Henderson (2026)](https://doi.org/10.32470/0416gfsq)<br>**Preprint:** [arXiv:2607.19316](https://arxiv.org/abs/2607.19316)
## License
The released checkpoint and repository materials are provided under the **Apache License 2.0**.
The ImageNet-1K training dataset and third-party software used to produce the model remain subject to their respective licenses, access requirements, and terms of use.README.md+82-1