|
Download README.md from DM-Diaz/SimCLR-ResNet18-ImageNet100: direct link, hf CLI and curl.
- Browser
- Download file 11.7 kB
-
https://huggingface.co/DM-Diaz/SimCLR-ResNet18-ImageNet100/resolve/main/README.md
- Command line
-
hf download hf://DM-Diaz/SimCLR-ResNet18-ImageNet100/README.md
-
curl -L -o README.md https://huggingface.co/DM-Diaz/SimCLR-ResNet18-ImageNet100/resolve/main/README.md
11.7 kB
| license: apache-2.0 | |
| tags: | |
| - pytorch | |
| - computer-vision | |
| - self-supervised-learning | |
| - simclr | |
| - resnet18 | |
| - imagenet | |
| - lightly | |
| - visual-neuroscience | |
| - neural-encoding | |
| - arxiv:2607.19316 | |
| datasets: | |
| - clane9/imagenet-100 | |
| # SimCLR ResNet-18 β ImageNet-100 | |
| This repository contains the **ImageNet-100 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-1K 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 [`clane9/imagenet-100`](https://huggingface.co/datasets/clane9/imagenet-100) 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 and a SimCLR projection head attached during self-supervised pretraining. | |
| | 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 the SimCLR projection head. For downstream applications, the **512-dimensional backbone representation** can be extracted independently of the projection head. | |
| ## Training Configuration | |
| | Parameter | Value | | |
| | --- | --- | | |
| | Dataset | ImageNet-100 | | |
| | Dataset source | `clane9/imagenet-100` | | |
| | Number of classes | 100 | | |
| | Epochs | 120 | | |
| | Batch size | 64 | | |
| | Input resolution | `224 Γ 224` | | |
| | Optimizer | LARS | | |
| | Initial learning rate | `0.075` | | |
| | 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 Γ (64 / 256) = 0.075` | |
| ## Training Data | |
| Training data were obtained from the Hugging Face dataset: | |
| [`clane9/imagenet-100`](https://huggingface.co/datasets/clane9/imagenet-100) | |
| The dataset was downloaded locally and organized into training and validation directories. 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_120-resnet18-simclr-imagenet100.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 | `119` | | |
| | Training epochs completed | 120 | | |
| | Global step | `237,480` | | |
| | State-dict entries | 132 | | |
| | Backbone output | 512 dimensions | | |
| | Projection output | 128 dimensions | | |
| | Strict architecture loading | Successful | | |
| The stored epoch is zero-indexed, so `epoch = 119` corresponds to the completion of epoch 120. | |
| The checkpoint also contains optimizer, learning-rate scheduler, training-loop, callback, and mixed-precision state in addition to the 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_120-resnet18-simclr-imagenet100.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-100 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 pretraining evaluation 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 VEDB frame categories 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 reference models because they were not pretrained on VEDB. | |
| ## 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-100 training dataset and third-party software used to produce the model remain subject to their respective licenses, access requirements, and terms of use. | |