February 2018
Intermediate to advanced
262 pages
6h 59m
English
Let's pass some real images as ground truth to train discriminator.
First, we will take a look at the code for doing the same and then explore the important features:
output = netD(inputv)errD_real = criterion(output, labelv)errD_real.backward()
In the previous code, we are calculating the loss and the gradients required for the discriminator image. The inputv and labelv represent the input image from the CIFAR10 dataset and labels, which is one for real images. It is pretty straightforward, as it is similar to what we do for other image classifier networks.