def normalize_images(images):
# initial zero ndarray
normalized_images = np.zeros_like(images.astype(float))
# The first images index is number of images where the other indices indicates
# hieight, width and depth of the image
num_images = images.shape[0]
# Computing the minimum and maximum value of the input image to do the normalization based on them
maximum_value, minimum_value = images.max(), images.min()
# Normalize all the pixel values of the images to be from 0 to 1
for img in range(num_images):
normalized_images[img, ...] = (images[img, ...] - float(minimum_value)) / float(maximum_value - minimum_value)
return normalized_images
# encoding the input images. Each image will be represented by a vector of zeros except for the class index of the image
# that this vector represents. The length of this vector depends on number of classes that we have
# the dataset which is 10 in CIFAR-10