Skip to content

This is the complete code for the blog post "Autoencoders 101: Learning hidden patterns in your data". It's a basic setup for a denoising autoencoder using the STL-10 dataset.

License

Notifications You must be signed in to change notification settings

stackbuilders/denoising-autoencoder-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Denoising Autoencoder for STL-10 Images

This project is the implementation of a convolutional denoising autoencoder using TensorFlow and Keras to clean noisy images from the STL-10 dataset for the blog post "Autoencoders 101: Learning hidden patterns in your data". The autoencoder learns to reconstruct clean images from their noisy counterparts.

denoised_stl10_images

Features

  • Loads and preprocesses the STL-10 dataset (unlabeled split).
  • Adds Gaussian noise to images for training.
  • Builds a deep convolutional autoencoder with skip connections.
  • Trains the model to denoise images.
  • Visualizes original, noisy, and denoised images.
  • Saves model weights and results for reuse.

Project Structure

denoise_autoencoder.py        # Main script for training and visualization
requirements.txt              # Python dependencies
data/                         # Created at runtime; stores processed dataset
results/                      # Created at runtime; stores output images
weights/                      # Created at runtime; stores trained model weights
  • The data/, results/, and weights/ directories are automatically created when you run the main script. You do not need to create them manually.
  • data/ contains the processed STL-10 dataset with noisy and clean images.
  • results/ contains visualizations of original, noisy, and denoised images.
  • weights/ contains the trained autoencoder model weights.

Installation

This project uses Poetry for dependency management and asdf for tool versioning.

  1. Clone the repository.
  2. (Optional, recommended) Install asdf and run:
    asdf install
    This will automatically install the correct Python version as specified in .tool-versions.
  3. Install dependencies with Poetry:
    poetry install

Usage

Run the main script to train the autoencoder and visualize results:

poetry run python denoise_autoencoder.py
  • The script will download STL-10 data, add noise, train the model, and save results.
  • A small sample of denoised images will be saved to results/denoised_stl10_images.png.

Requirements

  • Python 3.12.2+
  • Poetry >2.1.1

See pyproject.toml for a full package breakdown.

License

This project is for educational purposes.

About

This is the complete code for the blog post "Autoencoders 101: Learning hidden patterns in your data". It's a basic setup for a denoising autoencoder using the STL-10 dataset.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages