Galaxy Bar Detection β€” ResNet50 (IITK Astronomy Project)

CNNs that detect stellar bars in simulated disc galaxies β€” and, in the final version, measure bar strength as a continuous quantity.

⭐ Final model: regression_resnet50.weights.h5 β€” 96.0% accuracy

Instead of binary bar/no-bar labels, the final model regresses the physical A2/A0 Fourier bar-strength directly from a 224x224 grayscale stellar density image. Classification = predicted A2/A0 >= 0.19.

Metric (450-img test set, 18 unseen snapshots) Value
Classification accuracy 96.0%
Bar recall 92.0%
Strength MAE 0.027 (A2/A0 units, range 0-0.28)

Why regression beat binary classification (86.4% -> 96.0% on the SAME test): it unlocked ~60 mid-strength galaxies (0.10 < A2/A0 < 0.22) that binary labeling had to discard, curing the classifier's "boundary blindness" around its own decision threshold. See pred_vs_true_final.png β€” the model acts as a bar-strength measuring instrument.

Loading (weights-only, due to a Keras serialization bug with the full model)

from tensorflow import keras
from tensorflow.keras import layers

base = keras.applications.ResNet50(weights=None, include_top=False, input_shape=(224,224,3))
inp = keras.Input((224,224,3))
x = keras.Sequential([layers.Identity()])(inp)     # placeholder (training had augmentation here)
x = keras.applications.resnet50.preprocess_input(x)
x = base(x, training=False)
x = layers.GlobalAveragePooling2D()(x)
x = layers.Dropout(0.3)(x)
out = layers.Dense(1, activation="sigmoid")(x)      # output * 0.30 = A2/A0
model = keras.Model(inp, out)
model.load_weights("regression_resnet50.weights.h5")

Input: 224x224 grayscale stellar density map (log10, clipped 1e7-1e9, normalized 0-1, replicated to 3 channels), 40 kpc field of view, galaxy centered and inclination <= 40 deg. Output x 0.30 = predicted A2/A0;

= 0.19 = barred.

Earlier binary models (the journey)

bar_resnet50_v{1,2,3}.keras β€” binary classifiers documenting the iterative arc: v1 76.5% (tilts to 60 deg, label noise) -> v2 86.8% (tilt cap 40 deg) -> v3 86.4% w/ AUC 0.944 (122 snapshots). With test-time augmentation + 3-seed ensembling v3 reached 91.8%. A morpho-kinematic variant (velocity channels) was tested and did NOT help (83.3%) β€” morphology suffices at <= 40 deg. Architecture comparison on regression: ResNet50 96.0% >> ConvNeXt-Tiny 91.6%

EfficientNetV2-B0 84.0%; ensembles diluted the champion.

Labels are physical, not manual: each simulation snapshot's A2/A0 Fourier bar strength (from an N-body GADGET simulation, 502 snapshots) labels every image rendered from it. Data always split by snapshot to prevent leakage.

Code, dataset pipeline, full analysis: https://github.com/GuptaOum/IITK_astronomy_project

Downloads last month
255
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support