A cutting-edge unsupervised method for noise removal, dimensionality reduction, anomaly detection, and more

All of the tutorials about TensorFlow and neural networks I even have shared until now have been about supervised learning. This one will likely be in regards to the Autoenocder which is an unsupervised learning technique. If I need to precise it simply, autoencoders reduce the noises from the info by compressing the input data, and encoding and reconstructing the info. That way autoencoders can reduce the dimensionality or the noise of the info and concentrate on the true point of interest of the input data.
As you may see from the introduction to the autoencoders here there’s a couple of process required.
- First, a model to compress the input data which is the encoder model.
- Then one other model to reconstruct the compressed data that must be as close because the input data which is a decoder model.
On this process, it will possibly remove the noise, reduce the dimensionality, and clear up the input data.
On this tutorial, I’ll explain intimately how an autoencoder works with a working example.
For this instance, I selected to make use of a public dataset (Apache License 2.0) named deep_weeds.
import tensorflow as tf
import tensorflow_datasets as tfds
ds = tfds.load('deep_weeds', split='train', shuffle_files=True)
Data Preparation
We want to organize a dataset for this unsupervised anomaly detection example. Just one class will likely be taken as our important class that will likely be regarded as the valid class. And I’ll put just a few data from one other class as an anomaly. Then we are going to develop the model to see if we are able to find that few anomaly data.
I selected class 5 because the valid class and sophistication 1 because the anomaly. Within the code block below, I’m taking all the info of classes 5 and 1 first and creating lists of the photographs and their corresponding labels.
import numpy as np
images_main = []
images_anomaly = []
labels_main= []
labels_anomaly = []
ds = ds.prefetch(tf.data.AUTOTUNE)
for instance in ds…