astroclass_ai — NASA Deep Space Image Classifier

Astrophysical Deep Learning Backbone (ResNet-34) fine-tuned on observational data from NASA Astronomy Picture of the Day (APOD) and the Mikulski Archive for Space Telescopes (MAST Hubble Space Telescope).


Model Description

astroclass_ai is a deep learning model based on the ResNet-34 architecture, trained to identify and categorize deep space optical and ultraviolet captures into five core astrophysical classes:

Class Index Target Class Astronomical Morphology & Scope
0 star Single stars, globular clusters, open clusters, stellar fields, and star trails.
1 galaxy Spiral, elliptical, lenticular, irregular, merging galaxies, and galaxy clusters.
2 quasar Active Galactic Nuclei (AGN), distant pulsars, and high-energy radio cores.
3 nebula Emission, reflection, planetary nebulae, supernova remnants, and dark clouds.
4 planet Solar system planets, planetary satellites, rings, and surface observations.

Quick Inference with PyTorch & Hugging Face Hub

You can download the model weights directly and run classification on any astronomical image with PyTorch:

import torch
import torchvision.transforms as transforms
from torchvision.models import resnet34
from PIL import Image
from huggingface_hub import hf_hub_download

# 1. Download weights from Hugging Face Hub
model_path = hf_hub_download(
    repo_id="RaulSalasSahuquillo/astroclass_ai",
    filename="astroclass_ai.pth"
)

# 2. Instantiate ResNet-34 with 5-class classification head
classes = ["star", "galaxy", "quasar", "nebula", "planet"]
model = resnet34(weights=None)
model.fc = torch.nn.Linear(model.fc.in_features, len(classes))

# 3. Load weights
model.load_state_dict(torch.load(model_path, map_location="cpu"))
model.eval()

# 4. Standard preprocessing pipeline
preprocess = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(
        mean=[0.485, 0.456, 0.406],
        std=[0.229, 0.224, 0.225]
    )
])

# 5. Classify an astronomical image
image_path = "space_observation.jpg"
image = Image.open(image_path).convert("RGB")
input_tensor = preprocess(image).unsqueeze(0)

with torch.no_grad():
    logits = model(input_tensor)
    probabilities = torch.softmax(logits, dim=1)[0]
    predicted_idx = probabilities.argmax().item()

print(f"Target:     {image_path}")
print(f"Prediction: {classes[predicted_idx]} ({probabilities[predicted_idx]*100:.2f}%)")

Training Details & Hyperparameters

  • Architecture: ResNet-34 (Transfer Learning with pre-trained ImageNet backbone).
  • Optimization: Adam (learning_rate = 1e-4).
  • Loss Function: Multi-class Cross-Entropy Loss (nn.CrossEntropyLoss).
  • Acceleration: PyTorch Automatic Mixed Precision (torch.cuda.amp.autocast).
  • Augmentations: Random horizontal flips, random 180° rotations, and standard image normalization.
  • Epochs: 25.

Multimodal AI Validation (Google Gemini)

In the complete pipeline, classifications are audited one-by-one by Google Gemini 2.5 Flash to identify raw telescope artifacts (cosmic ray streaks, dead pixels, CCD calibration noise) and distinguish them from genuine astronomical targets.

For the full training notebooks, automated data harvester, SQLite logger, Gemini validator, and web viewer dashboard, visit the official GitHub Repository.


License

This model and its associated weights are distributed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.

  • Attribution: Credit Raúl Salas Sahuquillo and link to the source repository.
  • Non-Commercial: The model and weights may not be used for commercial purposes without explicit permission.
  • ShareAlike: Adaptations must be shared under the same license terms.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Evaluation results