Skip to content

layamaryjoy/autoencoder-mnist-implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 MNIST Autoencoder using Deep Learning

Python TensorFlow Autoencoder Platform

A deep learning project that focuses on building and evaluating an Autoencoder Neural Network for image reconstruction using the MNIST handwritten digits dataset.


πŸš€ Run Notebook in Google Colab

Click below to open the notebook directly in Google Colab:

Open In Colab


πŸ“˜ Project Overview

This project demonstrates how an Autoencoder model can learn compressed representations of image data and reconstruct the original images.

The workflow includes:

  • Loading the MNIST dataset

  • Data preprocessing and normalization

  • Designing encoder–decoder architecture

  • Training and validating the model

  • Visualizing loss curves

  • Comparing original and reconstructed images

The primary goal is to build a model capable of efficient data compression and accurate image reconstruction.


🎯 Objective

  • Understand the working of Autoencoders (Encoder + Decoder)

  • Compress 28Γ—28 images into a lower-dimensional latent space

  • Reconstruct images from compressed representations

  • Evaluate reconstruction performance

  • Visualize and interpret output quality


πŸ“‚ Dataset Information

The dataset used is the MNIST Handwritten Digits Dataset.

Dataset Details

Feature Description
Images 28Γ—28 grayscale images
Classes Digits (0–9)
Training Samples 60,000
Test Samples 10,000

🧹 Data Preprocessing

The following preprocessing steps were applied:

βœ” Normalization

  • Pixel values scaled to the range 0–1

βœ” Reshaping

  • Images reshaped into vectors (784) or maintained as 28Γ—28 format

βœ” Train-Test Split

  • Used predefined MNIST training and test datasets

🧠 Autoencoder Architecture

A fully connected Autoencoder was implemented using TensorFlow / Keras.

Architecture Components

βœ” Encoder

  • Dense layers to compress input data

  • Generates a compact latent representation

βœ” Decoder

  • Dense layers to reconstruct the image

  • Output layer uses sigmoid activation

βœ” Loss Function

  • Binary Crossentropy / Mean Squared Error

βš™ Model Training

The model was trained using the training dataset and evaluated on the test dataset.

Training Details

  • Optimizer: Adam

  • Epochs: (as defined in notebook)

  • Batch Size: (as defined in notebook)

Monitoring

  • Training Loss

  • Validation Loss


πŸ“Š Model Evaluation

βœ” Model Summary

  • Displays encoder and decoder architecture

βœ” Loss Curve

  • Visual comparison of training vs validation loss

  • Helps identify learning trends and overfitting


πŸ–Ό Reconstruction Results

Model performance is evaluated by comparing:

  • Original images

  • Reconstructed images

Observations

  • Reconstructed images closely resemble the original digits

  • Slight blurring occurs due to compression

  • Key visual features are preserved effectively


πŸ“ Results Explanation

The autoencoder successfully learned meaningful compressed representations of the MNIST dataset. Both training and validation loss decreased steadily, indicating stable learning.

Although reconstructed images may lose some fine details, the overall structure and digit shapes are preserved. This demonstrates the effectiveness of autoencoders in dimensionality reduction and feature learning.


πŸ›  Tech Stack

Tool Purpose
Python Programming language
TensorFlow / Keras Deep learning framework
NumPy Numerical computation
Matplotlib Visualization
Scikit-learn Preprocessing
Google Colab Development environment

πŸ“ Repository Structure

autoencoder-mnist/

β”‚

β”œβ”€β”€ DL_Assignment_3_AutoEncoders.ipynb

β”œβ”€β”€ README.md

└── DL Assignment 3 - Auto Encoders.pdf

πŸš€ How to Run the Project

1️⃣ Open the Notebook

Click the Google Colab button above


2️⃣ Install Required Libraries

pip install tensorflow numpy matplotlib scikit-learn

3️⃣ Run the Notebook

  • Execute all cells step-by-step

  • Train the model

  • Visualize reconstruction results


πŸ“Œ Academic Submission

This project was developed as part of a Deep Learning assignment, demonstrating the implementation of an Autoencoder Neural Network for image reconstruction. It covers data preprocessing, model design, training, evaluation, and visualization.


⚠️ Limitations

  • Uses a basic fully connected architecture instead of CNN-based models

  • Reconstruction may appear slightly blurred due to compression

  • Limited to grayscale MNIST dataset

  • Not suitable for complex or high-resolution images

  • Minimal hyperparameter tuning

  • Limited generalization to other datasets


πŸ“Œ Future Enhancements

  • Implement Convolutional Autoencoders (CNN-based)

  • Explore Variational Autoencoders (VAE)

  • Apply to complex datasets like CIFAR-10

  • Perform advanced hyperparameter tuning

  • Build a Denoising Autoencoder

  • Deploy using Streamlit / Flask


πŸ‘€ Author

Name: Laya Mary Joy

Organization: Entri Elevate

Date: March 28, 2026


⭐ Acknowledgment

I would like to thank Entri Elevate for their valuable guidance and support throughout this project.


Releases

No releases published

Packages

 
 
 

Contributors