Saltar al contenido
ModelPublicadoExterno
Browse files

Galaxy Bar Detection Resnet50

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

TipoOtherVersiónRevision cd26e7dBcalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
270 MB
Versión
vRevision cd26e7d
Actualizado
27 oct 2026
Descargas
29
Fuente
Hugging Face

Descripción de la fuente

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 accuracy96.0%
Bar recall92.0%
Strength MAE0.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

Fuentes

1 fuente
Hugging FacePrincipalVersión cd26e7dcc27f3558098e92bc143eadf8239aeacf
huggingface.co/kjfk/galaxy-bar-detection-resnet50/tree/cd26e7dcc27f3558098e92bc143eadf8239aeacf

Verificado 19 ago

Download files

Artefactos del modelo

2 artefactos

regression_resnet50.weights.h5

h5 · 270 MB · SHA-256 5e48d7825e92…a080 · Hugging Face

Download file

regression_resnet50/model.weights.h5

h5 · 270 MB · SHA-256 5e48d7825e92…a080 · Hugging Face

Download file

Extractos de fuentes

2 extractos

--- license: mit tags: - image-classification - regression - astronomy - galaxy-morphology - tensorflow - resnet50 - transfer-learning library_name: keras --- # 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) ```python 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-kinemati...

Source context: 29 downloads · 0 likes · Pipeline image-classification · Library keras · Repo kjfk/galaxy-bar-detection-resnet50