This project implements a PyTorch-based neural network for galaxy classification. The code supports training, validation, and testing on custom datasets extracted from provided .zip archives.
- Clone the repository: git clone https://github.com/archon774/Galaxy-Classification.git
- Then navigate to this repo using: cd Galaxy-Classification
- Create a virtual environment in this main repo folder using:
- python3.13 -m venv venv
-
Activate the virtual environment:
- Linux/macOS: source venv/bin/activate
- Windows: venv\Scripts\activate
-
Install dependencies: pip install -r requirements.txt
python code/galaxy_model_trainer.py
- The script will prompt you to select a dataset size from 1000, 2500, 5000, 10000, 50000.
- It will automatically extract images to
data/processed_data/imgs/and usedata/processed_data/labels/for the labels. - Training, validation, and test errors will be logged during execution.
- The best model (based on validation error) is saved in the
saved_modelsfolder. - A plot of training and validation errors is saved in
figures/.
python code/galaxy_model_tester.py
- The script will prompt you to select what dataset size you want to test from 1000, 2500, 5000, 10000, 50000.
- The script will prompt you to select what model you would like to test, so long as it is valid (model dataset size matches desired test size)
- It will evaluate the model on the test set in
data/processed_data/imgs/anddata/processed_data/labels/while printing errors and metrics to the console. - The script probes the four hidden layers in the neural network model, calculating RMSE along the layers for each test concept
- A final plot of the RMSE per layer per concept will be saved to
figures/.
- The code automatically sets random seeds for reproducibility.
- Training is done on CPU or GPU, depending on availability. Currently the code supports CPU training, untested on GPU services like Google Colab.
coming soon