Clean images

We will also read the same 25 images without the black line and save them in trainy, as shown in the following code:

# Read image files without black line
setwd("~/Desktop/people")
temp = list.files(pattern="*.jpg")
mypic <- list()
for (i in 1:length(temp)) {mypic[[i]] <- readImage(temp[i])}
for (i in 1:length(temp)) {mypic[[i]] <- resize(mypic[[i]], 128, 128)}
for (i in 1:length(temp)) {dim(mypic[[i]]) <- c(128, 128,3)}
trainy <- combine(mypic)
trainy <- aperm(trainy, c(4,1,2,3))
par(mfrow = c(4,4), mar = rep(0, 4))
for (i in 1:16) plot(as.raster(trainy[i,,,]))
par(mfrow = c(1,1))

Here, after resizing and changing dimensions, we are combining the images, just like we did previously. We also need to make some adjustments to the dimensions to obtain the required format. Next, we will plot all 25 clean images, as follows:

At the time of training the autoencoder network, we will use these clean images as output. Next, we will specify the encoder model architecture.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset