Denoising images with autoencoders
Using images to reconstruct their input is great, but are there more useful ways to apply autoencoders? Of course there are! One of them is image denoising. As the name suggests, this is the act of restoring damaged images by replacing the corrupted pixels and regions with sensible values.
In this recipe, we'll purposely damage the images in Fashion-MNIST
, and then train an autoencoder to denoise them.
Getting ready
Fashion-MNIST
can easily be accessed using the convenience functions TensorFlow provides, so we don't need to manually download the dataset. On the other hand, because we'll be creating some visualizations using OpenCV
, we must install it, as follows:
$> pip install opencv-contrib-python
Let's get started!
How to do it…
Follow these steps to implement a convolutional autoencoder capable of restoring damaged images:
- Import the required packages:
import cv2 import numpy as np from...