Minifycode 2020-01-15 Viewed 1.4K times Artificial Intelligence (AI)

Removing unwanted noise in order to restore the original image.

We need the following libraries for Denoising of image:

 

from keras.datasets import mnist

import numpy as np

import matplotlib.pyplot as plt

 

from keras.layers import Dense, Conv2D, MaxPooling2D, UpSampling2D

from keras.models import Sequential

from keras import backend as K

 

First we have to load the data (here we load data from MNIST Database)

(x_train, _), (x_test, _) = mnist.load_data()

 

x_train = x_train.astype('float32') / 255.

x_test = x_test.astype('float32') / 255.

 

x_train = np.reshape(x_train, (len(x_train), 28, 28, 1)) 

x_test = np.reshape(x_test, (len(x_test), 28, 28, 1))

 

 

#We need the following libraries for Denoising of image: 

from keras.datasets import mnist
import numpy as np
import matplotlib.pyplot as plt

from keras.layers import Dense, Conv2D, MaxPooling2D, UpSampling2D
from keras.models import Sequential
from keras import backend as K

#First we have to load the data (here we load data from MNIST Database)

(x_train, _), (x_test, _) = mnist.load_data()

x_train = x_train.astype('float32') / 255.
x_test = x_test.astype('float32') / 255.

x_train = np.reshape(x_train, (len(x_train), 28, 28, 1)) 
x_test = np.reshape(x_test, (len(x_test), 28, 28, 1))



Removing unwanted noise in order to restore the original image.
minify code