Overview

A catalog-driven deep-learning pipeline that classifies stars from RGB image cutouts. The model predicts the Morgan–Keenan spectral letter and the subclass digit (0–9 within the predicted letter) from photometric imagery alone. O stars are rare enough that none were in this run's training data, so the letter head reported here resolves six classes: B, A, F, G, K, M.

Inputs are constructed by querying VizieR catalogs for coordinates, magnitudes, colors, and spectral hints, then fetching color cutouts from Pan-STARRS with graceful fallbacks to other surveys. Each cutout is preprocessed to expose color cues without saturating the stellar core, then routed through a multi-task CNN.

Pipeline

Three independent stages: catalog ingestion, image builder, and classifier.

Dataset

The raw class distribution is steeply imbalanced: K and F stars dominate; O and M are rare. The builder applies a "curved" target distribution to soften this skew without throwing away the long tail. The run behind the reported model had no O stars, so the letter metrics below are six-class.

Letter class counts
Letter Before balancing After balancing
K 30,901 26,154
F 30,117 25,754
A 17,127 18,356
G 12,072 14,881
B 5,537 9,322
M 285 1,572
Final dataset splits
Split Images
Train 67,227
Validation 14,406
Test 14,406

Splits total 96,039 rows, the same as the balanced set. Balancing draws the minority letters with replacement before the split, so copies of one image can sit in both train and test: 27.4% of the test images have an identical copy in training (M 97.9%, B 66.8%, G 58.7%, A 53.3%; F and K, only downsampled, none). The unseen-star check under Results measures how far the headline holds.

Quality gates

Model architecture

A compact, regularized four-block ConvNet with three jointly-trained heads.

Four Conv → BatchNorm → ReLU blocks (32 → 64 → 128 → 256 channels) feed global average pooling and a shared dense layer. Three softmax heads sit on top:

Training

Two-stage. Stage 1 trains the whole network on the letter loss alone to establish a stable backbone. Stage 2 adds the combined-head loss at equal weight and a lower learning rate; nothing is frozen in either stage. Class balance is handled by curved resampling plus class-balanced sample weights. The 70 / 15 / 15 split is stratified on letter. Plateau-triggered LR reductions and early stopping with best-weight restoration guard against overfitting.

Letter-head training and validation loss/accuracy curves over the multi-task training run.
Letter-head loss and accuracy across training. The two-stage schedule is visible: Stage 1 trains on the letter task alone for 57 epochs; when Stage 2 adds the combined loss, validation accuracy dips sharply before recovering to its earlier level.

Results

The letter head is the headline number: it tracks the macroscopic temperature sequence robustly. Subclass resolution is harder because RGB cutouts encode color differences only coarsely.

Because 27.4% of the test set has a copy in training, the model was also scored on 17,672 stars from a separate bundle that it never saw. On the 6,944 A, B, F and G stars among them, as bright as the training data, it gets 82.3% top-1, so for that population the headline roughly holds. That bundle's K and M stars are more than ten magnitudes fainter than the training stars, and the model mostly calls them G: it has not learned faint stars.

Letter confusion matrix

Test set letter-head confusion across the six spectral classes the model resolves. The diagonal dominates as expected; what little off-diagonal mass exists is concentrated on adjacent letters in the temperature sequence.

6-class spectral letter confusion matrix (B, A, F, G, K, M) on the held-out test set.
Held-out test set, 14,406 samples. Confusion concentrates on A/F, F/G, and G/K, neighbouring letters in the H–R diagram, which is consistent with the model learning a smooth temperature sequence.

Error analysis

Confusion concentrates at decision boundaries that are physically adjacent: the model is learning a smooth temperature sequence rather than memorizing class identities.

Combined letter × subclass confusion matrix: 60 effective classes spread across B, A, F, G, K, M letters and 0–9 subclass digits.
Combined letter × subclass confusion matrix on the test set. The block-diagonal structure shows that errors cluster within a letter (off-by-one subclass) far more than they cross letter boundaries: the model has learned the temperature sequence as a continuous quantity, not a set of independent classes.

Inference program

The inference script loads the trained model, reads a star image or a folder of them, applies the same preprocessing as training, and prints a letter + subclass prediction for each (e.g. G2), with the catalogue answer alongside when a bundle's metadata is supplied.

Limitations & future work