Deep Learning and Star-Galaxy Classification: Teaching Computers to Read the Sky

Photo: Daria Rohova / Pexels
The Sloan Digital Sky Survey has imaged over a billion individual objects in the sky. The Dark Energy Spectroscopic Instrument (DESI) will measure the spectra of 40 million galaxies. The upcoming Vera Rubin Observatory will catalog 20 billion objects over its first decade. Every one of those objects needs to be identified: is it a star in our own galaxy, or a galaxy billions of light-years away? A nearby asteroid or a distant quasar? The answer matters profoundly — it determines how every object is used in cosmological analyses. And the scale of the task has made deep learning not a luxury, but a necessity.
Key takeaways
- Distinguishing stars from galaxies requires analyzing morphology, color, and spectral features simultaneously — a task deep learning handles with greater than 99 percent accuracy on modern survey data.
- Quasars — the brilliant cores of active galaxies powered by supermassive black holes — were historically the hardest objects to classify; AI has dramatically improved quasar selection efficiency.
- Photometric redshift estimation, using AI to infer galaxy distances from color alone, is essential for weak gravitational lensing surveys probing dark energy.
- The Vera Rubin Observatory will generate 10 million alerts per night that must be classified in near-real-time — a workload only AI can meet.
Why Classification Matters for Cosmology
At the most fundamental level, you cannot do cosmology without knowing what you're looking at. A cosmological analysis that mixes stars with galaxies, or genuine quasars with stellar mimics, produces contaminated results and incorrect conclusions. The entire edifice of modern cosmology — our understanding of dark matter, dark energy, cosmic structure — depends on correctly identified catalogs.
For nearby, bright objects, classification is relatively straightforward. Stars look like points of light; nearby galaxies resolve into extended blobs with visible structure. But at the faint magnitudes probed by modern wide-field surveys, the distinction becomes subtle. Distant galaxies can appear nearly point-like. Stars with unusual colors can masquerade as high-redshift quasars. Blended images — two objects so close together they appear as one — create ambiguous morphologies. And the sheer number of objects makes manual classification completely infeasible.
Traditional classification relied on simple cuts in parameter space: color indices, size measurements, shape statistics. These work reasonably well for the most obvious cases but fail at the boundaries — precisely the faint, ambiguous objects that are often the most scientifically interesting.
Deep Learning Approaches to Morphological Classification
Convolutional neural networks brought a step change in classification capability. Unlike traditional methods that engineer specific features (ellipticity, concentration, asymmetry), CNNs learn directly from pixel data, discovering the combinations of features that best discriminate between classes.
The Galaxy Morphology Network (GoogLeNet applied to galaxy classification) trained on Galaxy Zoo labels achieved classification accuracy competitive with expert human annotators, while processing images millions of times faster. More recent architectures like ResNet and EfficientNet, applied to Dark Energy Survey data, achieve greater than 99 percent accuracy at separating stars from galaxies across a wide magnitude range.
Morphology-based classification goes far beyond the simple star/galaxy split. Neural networks trained on survey data can classify galaxies into detailed Hubble morphological types — ellipticals, lenticulars, spirals (distinguished by number of arms, bar presence, pitch angle), irregulars, and merging systems. The GZ2 neural network, trained on Galaxy Zoo 2 human-classified data, reproduced volunteer classifications across 37 morphological categories for 300,000 galaxies. Scaled to the billions of objects in DESI and Rubin catalogs, the same approach will produce the most comprehensive morphological survey of the universe ever assembled.
The Quasar Classification Challenge
Quasars — quasi-stellar objects — are the luminous cores of distant galaxies powered by actively accreting supermassive black holes. They outshine entire galaxies and can be seen across most of the observable universe, making them invaluable probes of large-scale structure and cosmic history. But finding them has always been challenging.
In imaging data, quasars look like unresolved point sources — just like stars. Their spectral energy distributions are distinctive, but noisy photometry can muddy the signal. Classical quasar selection used color cuts in multi-band photometry, but with significant incompleteness (missing real quasars) and contamination (including stars and compact galaxies).
Deep learning dramatically improved both metrics. XGBoost and neural network classifiers trained on spectroscopically confirmed quasar catalogs can now classify quasar candidates from photometry alone with completeness exceeding 95 percent and purity exceeding 97 percent. DESI's target selection algorithm, which must select 40 million galaxies and quasars for spectroscopic follow-up from billion-object photometric catalogs, relies heavily on machine learning classifiers to maximize the scientific return from finite telescope fiber allocations.
The ESA Gaia mission's quasar catalog demonstrates the power of this approach. Gaia's astrometric measurements provide proper motions for all detected sources; true quasars have no proper motion (they're essentially infinitely far away), while stars in our galaxy do. Combining this astrometric information with photometric colors and neural network classifiers, Gaia produced a catalog of 6.6 million quasar candidates in 2022 — by far the largest ever assembled.
Photometric Redshifts: Distances Without Spectra
Taking spectra — dispersing an object's light into its component wavelengths to measure precise distance via the Doppler redshift — is expensive and slow. Only the largest telescopes can do it for faint objects, and even DESI, with 5,000 fibers and years of observing, can only take spectra for tens of millions of objects. But photometric surveys like the Rubin Observatory will detect tens of billions of galaxies.
For these billions, photometric redshifts — distances inferred from multi-band color measurements alone — are the only option. The physical basis is straightforward: as a galaxy's light is redshifted by cosmic expansion, characteristic spectral features (the 4000-angstrom break, strong emission lines) shift systematically through the survey filter bands, producing predictable color signatures at different distances.
Machine learning photometric redshift codes, including template-fitting algorithms augmented with neural networks and pure deep learning approaches like the DNF (Directional Neighborhood Fitting) method and photo-z networks, have become the state of the art. Trained on large spectroscopic calibration samples, they achieve per-galaxy distance uncertainties of about 1-2 percent — precise enough for weak gravitational lensing cosmology, which requires accurate redshift distributions for billions of source galaxies.
The DES (Dark Energy Survey) used photometric redshifts derived partly from neural network methods for its major weak lensing cosmology papers, constraining the matter density and clumping parameter of the universe to a few percent precision. The same approach, scaled to Rubin's billion-galaxy catalog, will produce the most precise measurements of dark energy ever achieved.
The Alert Stream and Real-Time Classification
Modern time-domain surveys like the Zwicky Transient Facility (ZTF) and the upcoming Rubin Observatory don't just catalog static objects — they look for change. Every night, ZTF generates around a million "difference images," comparing new observations to reference images and flagging anything that's brightened, faded, or moved. The Rubin Observatory will generate 10 million such alerts per night.
Every alert needs to be classified: Is this a supernova? A variable star? An asteroid? A gamma-ray burst afterglow? An active galactic nucleus flare? The scientific community needs rapid, accurate classification to know which events to follow up with limited telescope resources. No human team could review 10 million alerts a night; the entire system depends on automated deep learning classifiers running in near-real-time.
The Fink and ANTARES broker systems, developed to process ZTF's alert stream, use random forests, recurrent neural networks, and ensemble classifiers to sort transients into categories within seconds of their detection. They then prioritize the most scientifically valuable events — rare supernova types, tidal disruption events, fast radio burst host galaxies — and automatically send follow-up requests to robotic telescopes worldwide. The result is a fully automated discovery pipeline capable of identifying and characterizing novel cosmic phenomena within minutes of their first appearance.
FAQ
How do computers distinguish stars from galaxies? Deep learning models analyze the shape (morphology), colors across multiple filter bands, and brightness profiles of objects in survey images. Stars are unresolved point sources; galaxies have extended profiles. Neural networks trained on labeled examples achieve greater than 99 percent accuracy on this classification task.
What are photometric redshifts? Photometric redshifts are galaxy distance estimates inferred from multi-band color measurements rather than spectroscopy. Machine learning models trained on spectroscopically confirmed galaxies learn the relationship between colors and true distances, enabling distance estimates for billions of objects that will never receive spectroscopic follow-up.
Why are quasars hard to classify? Quasars appear as unresolved point sources in images, making them morphologically indistinguishable from stars. Their unusual colors are distinctive but can be mimicked by unusual types of stars. AI classifiers combining color, morphology, variability, and astrometric information from multiple surveys have dramatically improved quasar selection completeness and purity.
What is the Vera Rubin Observatory's classification challenge? The Rubin Observatory will generate approximately 10 million transient alerts per night — changes in brightness or position detected by comparing nightly images to archived references. Every alert must be classified (supernova, variable star, asteroid, etc.) in near-real-time so astronomers can prioritize follow-up. Only automated AI classifiers can handle this volume.
What is the Dark Energy Survey? DES was a wide-field sky survey that imaged 5,000 square degrees of the southern sky using the Blanco Telescope in Chile, from 2013 to 2019. Its cosmological results — measuring dark energy properties from galaxy shapes and clustering — relied heavily on machine learning for galaxy classification, photometric redshifts, and image processing.
Read next:
Follow new articles
Add SciHub101 to your feed reader to see new science and technology stories.
About the Author
SciHub101 is an independent science and technology publication founded and edited by Buğra Sözeri, a software engineer and app developer based in Türkiye. AI tools assist with drafting and research. Source documentation in the existing archive is uneven, and articles are being reviewed and corrected. The Editorial Team byline identifies editorial responsibility; it does not certify specialist or independent human review. Where we compare products, anything built by our own team is labelled as such — see the editorial guidelines and About page for how corrections and disclosures work.
Related Articles

How the Big Bang Actually Happened: What Science Really Says
The Big Bang wasn't an explosion in space — it was an expansion of space itself. And the evidence for it is overwhelming.

The Voyager Probes: Humanity's Messengers in Interstellar Space
Launched in 1977, Voyager 1 and 2 are now in interstellar space — and still phoning home after nearly five decades.

Neural Networks and Space Telescope Image Analysis: Seeing the Cosmos More Clearly
Neural networks now sort galaxies, rank gravitational lens candidates, and flag changing objects in Hubble, Webb, and survey data. Here is what they do well, and where astronomers still check their work.

Why Do Stars Twinkle? The Science of Atmospheric Seeing
Stars twinkle because Earth's turbulent atmosphere bends starlight in constantly shifting ways. Because stars are infinitely distant, they act as point sources, so even tiny bends in light rays cause dramatic brightness and color flickers. Planets, being much closer, show a small disk that averages out the jitter. Twinkling is worst near the horizon and is why the best observatories sit on mountaintops or in orbit.

Types of Stars — Stellar Classification Explained
From hot blue O-type giants to cool red dwarfs: the OBAFGKM system, the H-R diagram, and the life cycles of stars. Learn the science, key examples, and...

How Galaxies Form and Evolve: From the First Stars to Today
Galaxies are not eternal — they are born, grow through mergers, and eventually die. Here's how the universe built these island universes.