Space Taxonomy and Analysis Recognition.
Upload a galaxy image and the model predicts whether it is smooth or featured/disk, then shows the confidence and class probabilities.
This project uses data from the Galaxy Zoo 2 public releases.
Create the following folders inside data/:
data/raw/data/raw/galaxy_zoo_2/
The raw files should be placed in data/raw/galaxy_zoo_2/ like this:
data/
├── raw/
│ └── galaxy_zoo_2/
│ ├── gz2_hart16.csv
│ ├── gz2_filename_mapping.csv
│ └── images/
│ ├── image_1.jpg
│ ├── image_2.jpg
│ └── ...
└── processed/Download the raw files from the following sources:
-
Morphology table:
gz2_hart16.csv.gzfrom the Galaxy Zoo data site
https://data.galaxyzoo.org/#section-8 -
Image files:
images_gz2.zipfrom the Galaxy Zoo 2 Zenodo release
https://zenodo.org/records/3565489 -
Image mapping file:
gz2_filename_mapping.csv, used to match image filenames with galaxy entries in the morphology table
https://zenodo.org/records/3565489/files/gz2_filename_mapping.csv?download=1
After downloading:
- Place
gz2_hart16.csv.indata/raw/galaxy_zoo_2/ - Place
gz2_filename_mapping.csvindata/raw/galaxy_zoo_2/ - Extract
images_gz2.zip - Move the extracted
images/folder intodata/raw/galaxy_zoo_2/
The processed files used during training are saved in data/processed/.
The Galaxy Zoo 2 images are based on galaxies from the Sloan Digital Sky Survey (SDSS).
The app loads a trained image classification model and processes an uploaded galaxy image before making a prediction.
After inference, it returns the predicted class, the confidence score, and the probability for each class.
Current classes:
- Smooth
- Featured/Disk
-
Clone the repository:
git clone https://github.com/Charlsz/star.git cd star -
Create and activate a virtual environment:
Windows
python -m venv .venv .venv\Scripts\activate
macOS / Linux
python -m venv .venv source .venv/bin/activate -
Install the dependencies:
pip install -r requirements.txt
Before running the app, you need to train the model to generate the saved weights file used for prediction.
Run:
python star/train.pyAfter training, the model weights will be saved as:
star_cnn.ptAfter the model has been trained, start the Streamlit app with:
python -m streamlit run star/app.pyThen open the local URL shown in the terminal, upload a galaxy image, and click Predict.