DM-Diaz's picture
Update README.md
11d1f58 verified
|
Raw
History Blame Contribute Delete
12 kB
---
license: apache-2.0
tags:
- pytorch
- computer-vision
- self-supervised-learning
- simclr
- resnet18
- imagenet
- lightly
- visual-neuroscience
- neural-encoding
- arxiv:2607.19316
datasets:
- evanarlian/imagenet_1k_resized_256
---
# SimCLR ResNet-18 β€” ImageNet-1K
This repository contains the **ImageNet-1K SimCLR ResNet-18 checkpoint** trained as a non-egocentric reference model for:
**Diaz, D. M., & Henderson, M. M. (2026). _Eccentricity-Constrained CNN Training Reveals Adaptive Information Coding Around the Visual Field._ Proceedings of the 9th Conference on Cognitive Computational Neuroscience.**
**DOI:** [10.32470/0416gfsq](https://doi.org/10.32470/0416gfsq)<br>
**arXiv:** [2607.19316](https://arxiv.org/abs/2607.19316)<br>
**Contributed Talk:** [CCN 2026 presentation on YouTube](https://www.youtube.com/watch?v=Lb4S3FWqd2M&t=2545s)
The model was pretrained using **SimCLR with a ResNet-18 backbone** and served as one of the non-egocentric reference models in the associated study. It was evaluated alongside models pretrained on ImageNet-100 and STL-10 as comparison models for representations learned from naturalistic egocentric visual experience.
Training was implemented using the [Lightly self-supervised learning framework](https://docs.lightly.ai/self-supervised-learning/index.html). The training images were obtained from the [`evanarlian/imagenet_1k_resized_256`](https://huggingface.co/datasets/evanarlian/imagenet_1k_resized_256) dataset on Hugging Face.
**Code, preprocessing, analysis, and other related material associated with the paper are hosted on Github:** [DM-Diaz/eccentricity-constrained-simclr](https://github.com/DM-Diaz/eccentricity-constrained-simclr)
## Model Architecture
The model uses a standard **ResNet-18** encoder with the classification head removed.
| Component | Configuration |
| --- | --- |
| Backbone | ResNet-18 |
| Backbone representation | 512 dimensions |
| Projection head | Lightly `SimCLRProjectionHead` |
| Projection dimensions | `512 β†’ 512 β†’ 128` |
| Projection output | 128 dimensions |
| SSL objective | NT-Xent |
| Temperature | `0.1` |
The released checkpoint contains both the ResNet-18 backbone and SimCLR projection head. For downstream representation extraction, the 512-dimensional backbone representation can be used independently of the projection head.
## Training Configuration
| Parameter | Value |
| --- | --- |
| Dataset | ImageNet-1K |
| Dataset source | `evanarlian/imagenet_1k_resized_256` |
| Number of classes | 1,000 |
| Epochs | 100 |
| Batch size | 32 |
| Input resolution | `224 Γ— 224` |
| Optimizer | LARS |
| Initial learning rate | `0.0375` |
| Momentum | `0.9` |
| Weight decay | `1e-6` |
| LR schedule | Cosine warmup |
| Warmup | 10 epochs |
| Precision | 16-bit mixed precision |
| Distributed training | No |
The learning rate was linearly scaled from a base learning rate of `0.3` according to batch size:
`0.3 Γ— (32 / 256) = 0.0375`
The training script specifies 100 epochs, 1,000 classes, and 224-pixel inputs. The checkpoint was saved at the completion of this run.
## Training Data
Training data were obtained from the Hugging Face dataset:
[`evanarlian/imagenet_1k_resized_256`](https://huggingface.co/datasets/evanarlian/imagenet_1k_resized_256)
The locally downloaded dataset was loaded from Hugging Face parquet shards. The training split was used for self-supervised representation learning.
The dataset itself is **not redistributed through this repository** and remains subject to its original access conditions and terms.
## Checkpoint
**File:** `checkpoint_100-resnet18-simclr-imagenet1k.ckpt`
The released file is a **full PyTorch Lightning checkpoint**, rather than a backbone-only state dictionary.
Checkpoint inspection confirmed:
| Property | Value |
| --- | --- |
| PyTorch Lightning version recorded | `2.6.1` |
| Stored epoch | `99` |
| Training epochs completed | 100 |
| Global step | `4,003,600` |
| State-dict entries | 132 |
| Backbone output | 512 dimensions |
| Projection output | 128 dimensions |
| Strict architecture loading | Successful |
The stored epoch is zero-indexed, so `epoch = 99` corresponds to the completion of epoch 100.
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.
```python
import torch
import torch.nn as nn
import torchvision
from 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:
```python
with 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:
```python
with 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.**
| Task | Condition | Val Loss | Top-1 (%) | Top-5 (%) | Best Macro-F1 (%) |
| --- | --- | ---: | ---: | ---: | ---: |
| SimCLR | Baseline | 0.4331 | 87.60 | β€” | β€” |
| SimCLR | Fovea-Gaze | 0.3749 | 90.43 | β€” | β€” |
| SimCLR | Periph-NF | 0.4548 | 90.04 | β€” | β€” |
| SimCLR | Periph | 0.4545 | 89.26 | β€” | β€” |
| In-Domain | Baseline | 0.9811 | β€” | β€” | 42.17 |
| In-Domain | Fovea-Gaze | 1.2031 | β€” | β€” | 43.64 |
| In-Domain | Periph-NF | 1.3090 | β€” | β€” | 30.93 |
| In-Domain | Periph | 1.0623 | β€” | β€” | 36.56 |
| In-Domain | STL-10 | 1.6666 | β€” | β€” | 25.41 |
| In-Domain | ImageNet-100 | 1.2342 | β€” | β€” | 41.23 |
| **In-Domain** | **ImageNet-1K** | **0.9713** | **β€”** | **β€”** | **43.33** |
| VGGFace2 | Baseline | 7.8101 | 5.21 | 11.73 | 3.26 |
| VGGFace2 | Fovea-Gaze | 7.9104 | 4.58 | 10.76 | 2.70 |
| VGGFace2 | Periph-NF | 8.0232 | 3.39 | 8.17 | 1.90 |
| VGGFace2 | Periph | 8.1681 | 2.54 | 6.39 | 1.35 |
| VGGFace2 | STL-10 | 6.9973 | 9.55 | 18.96 | 7.43 |
| VGGFace2 | ImageNet-100 | 6.7985 | 10.77 | 21.07 | 8.71 |
| **VGGFace2** | **ImageNet-1K** | **6.7964** | **10.74** | **21.08** | **8.77** |
| Places365 | Baseline | 3.9690 | 25.63 | 51.90 | 23.16 |
| Places365 | Fovea-Gaze | 4.2347 | 21.86 | 46.21 | 19.14 |
| Places365 | Periph-NF | 4.2621 | 20.51 | 44.58 | 17.86 |
| Places365 | Periph | 4.2671 | 20.26 | 44.10 | 17.65 |
| Places365 | STL-10 | 3.8281 | 26.57 | 53.47 | 24.82 |
| Places365 | ImageNet-100 | 3.9207 | 24.99 | 51.21 | 23.32 |
| **Places365** | **ImageNet-1K** | **3.6264** | **30.17** | **58.46** | **28.36** |
**Note:** SimCLR Top-1 is computed from the self-supervised contrastive objective and is not directly comparable to downstream supervised classification accuracy. For downstream tasks, the pretrained ResNet-18 backbone was **frozen** and only a linear classifier was trained; the backbone weights were **not fine-tuned**. Classifier checkpoints were selected by best validation Macro-F1. In-domain Top-1 accuracy is omitted because label imbalance across frames can make accuracy misleading; Macro-F1 is reported as the primary class-balanced metric. STL-10, ImageNet-100, and ImageNet-1K are treated as out-of-domain baselines because they were not pretrained on VEDB.
For in-domain classification, Macro-F1 was used as the primary class-balanced metric because of label imbalance across VEDB frame categories.
## Intended Use
This checkpoint is provided for research and downstream applications involving self-supervised visual representations, including:
- reproducing the reference-model analyses reported in Diaz and Henderson (2026),
- extracting ResNet-18 representations for comparison with the VEDB-pretrained models,
- reproducing the associated NSD voxelwise encoding analyses,
- linear-probe or fine-tuned image classification,
- transfer learning to other visual recognition tasks, and
- representation-learning and visual-neuroscience research.
The released checkpoint contains a self-supervised ResNet-18 encoder and SimCLR projection head rather than a trained classification head. For image classification, users can attach and train an appropriate classifier on the learned backbone representations or fine-tune the encoder for the target task.
## Related Models
This model was used as a non-egocentric reference model in the study associated with the **[Eccentricity-Constrained SimCLR Models (VEDB)](https://hf.co/collections/DM-Diaz/eccentricity-constrained-simclr-models-vedb)** collection.
- [VEDB SimCLR ResNet-18 β€” Baseline](https://huggingface.co/DM-Diaz/VEDB-SimCLR-ResNet18-Baseline)
- [VEDB SimCLR ResNet-18 β€” Fovea-Gaze](https://huggingface.co/DM-Diaz/VEDB-SimCLR-ResNet18-Fovea-Gaze)
- [VEDB SimCLR ResNet-18 β€” Periph](https://huggingface.co/DM-Diaz/VEDB-SimCLR-ResNet18-Periph)
- [VEDB SimCLR ResNet-18 β€” Periph-NF](https://huggingface.co/DM-Diaz/VEDB-SimCLR-ResNet18-Periph-NF)
- [VEDB NSD ResNet-18 β€” Encoding Models](https://huggingface.co/DM-Diaz/VEDB-NSD-ResNet18-Encoding-Models)
- [SimCLR ResNet-18 β€” ImageNet-1K](https://huggingface.co/DM-Diaz/SimCLR-ResNet18-ImageNet1K)
- [SimCLR ResNet-18 β€” ImageNet-100](https://huggingface.co/DM-Diaz/SimCLR-ResNet18-ImageNet100)
- [SimCLR ResNet-18 β€” STL-10](https://github.com/Spijkervet/SimCLR) *(external pretrained reference model; checkpoint provided by Spijkervet/SimCLR and not redistributed by this project)*
## Computational Resources
Model training and computational analyses for this study were conducted primarily using Carnegie Mellon University Neuroscience Institute's [MiND computing cluster](https://ni.cmu.edu/computing/knowledge-base/mind-cluster-nodes/).
## Citation
If you use this checkpoint or representations derived from it in academic work, please cite the associated study:
```bibtex
@inproceedings{diaz2026eccentricity,
author = {Diaz, Dylan M. and Henderson, Margaret M.},
title = {Eccentricity-Constrained CNN Training Reveals Adaptive Information Coding Around the Visual Field},
booktitle = {Proceedings of the 9th Conference on Cognitive Computational Neuroscience},
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.