Downloads · 30 days
0
roth1414/galaxy-vit-zoobot-dirichlet
galaxy-vit-zoobot-dirichlet is a image classification model from roth1414. Use it when you need a label for an image. It is set up for pytorch. The card lists the license as cc-by-4.0.
A Bayesian galaxy morphology classifier: a galaxy-pretrained ConvNeXt-nano encoder (Zoobot) finetuned with a Dirichlet-Multinomial output head over the 10-question / 34-answer Galaxy Zoo DESI decision tree. Produces a…
Downloads · 30 days
0
Access
Public
Updated May 13, 2026
Repo size
59.9 MB
Likes
0
Public
Click a slice to open those files.
.pt59.9 MB · 100%
From the Hugging Face model README
A Bayesian galaxy morphology classifier: a galaxy-pretrained ConvNeXt-nano encoder (Zoobot) finetuned with a Dirichlet-Multinomial output head over the 10-question / 34-answer Galaxy Zoo DESI decision tree. Produces analytic per-answer credible intervals; tested at ≥ 0.93 coverage at the 95% level after post-hoc temperature scaling.
Hosted at https://roth1414-galaxy-vit-demo.hf.space (7 tabs):
A 90-second walkthrough is in docs/loom_shotlist.md in the source
repo. The complete v2 changelog is at
CHANGELOG.md.
| Architecture | ConvNeXt-nano (640-D feature) + Linear(640, 34) + softplus + α_floor |
| Parameters | ~16M (Zoobot encoder) + 21,794 (head) |
| Input | RGB DECaLS cutout, 224×224 |
| Output | 34-D concentration vector α (positive); per-question Dirichlet posterior |
| Training data | 80 train + 20 val tar shards of mwalmsley/gz_desi_wds, DR8 subset only |
| Optimizer | AdamW; encoder LR 1e-5, head LR 1e-3, weight decay 0.05 |
| Schedule | Cosine; 3-epoch warmup; 2 head-only epochs before encoder unfreeze |
| Precision | bf16 forward; gammaln and loss in fp32 |
| Early stop | val/vote_mae_macro patience 5; converged at epoch 25 of 50 |
| Metric | Raw | T-calibrated (T=60) |
|---|---|---|
| Macro vote-fraction MAE | 0.0883 | 0.0883 (preserved by design) |
| Macro coverage at 95% CI | 0.49 | 0.93 |
all_finite α throughout training | Yes | — |
| Monotone train loss, epochs 1–5 | Yes | — |
For the cross-entropy baseline trained on the same data
(configs/m2_w23_reproduction.yaml), macro top-1 = 0.8445 at the per-question
plurality, comparable to Walmsley+23's published numbers.
| Question | MAE | Coverage |
|---|---|---|
| smooth-or-featured | 0.064 | ≥ 0.90 |
| disk-edge-on | 0.092 | ≥ 0.90 |
| has-spiral-arms | 0.124 | ≥ 0.85 |
| bar | 0.102 | ≥ 0.90 |
| bulge-size | 0.089 | ≥ 0.85 |
| how-rounded | 0.067 | ≥ 0.90 |
| edge-on-bulge | 0.099 | ≥ 0.85 |
| spiral-winding | 0.119 | ≥ 0.85 |
| spiral-arm-count | 0.077 | ≥ 0.85 |
| merging | 0.051 | ≥ 0.95 |
Lower-data questions (spiral-winding, spiral-arm-count, edge-on-bulge) have
the wider per-question CIs and the highest MAE; this is the expected pattern when
volunteer disagreement is large per-galaxy.
On the volunteer-cross-matched subset (~4,400 galaxies), model-predicted any-bar fraction recovers the canonical bar–bulge anti-correlation:
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
# Download the weights.
ckpt_path = hf_hub_download(
repo_id="jroth1414/galaxy-vit-zoobot-dirichlet",
filename="best.pt",
)
# Construct the model (needs the project source for the head wrapper).
from galaxy_vit.models.dirichlet_head import build_zoobot_dirichlet
from galaxy_vit.data.transforms import build_eval_transform, load_normalization
model, _, _ = build_zoobot_dirichlet(num_answers=34, alpha_floor=1.0)
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=True)
model.load_state_dict(ckpt["model_state_dict"])
model.eval()
# Predict on a single image.
mean, std = load_normalization("configs/normalization.json")
tf = build_eval_transform(image_size=224, mean=mean, std=std)
img = Image.open("your_galaxy.jpg").convert("RGB")
with torch.no_grad():
alpha = model(pixel_values=tf(img).unsqueeze(0)).alpha
# alpha has shape (1, 34) in canonical question_index_groups order.
# Posterior mean for the smooth-or-featured 3-answer block:
print((alpha[0, :3] / alpha[0, :3].sum()).tolist())
For analytic 95% credible intervals on every answer, see
galaxy_vit.inference.posterior.credible_interval in the source repo.
The released best.pt is the raw Dirichlet checkpoint (no temperature applied at
save time). The temperature scalar that recovers coverage = 0.93 at 95% CI is shipped
alongside in calibrated_metrics.json (single-T value, default 60.0). Two ways to
use it:
The release script's default is raw; opt in to calibrated with
scripts/calibrate_dirichlet.py.
Research-grade galaxy morphology classification on DECaLS-style cutouts. The model was trained only on the Walmsley+23 DR8 subset; predictions on substantially out-of-distribution imagery (HSC, JWST, deep-field) should be re-validated.
spiral-winding, spiral-arm-count) is well below 80%; the
practical accuracy ceiling on those questions is similar.disk-edge-on,
has-spiral-arms, bar, bulge-size, how-rounded, edge-on-bulge,
spiral-winding, spiral-arm-count are only meaningful for galaxies whose
upstream classifications match the gating answers. The active flag in the
serving response handles this for downstream consumers.gammaln and the loss
run in fp32. Don't try to inference the head's loss in pure bf16; the head's
forward in bf16 is fine.The labeled DR8 subset of the GZ DESI WebDataset
(mwalmsley/gz_desi_wds):
80 train shards, 20 val shards, 20 held-out test shards, totaling ~80k labeled
galaxies after the has_any_dr8_votes filter. Vote counts follow the canonical
Walmsley+23 schema; the project schema module
(galaxy_vit.data.schema) pins answer order against upstream
galaxy-datasets and asserts
canonical-ordering parity at every checkpoint load.
Per-galaxy Dirichlet predictions for the 61,440-row DR8 inference set are
published as the dataset
jroth1414/galaxy-vit-gz-desi-dirichlet-predictions.
That dataset's key and dr8_id columns let downstream users cross-match the
predictions against the Walmsley+23 volunteer catalog.
github.com/jroth1414/galaxy-vit — full
training, inference, serving, and frontend code. The exact commit that produced
best.pt is recorded in runs/m3_dirichlet/run_config.json.
@misc{galaxy_vit_zoobot_dirichlet_v1,
author = {Roth, John},
title = {Galaxy-ViT: Bayesian multi-question galaxy morphology with Zoobot + Dirichlet},
year = {2026},
url = {https://huggingface.co/jroth1414/galaxy-vit-zoobot-dirichlet},
}
Built on Walmsley+22 (Zoobot foundation model), Walmsley+23 (Galaxy Zoo DESI), and
the galaxy-datasets canonical
schema.
Model weights: CC-BY-4.0 (matches Zoobot upstream). Underlying training data retains its original Galaxy Zoo / DECaLS licenses.