---
language: en
license: mit
tags:
- gan
- cgan
- keras
- tensorflow
- computer-vision
- image-processing
- astronomy
- galaxy-morphology
- image-segmentation
pipeline_tag: image-to-image
library_name: keras
datasets:
- desi-legacy-survey
---
# Galaxy Image Simplification using Generative AI
This repository hosts the pretrained models for **Galaxy Image Simplification using Generative AI**, a pipeline that converts complex galaxy images into simplified, skeletonized representations suitable for quantitative morphology analysis.
The pipeline combines:
- A **ResNet-based classifier** to select **spiral galaxies**
- A **conditional GAN (cGAN)** to produce initial arm masks
- A **post-processing cGAN** to smooth and connect broken arm segments
These models were trained on images from the **DESI Legacy Survey** with manually annotated spiral arms.
---
## Model Sources
- **Code & full project:**
https://github.com/SaiTeja-Erukude/galaxy-image-simplification-using-genai
---
## Files in this repository
| File name | Type | Description |
|----------------------------------|---------------|-------------------------------------------------------------------|
| `models/galaxy_classifier_resnet50.h5` | Keras model | ResNet-based binary classifier: spiral vs. non-spiral galaxy |
| `models/galaxy_simplifier_cgan.h5` | Keras model | Conditional GAN: galaxy RGB image ➜ initial arm-highlighted image |
| `models/postprocess_cgan.h5` | Keras model | Conditional GAN: initial mask ➜ refined, smooth/connected mask |
| `predict.py` | Python script | Full inference pipeline (classification ➜ simplifier cGAN ➜ post-cGAN) |
| `graphical_abstract.jpg` | Image | Graphical abstract / high-level overview of the Galaxy Simplifier pipeline |
| `requirements.txt` | Text file | Python dependencies needed for running inference |
| `README.md` | Markdown | Model card and usage instructions (this file) |
---
## Intended Use
### What this model does
Given an optical galaxy image (RGB, 256×256):
1. **ResNet classifier (`galaxy_classifier_resnet50.h5`)**
- Predicts whether the galaxy is a **spiral**.
- Outputs a 2-class softmax:
- class `0` – non-spiral / other
- class `1` – spiral
- Typical usage: apply a confidence threshold on the spiral class (e.g. `p_spiral > 0.65`) before running the GAN pipeline.
2. **Skeletonization cGAN (`galaxy_simplifier_cgan.h5`)**
- Input: original RGB galaxy image (normalized to `[-1, 1]`).
- Output: image where **white lines** track the spiral arms (initial skeleton-like mask).
3. **Post-processing cGAN (`postprocess_cgan.h5`)**
- Input: initial cGAN output.
- Output: refined mask with **smoother and better-connected arm structures**.
- This can be further processed with classical image processing (thresholding, skeletonization, dilation) to produce final binary masks.
### Primary use cases
- Large-scale **spiral galaxy selection** and morphology analysis
- Measuring arm geometry, pitch angles, and other structural properties
- Building catalogs of simplified galaxy images from wide-field surveys
### Not intended for
- General-purpose image generation outside the astronomy domain
- High-fidelity photometric modeling or pixel-perfect reconstruction of galaxies
---
## How to use
You can either:
- use your **own inference script**, or
- use the provided minimalistic `inference.py`.
---
## Citation
If you use this code, models, or catalog in your research, please cite:
```bibtex
@article{erukude2025galaxy,
title={Galaxy image simplification using Generative AI},
author={Erukude, Sai Teja and Shamir, Lior},
journal={Astronomy and Computing},
pages={100990},
year={2025},
publisher={Elsevier}
}
```