cvt-gravit-s2 / README.md
parlange's picture
Upload CvT model from experiment s2
a74dcd7 verified
metadata
license: apache-2.0
tags:
  - vision-transformer
  - image-classification
  - pytorch
  - timm
  - cvt
  - gravitational-lensing
  - strong-lensing
  - astronomy
  - astrophysics
datasets:
  - parlange/gravit-c21
metrics:
  - accuracy
  - auc
  - f1
paper:
  - title: 'GraViT: A Gravitational Lens Discovery Toolkit with Vision Transformers'
    url: https://arxiv.org/abs/2509.00226
    authors: Parlange et al.
model-index:
  - name: CvT-s2
    results:
      - task:
          type: image-classification
          name: Strong Gravitational Lens Discovery
        dataset:
          type: common-test-sample
          name: Common Test Sample (More et al. 2024)
        metrics:
          - type: accuracy
            value: 0.6852
            name: Average Accuracy
          - type: auc
            value: 0.7569
            name: Average AUC-ROC
          - type: f1
            value: 0.4201
            name: Average F1-Score

🌌 cvt-gravit-s2

πŸ”­ This model is part of GraViT: Transfer Learning with Vision Transformers and MLP-Mixer for Strong Gravitational Lens Discovery

πŸ”— GitHub Repository: https://github.com/parlange/gravit

πŸ›°οΈ Model Details

  • πŸ€– Model Type: CvT

  • πŸ§ͺ Experiment: S2 - C21-half-18660

  • 🌌 Dataset: C21

  • πŸͺ Fine-tuning Strategy: half

  • 🎲 Random Seed: 18660

πŸ’» Quick Start

import torch
import timm

# Load the model directly from the Hub
model = timm.create_model(
    'hf-hub:parlange/cvt-gravit-s2',
    pretrained=True
)
model.eval()

# Example inference
dummy_input = torch.randn(1, 3, 224, 224)
with torch.no_grad():
    output = model(dummy_input)
    predictions = torch.softmax(output, dim=1)
print(f"Lens probability: {predictions[0][1]:.4f}")

⚑️ Training Configuration

Training Dataset: C21 (CaΓ±ameras et al. 2021)
Fine-tuning Strategy: half

πŸ”§ Parameter πŸ“ Value
Batch Size 192
Learning Rate AdamW with ReduceLROnPlateau
Epochs 100
Patience 10
Optimizer AdamW
Scheduler ReduceLROnPlateau
Image Size 224x224
Fine Tune Mode half
Stochastic Depth Probability 0.1

πŸ“ˆ Training Curves

Combined Training Metrics

🏁 Final Epoch Training Metrics

Metric Training Validation
πŸ“‰ Loss 0.3223 0.2497
🎯 Accuracy 0.8233 0.8970
πŸ“Š AUC-ROC 0.9285 0.9638
βš–οΈ F1 Score 0.8232 0.8987

β˜‘οΈ Evaluation Results

ROC Curves and Confusion Matrices

Performance across all test datasets (a through l) in the Common Test Sample (More et al. 2024):

ROC + Confusion Matrix - Dataset A ROC + Confusion Matrix - Dataset B ROC + Confusion Matrix - Dataset C ROC + Confusion Matrix - Dataset D ROC + Confusion Matrix - Dataset E ROC + Confusion Matrix - Dataset F ROC + Confusion Matrix - Dataset G ROC + Confusion Matrix - Dataset H ROC + Confusion Matrix - Dataset I ROC + Confusion Matrix - Dataset J ROC + Confusion Matrix - Dataset K ROC + Confusion Matrix - Dataset L

πŸ“‹ Performance Summary

Average performance across 12 test datasets from the Common Test Sample (More et al. 2024):

Metric Value
🎯 Average Accuracy 0.6852
πŸ“ˆ Average AUC-ROC 0.7569
βš–οΈ Average F1-Score 0.4201

πŸ“˜ Citation

If you use this model in your research, please cite:

@misc{parlange2025gravit,
      title={GraViT: Transfer Learning with Vision Transformers and MLP-Mixer for Strong Gravitational Lens Discovery}, 
      author={RenΓ© Parlange and Juan C. Cuevas-Tello and Octavio Valenzuela and Omar de J. Cabrera-Rosas and TomΓ‘s Verdugo and Anupreeta More and Anton T. Jaelani},
      year={2025},
      eprint={2509.00226},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2509.00226}, 
}

Model Card Contact

For questions about this model, please contact the author through: https://github.com/parlange/