Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌌 AstroVision Advanced

Fine-tuned Galaxy Morphology Classifier + Research Assistant

Streamlit App Model on HuggingFace Python 3.12

An upgraded version of AstroVision, replacing the zero-shot CLIP model with Zoobot — a deep learning model specifically built and fine-tuned for galaxy morphology classification on real labeled astronomical data.


🚀 Live Demo

Try it here → astrovision-advanced.streamlit.app


✨ Results

All 5 galaxy classes classified correctly on real astronomical images:

Galaxy Type Confidence
🌀 Spiral Galaxy 99.89%
⚪ Elliptical Galaxy 81.42%
💫 Edge-on Disk 100.00%
🌫️ Irregular Galaxy 99.17%
💥 Merger 99.99%

Validation accuracy: 92.9% — trained on 17,736 real galaxy images from the Galaxy10 DECals dataset.


What Changed From AstroVision v1?

AstroVision (v1) AstroVision Advanced
Classifier CLIP (zero-shot, general-purpose) Zoobot (fine-tuned on galaxy images)
Training data None — text prompts only 17,736 labeled galaxy images
Architecture Vision Transformer (ViT-B/32) ConvNeXT Nano
Val Accuracy Not applicable 92.9%
Research module Google Gemini Google Gemini (unchanged)

Features

🔭 Module 1 — Galaxy Classifier (Zoobot)

Upload a galaxy image and the app classifies it into one of 5 morphological types:

  • Spiral Galaxy
  • Elliptical Galaxy
  • Edge-on Disk
  • Irregular Galaxy
  • Merger

The model was fine-tuned on Galaxy10 DECals — a real dataset of galaxy images labeled by volunteers through the Galaxy Zoo citizen science project. Results are shown as a confidence score and a probability bar chart across all 5 classes.

📄 Module 2 — Research Assistant (Gemini)

Upload an astronomy research paper (PDF) and interact with it using Google Gemini:

  • Summarization — three detail levels: Brief Abstract, Key Findings, or Comprehensive Analysis
  • Q&A — ask technical questions; Gemini answers based strictly on the uploaded paper

🛠️ Setup

1. Clone the repository

git clone https://github.com/zev-walker/Astrovision-Advanced.git
cd Astrovision-Advanced

2. Create a virtual environment (Python 3.12)

py -3.12 -m venv venv
venv\Scripts\activate      # Windows
# source venv/bin/activate  # Linux/Mac

3. Install PyTorch with CUDA (for GPU training)

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121

4. Install remaining dependencies

pip install -r requirements.txt

5. Configure Gemini API Key

Create .streamlit/secrets.toml:

GEMINI_API_KEY = "your-gemini-api-key-here"

Get a free key at https://aistudio.google.com/app/apikey

6. Fine-tune the model (one-time)

python train.py

This downloads Galaxy10 DECals (~2.5GB), fine-tunes Zoobot for 10 epochs, and saves model/zoobot_finetuned.ckpt.

On an RTX 3050 Laptop GPU: approximately 30–45 minutes.

Alternatively, the pre-trained checkpoint is available on Hugging Face and downloads automatically on first app launch.

7. Run the app

streamlit run app.py

🧠 How the Model Works

Zoobot is a foundation model for galaxy morphology created by Mike Walmsley, trained on millions of Galaxy Zoo volunteer classifications. This project uses Zoobot's pretrained ConvNeXT Nano encoder as a feature extractor with a fine-tuned classifier head trained on Galaxy10 DECals.

Galaxy10 DECals contains 17,736 labeled galaxy images across 10 classes, remapped to 5 for this project:

Galaxy10 Original Mapped To
Barred Spiral, Unbarred Tight Spiral, Unbarred Loose Spiral Spiral Galaxy
Round Smooth, In-between Smooth, Cigar Shaped Smooth Elliptical Galaxy
Edge-on without Bulge, Edge-on with Bulge Edge-on Disk
Disturbed Galaxies Irregular Galaxy
Merging Galaxies Merger

🗂️ Project Structure

AstroVision-Advanced/
├── app.py              # Streamlit application
├── train.py            # One-time fine-tuning script
├── requirements.txt    # Python dependencies
├── README.md
├── .gitignore
├── data/               # Galaxy10 dataset (gitignored — auto-downloaded)
└── model/              # Model weights (gitignored — auto-downloaded from HF)

🔧 Tech Stack

Component Library
App framework Streamlit
Galaxy classifier Zoobot (zoobot[pytorch])
Model architecture ConvNeXT Nano
Training framework PyTorch Lightning
Training dataset Galaxy10 DECals (via h5py)
LLM (Research module) Google Gemini
PDF parsing PyPDF2
Image handling Pillow

🔗 Links


Built with ❤️ for Astronomy and Deep Learning

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages