<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muskan Aman</title>
    <description>The latest articles on DEV Community by Muskan Aman (@muskan_aman_).</description>
    <link>https://dev.to/muskan_aman_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3504514%2Fbd8487a2-0e5a-4ce2-8da3-6ab697d54788.jpeg</url>
      <title>DEV Community: Muskan Aman</title>
      <link>https://dev.to/muskan_aman_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muskan_aman_"/>
    <language>en</language>
    <item>
      <title>Classifying Galaxies with Deep From Stardust to Code: Building a Neural Network to Classify Galaxies</title>
      <dc:creator>Muskan Aman</dc:creator>
      <pubDate>Mon, 15 Sep 2025 17:57:51 +0000</pubDate>
      <link>https://dev.to/muskan_aman_/classifying-galaxies-with-deep-from-stardust-to-code-building-a-neural-network-to-classify-galaxies-3lio</link>
      <guid>https://dev.to/muskan_aman_/classifying-galaxies-with-deep-from-stardust-to-code-building-a-neural-network-to-classify-galaxies-3lio</guid>
      <description>&lt;p&gt;The universe is vast - home to billions of galaxies, each with its own unique shape and story. For over a century, astronomers have relied on human eyes to sort galaxies into categories like spiral (with elegant arms) and elliptical (smooth, featureless blobs). &lt;/p&gt;

&lt;p&gt;In this project, I set out to build a Convolutional Neural Network (CNN) that can classify galaxies as either spiral or elliptical. What started as a curious experiment soon evolved into a full-fledged pipeline: from data preprocessing, to model training, to deploying a real-time Streamlit web app that anyone can try.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br&gt;
At first glance, spirals and ellipticals might seem easy to tell apart - spirals flaunt their arms while ellipticals glow like round smudges. But astronomy datasets often contain noisy, faint, and low-resolution images where even experts can disagree.&lt;br&gt;
The question:&lt;/p&gt;

&lt;p&gt; 👾&lt;em&gt;Can a machine learning model learn to capture these subtle differences and classify galaxies automatically?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Dataset&lt;/strong&gt;&lt;br&gt;
I worked with a labeled dataset of galaxy images resized to 256×256 pixels in RGB. The dataset included:&lt;br&gt;
Spiral galaxies 🌀 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxz77rcqgklbss13d2zzs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxz77rcqgklbss13d2zzs.jpg" alt=" " width="254" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Elliptical galaxies 🔵&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjy59fpzf4bm0ztymd1q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjy59fpzf4bm0ztymd1q.jpg" alt=" " width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The data was split into training and test sets, ensuring that the model was tested on images it had never seen before.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To prepare the data:&lt;/strong&gt;&lt;br&gt;
Images were normalized (pixel values scaled between 0–1).&lt;br&gt;
Augmentation techniques (flips, rotations) were tested to make the model robust to variations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Neural Network&lt;/strong&gt;&lt;br&gt;
The backbone of this project was a Convolutional Neural Network (CNN).&lt;br&gt;
The architecture looked like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Convolution + ReLU layers: extract features like edges, curves, and textures.&lt;/li&gt;
&lt;li&gt;MaxPooling layers: reduce dimensionality while preserving key features.&lt;/li&gt;
&lt;li&gt;Dense layers: combine learned features to make a decision.&lt;/li&gt;
&lt;li&gt;Softmax output: predicts whether a galaxy is spiral or elliptical.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built with TensorFlow/Keras, the model was trained for 10 epochs with a batch size of 32.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Training &amp;amp; Results&lt;/strong&gt;&lt;br&gt;
At first, the model struggled - often predicting spiral for almost everything. With tweaks (validation split, balancing classes, and fine-tuning hyperparameters), performance improved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final results:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accuracy on test set: ~XX% (replace with your actual score once stable)&lt;/li&gt;
&lt;li&gt;Confusion matrix: showed the model could distinguish spirals from ellipticals, though some borderline cases still tripped it up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's a sneak peek at predictions:&lt;br&gt;
Galaxy 1 → Predicted: Spiral ✅&lt;br&gt;
Galaxy 2 → Predicted: Elliptical ✅&lt;br&gt;
Galaxy 3 → Predicted: Spiral ❌ (actually elliptical)&lt;/p&gt;

&lt;p&gt;It was fascinating to see where the model got it right - and where it revealed the same challenges human astronomers face.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Learnings&lt;/strong&gt;&lt;br&gt;
Balanced datasets matter - my model initially leaned toward "spiral" because of class imbalance.&lt;br&gt;
Validation is critical - without a proper split, the model seemed perfect during training but failed miserably on new data.&lt;br&gt;
Deployment completes the story - building the app made the project tangible, not just code hidden in notebooks.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
