Project aims to find and analyse galaxy clusters using AI in microwave and IK range
We assume Python 3.10+ is installed. Dependencies can be managed via Poetry or pip.
- Navigate to the project directory:
cd galaxyHackers
-
Enter the Poetry environment:
poetry env activate
-
Install the project dependencies:
poetry install
If Poetry doesn't suit your needs or it fails to fetch all required libraries, you can use pip to install all dependencies.
-
(Optional) Set up and activate the virtual environment:
python3.10 -m venv venv source ./venv/bin/activate -
Install the necessary packages using
pip:pip install torch torchvision timm torch_optimizer tqdm pip install numpy pandas matplotlib scikit-learn Pillow pip install astropy astroquery pixell dynaconf wget pip install comet_ml h5py ultralytics mlflow
Once dependencies are installed, you can start training the models.
Train a model by running the main.py script:
python3 -m galaxy.main --models MODEL_NAME --epochs NUM_EPOCH --data DATASET
Available flags:
| Flag | Description | Default / Options |
|---|---|---|
--models |
Model(s) to train | Baseline, ResNet18, EfficientNet, DenseNet, SpinalNet_ResNet, SpinalNet_VGG, ViTL16, AlexNet_VGG, CNN_MLP, YOLO12n, YOLO12s, YOLO12m, YOLO12l, YOLO12x (default: all except YOLO12s & YOLO12l) |
--epochs |
Number of training epochs | Default: 5 |
--mm |
Momentum (for SGD or RMSprop) | Default: 0.9 |
--optimizer |
Optimizer to use | Adam, SGD, Rprop, NAdam, RAdam, AdamW, RMSprop, DiffGrad (default: AdamW) |
--repoptimizer |
Wrap optimizer using RepOptimizer | Optional (see paper Re-parameterizing Your Optimizers rather than Architectures) |
--segment |
Generate segmentation maps after training | Optional |
--data |
Dataset to use | WISE (W1/W2 bands) or ACT (90, 150, 220 GHz from LAMBDA) (default: WISE) |
--seed |
Random seed (integer number) | Default: 1 |
--comet |
Enable Comet.ml tracking | Optional |
--mlflow |
Enable MLflow tracking | Optional |
Important
Only one optimizer can be passed in command-line.
In case script fails to download any dataset, it will address Legacy Survey website to download data of the infrared bands W1, W2 (for Russia available with VPN only).
Learning rate is found automatically using LR range test, so it is not passed using command-line.
For more information see A disciplined approach to neural network hyper-parameters: Part 1 -- learning rate, batch size, momentum, and weight decay
You can run several models simultaneously with the same optimizer and learning rate.
Single model training:
python3 -m galaxy.main --models YOLO --epochs 5 --data ACT --segmentMultiple models training:
python3 -m galaxy.main --models AlexNet_VGG ResNet18 --epochs 20 --data WISE --segmentpython3 -m galaxy.main --models --epochs 20 --data WISE --segment
The script supports Comet.ml and MLflow for experiment tracking.
- Rename
.example.secrets.tomlto.secrets.toml - In
.secrets.tomlpass your Comet API to the varibleCOMET_API_KEYand the name of the workspace intoCOMET_WORKSPACE - Enable
--cometflag
Important
The script will not work without renaming .example.secrets.toml to .secrets.toml- this way you pass empty key.
- Enable
--mlflowflag
Full documentation can be viewed here.