concept ACGAN in category deep learning

This is an excerpt from Manning's book Deep Learning with JavaScript: Neural networks in TensorFlow.js.
In this section, we will dive into a relatively simple type of GAN. Specifically, we will train an auxiliary classifier GAN (ACGAN)[20] on the familiar MNIST hand-written digit dataset. This will give us a model capable of generating digit images that look just like the real MNIST digits. At the same time, we will be able to control what digit class (0 through 9) each generated image belongs to, thanks to the “auxiliary classifier” part of ACGAN. In order to understand how ACGAN works, let’s do it one step at a time. First, we will explain how the base “GAN” part of ACGAN works. Then, we will describe the additional mechanisms by which ACGAN makes the class identity controllable.
Figure 10.13 is an expanded version of figure 10.10. It shows the training of ACGAN’s discriminator part. Compared to before, this training step not only improves the discriminator’s ability to tell real and generated (fake) images apart but also hones its ability to determine which digit class a given image (including real and generated) belongs to. To make it easier to compare with the simpler diagram from before, we grayed out the parts already seen in figure 10.10 and highlighted the new parts. First, note that the generator now has an additional input (Digit Class), which makes it possible to specify what digits the generator should generate. In addition, the discriminator outputs not only a realness prediction but also a digit-class prediction. As a result, both output heads of the discriminator need to be trained. The training of the realness-predicting part remains the same as before (figure 10.10); the training of the class-predicting part relies on the fact that we know what digit classes the generated and real images belong to. The two heads of the model are compiled with different loss functions, reflecting the different nature of the two predictions. For the realness prediction, we use the binary cross-entropy loss, but for the digit-class prediction, we use the sparse categorical cross-entropy loss. You can see this in the following line from mnist-acgan/gan.js:
discriminator.compile({ optimizer: tf.train.adam(args.learningRate, args.adamBeta1), loss: ['binaryCrossentropy', 'sparseCategoricalCrossentropy'] });Figure 10.13. A schematic diagram illustrating the algorithm by which the discriminator part of ACGAN is trained. This diagram adds to the one in figure 10.10 by showing the parts that have to do with the digit class. The remaining parts of the diagram, which have already appeared in figure 10.10, are grayed out.
![]()