Errata

Generative Deep Learning

Errata for Generative Deep Learning

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Chapter 3
1st paragraph

The first paragraph of chapter 4 reads:
"Ian Goodfellow of Google Brain presented a tutorial entitled 'Generative Adversarial Networks' to the delegates of the Neural Information Processing Systems (NIPS) conference in Barcelona"

On November 16, 2018, the Neural Information Processing Systems Foundation Board of Trustees changed the acronym of the Neural Information Processing Systems conference from NIPS to NeurIPS.

Source:
https://nips.cc/Conferences/2018/News

Alex Galarce  Jan 01, 2020 
Other Digital Version Chapter 1
Figure 1-6

My version is for Kindle.

Figure 1-6 renders a map of the world. There are two points labelled B, one in red, coherent with the text, and a black B, which I believe is a mistake.

Luis Torrao  May 14, 2023 
Printed Page Chapter 4
"04_03_wgangp_faces_train" on jupyter notebook

I ran the training part of the code, and the console gave me the following message:

ValueError: in user code:

File "/home/user/.local/lib/python3.9/site-packages/keras/src/engine/training.py", line 1338, in train_function *
return step_function(self, iterator)
File "/home/user/.local/lib/python3.9/site-packages/keras/src/engine/training.py", line 1322, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/home/user/.local/lib/python3.9/site-packages/keras/src/engine/training.py", line 1303, in run_step **
outputs = model.train_step(data)
File "/home/user/.local/lib/python3.9/site-packages/keras/src/engine/training.py", line 1080, in train_step
y_pred = self(x, training=True)
File "/home/user/.local/lib/python3.9/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/user/.local/lib/python3.9/site-packages/keras/src/engine/input_spec.py", line 219, in assert_input_compatibility
raise ValueError(

ValueError: Exception encountered when calling layer 'model_2' (type Functional).

Layer "model" expects 1 input(s), but it received 2 input tensors. Inputs received: [<tf.Tensor 'IteratorGetNext:0' shape=(64, 64, 64, 3) dtype=float32>, <tf.Tensor 'model_2/model_1/activation/Tanh:0' shape=(64, 64, 64, 3) dtype=float32>]

Call arguments received by layer 'model_2' (type Functional):
• inputs=('tf.Tensor(shape=(64, 64, 64, 3), dtype=float32)', 'tf.Tensor(shape=(64, 100), dtype=float32)')
• training=True
• mask=None

The layer "model" only expect 1 input instead of 2.

Isaac Chin  Jul 13, 2023 
Printed Page Page 41 (2nd Edition)
Figure 2-10

The second convolution calculation result should be 0.3 instead of the -0.1 result at the right of the frame.

Roland Acra  Mar 16, 2024 
Printed Page Page 11 (2nd Edition)
Figure 1-6

The map erroneously shows two points labeled as B. In order to be consistent with the text:
- Point B located in Alaska should remain in the picture
- Duplicate Point B located in the middle of Asia should be removed

Roland Acra  Mar 16, 2024 
3
'LAMBDA LAYER' box

Chapter 3:
A Lambda layer *simple* wraps any function ...

Can't provide page number as I read from Safari Books Online.

Anonymous  Oct 26, 2019 
Printed Page 14
Table 1-1

(1st Edition, 1st Release)

Combination 1 of 16 page appears once in table 1-1, not twice.

I suggest to change ShortHairShortFlat to LongHairSTraight in topType of which face_id is 0.

Haesun Park  Oct 01, 2019 
Printed Page 18
5th paragraph

(1st Edition, 1st Release)

"where \hat{\theta_{kl}} is the number of times...."

should be

"where n_{kl} is the number of times...."

Haesun Park  Oct 01, 2019 
Printed Page 19
2nd paragraph

(1st Edition, 1st Release)

"...being sampled than, say, (LongHairStraight, Red, Round, ShirtScoopNeck, White),..."

should be

"...being sampled than, say, (LongHairStraight, Red, Round, ShirtScoopNeck, Blue01),..."

Haesun Park  Oct 01, 2019 
Printed Page 20
line 3

"Now let's see what happens when this assumption breaks down"

Missing period at the end of sentence.

Yudai Yamano  Jan 18, 2020 
Printed Page 27
8th paragraph: git pull

You need to cd into the GDL_code directory before entering the git pull command.

Anonymous  Sep 02, 2019 
Printed Page 27-28
10th paragraph

At no point does the author specify the relationship between the location of the reader's Conda or virtualenv created directory and the reader's git-cloned directory tree with root at GDL_code. Until this is established the pip install -r requirements command will not work. Where exactly should the reader's virtual environment be? Inside the cloned GDL_code directory or elsewhere? The author assumes the reader does not understand how to create a virtual environment and details this, but assumes the reader can puzzle out the rest by themselves... l am sure that experienced readers will eventually be able to process this, but they shouldn't have to.
There is also some ambiguity about whether the lines to be added to the .bash_profile are needed only for virtualenv or also for conda users. (From the position in the text I would assume this is only for virtualenv, but this is not clear.)

Anonymous  Sep 02, 2019 
Printed Page 35
code listing

On my Mac OS installation, cifar10.load_data() gives an error. I fixed it by downloading the file manually from www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz, putting it in ~/.keras/datasets, and rename it to cifar-10-batches-py.tar.gz This process is described here: stackoverflow.com/questions/36805640/this-error-while-downloading-datasets-valueerror-i-o-operation-on-closed-file, where a similar problem was answered by Matias Valdenegro.

Michael Theodore  Aug 15, 2019 
Printed Page 36
1st paragraph

It is claimed that neural networks work best when the input is in the range -1 to 1. However, the provided source code keeps the input in the range 0 to 1. It is confusing why the provided source code does not result in the inputs to be in the range that claims to work best with neural networks.

Alexander Stante  Oct 26, 2019 
Printed Page 37
Example 2-1

The source code doesn't match the description and the functional implementation which is shown later. The flatten layer should be the first layer in the Sequential model and not the Dense. The shown source code creates first a Dense layer with an output of 32, 32, 200 and then flatten it, which creates an enormous amount of trainable parameters. Correct source code would be:

model = Sequential([
Flatten(input_shape=(32, 32, 3)),
Dense(200, activation='relu'),
Dense(150, activation='relu'),
Dense(10, activation='softmax'),
])

Alexander Stante  Oct 27, 2019 
Printed Page 37
Example 2.1 listing at the bottom

In the code section of Example 2.1 building the network using Sequential model, Flatten() should come first before Dense(200)?
This would match with Example 2.2 that uses Functional API.

Khoi Ngo  Jan 01, 2020 
Printed Page 38
end of code example 2-2

At the very end of the code listing, there's an ">" which should not be there.

Juan Manuel Parrilla Gutierrez  Dec 10, 2019 
Printed Page 42
2nd paragraph

(1st Edition, 1st Release)

In last words of the 2nd paragraph, "...over all n output units"

should be

""...over all n observations"

Haesun Park  Oct 01, 2019 
Printed Page 42
2nd eq.

(1st Edition, 1st Release)

In categorical corss-entropy eq.,

-\sum^n_{i=1} y_i log(p_i)

should be

-\sum^n_{i=1} \sum^C_{k=1} y^k_i log(p^k_i)

Haesun Park  Oct 01, 2019 
Printed Page 44
3rd paragraph

(1st Edition, 1st Release)

"...approximately 160 microseconds per observation"

should be

"...approximately 160 microseconds per step"

Haesun Park  Oct 01, 2019 
Printed Page 44
3rd paragraph

(1st Edition, 1st Release)

"...a rate of approximately 160 microseconds"

should be

"...a rate of approximately 8 seconds"

It seems that the part "8s" in the output shown in Figure 2-7 was neglected. To be more precise, the 7th epoch took more than 10 seconds, and it took about 8 seconds 362 microseconds on average.

Nobu C. Shirai  Aug 01, 2020 
Printed Page 55
2nd paragraph

(1st Edition, 1st Release)

I think two "formulae" is a typo of "formula".

Haesun Park  Oct 01, 2019 
Printed Page 62
line 3

the point [-3.5, -0.5]

seems to be

point [-3.5, 0.5]

in the Figure3-1

Yudai Yamano  Feb 02, 2020 
Printed Page 72
Example 3-6

The example gives y = x_train as an argument to the model's fit function instead of y = y_test.

Alexander Stante  Nov 03, 2019 
Printed Page 72
example 3.5

What is "K"? I don't think it has ever been introduced before.

Juan Manuel Parrilla Gutierrez  Dec 19, 2019 
Printed Page 72
Example 3-5

The text describes the choice of the loss function as the Root Mean Square (RMSE) error. However, the formula implemented in example 3-5 (and also in the models/AE.py code) is an implementation of the Mean Square Error (i.e., it is missing a square root)

This will train and do something, but it is a different function, not the one stated.

Joshua Schrier  Aug 29, 2020 
Printed Page 84
1st eq.

(1st Edition, 1st Release)

In KL loss eq.,

= 1/2 \sum ...

should be

= - 1/2 \sum ...

Haesun Park  Oct 01, 2019 
Printed Page 84
Second equation, denoting KL divergence in mathematical notation

Unbalanced parentheses on the left-hand side of the second equation: inside the brackets, it's written as

N(μ, σ || N(0,1)

but it must be:

N(μ, σ) || N(0,1)

Emre Sevinç  Nov 25, 2019 
Printed Page 86
last paragraph

It should be clarified that a separate download of the feature file list_attr_celeba.csv is required. Furthermore, the image id in the feature file has to be changed from File_name to image_id otherwise the code in 03_06_vae_faces_analysis throws a KeyError.

Bernd Schossmann  Nov 25, 2019 
Printed Page 90
running 03_05_faces_train.ipynb

Throws:
AttributeError: 'ProgbarLogger' object has no attribute 'log_values'
in
vae.train_with_generator

Also on p86 no indication is given as to which files files from
http:/ bit.ly/2WSiOXt need to be put into the the data folder and where they ought to be put. I think I have worked it out but I can't be sure until I can get the NB to run.

Thomas Morgan  Feb 22, 2020 
Printed Page 105
1st and 2nd paragraph

(1st Edition, 1st Release)

In 1st paragraph, "Upsampling2D" should be "UpSampling2D".

In 2nd paragraph, "Upsampling" should be "UpSampling".

Haesun Park  Oct 01, 2019 
PDF Page 106
5th paramraph

> We pass this through four Conv2D layers, the first two preceded by Upsampling2D layers

I think that Each Conv2D is preceded by UpSampling2D layer in the code.

MATSUDA, Kouichi  Jan 25, 2020 
Printed Page 108
Last code snipper

Is this code ever going to be part of the Github repo?

Juan Manuel Parrilla Gutierrez  Dec 19, 2019 
Printed Page 118
just below an inequality

I think "Here, x_i-x_j is the" is "Here, |x_i-x_j| is the". The absolute value symbol seems to be necessary.

Yasuhiro Kajima  Nov 27, 2020 
Printed Page 125
Point 7

It says "the model has three outputs: 1..., -1,... and dummy 0 vector.

But the code in example 4.10 shows as the third option validity interpolated, which is not a 0 vector.

Juan Manuel Parrilla  Apr 08, 2020 
Printed Page 137
4th and 5th paragraph

(1st Edition, 1st Release)

Two G_AB should be g_AB.

Two G_BA should be g_BA.

Haesun Park  Oct 01, 2019 
Printed Page 139
Second paragraph

The second sentence reads "A VAE is linear; data flows through the network from input to the output, one layer after another." The author intends to communicate that the function applied by each layer is serial, depending only on the outputs of the layer before (no skip connections). The language, however, is confusing: VAEs are not linear functions.

Peter Barrett Bryan  Sep 22, 2019 
Printed Page 142
Last paragraph

(1st Edition, 1st Release)

8 x 8 single-channel

should be

16 x 16 single-channel

Haesun Park  Oct 01, 2019 
Printed Page 146
In the Example 5-6

2**4 should be 2**3.

Yasuhiro Kajima  Feb 04, 2021 
Printed Page 147
Last paragraph

(1st Edition, 1st Release)

In last sentence, "...image from its own input domain,..."

should be

"...image from its own target domain,..."

Haesun Park  Oct 01, 2019 
Printed Page 153
before last paragraph

(1st Edition, 1st Release)

"Total variance loss" should be "Total variation loss".

Haesun Park  Oct 01, 2019 
PDF Page 156
4th paragraph

> The include_top = False parameter
specifies that we do not need to load the weights for the final dense layers of the
networks that result in the classification of the image.

"include_top" specifies whether to include the 3 fully-connected layers at the top of the network, not to load the weights.

See also https://keras.io/applications/#vgg19

MATSUDA, Kouichi  Jan 13, 2020 
PDF Page 158
Therefore ~~~

Hello. I am studying GAN with this book from South Korea.
Thanks you for your book, Generative Deep Learning. :)

By the way, I can't understand about this part (Chapter 5, page 158 in PDF).

You said 'Style loss' that "We would like the combined image to have the same general style as the style image." in page 153.

However, in page 158, you said that
"Therefore to calculate the style loss, all we need to do is calculate the Gram matrix(GM) for a set of layers throughout the network for both the base image and the combined image and compare their similarity using sum of squared errors."

I want to say this part: "~~ both the base image and the combined image ~~"

It means that "To calculate Style loss, we need to use base the image and the generated image."
but, "Example 5-10. The style loss function", in page 159, function style_loss used parameters style(=style image) and combination(=the generated image).
So, I can't understand what is correct.

If you understand what I saying, please reply this e-mail: sta_ll@naver.com

Thank you for read this words

Anonymous  Feb 11, 2020 
Printed Page 186
Figure 6-13

(1st Edition, 1st Release)

In equations under the picture,

r_t = \sigma (W_r \cdot [h_{t-1}, x_t])
should be
r_t = \sigma (W_r \cdot [h_{t-1}, x_t] + b_r)

\tilde{h_t} = tanh (W \cdot [r_t * h_{t-1}, x_t])
should be
\tilde{h_t} = tanh (W \cdot [r_t * h_{t-1}, x_t] + b)

z_t = \sigma (W_z \cdot [h_{t-1}, x_t])
should be
z_t = \sigma (W_z \cdot [h_{t-1}, x_t] + b_z)

h_t = (1-z_t) * h_{t-1} + z_t * \tilde{h_t}
should be
h_t = (1-z_t) * \tilde{h_t} + z_t * h_{t-1}


Haesun Park  Oct 01, 2019 
Printed Page 191
last paragraph

"This raw data is processed and tokenized so that is it ..."

should be

"This raw data is processed and tokenized so that it is ..."

Yudai Yamano  Sep 16, 2020 
Printed Page 211
No 5 and No 7 bullets

(1st Edition, 1st Release)

Five seq_length should be seq_len just like code of repository.

Haesun Park  Oct 01, 2019 
Printed Page 213
1st paragraph

(1st Edition, 1st Release)

07_03_lstm_compose_analysis.ipynb

should be

07_03_lstm_compose_predict.ipynb

Haesun Park  Oct 01, 2019 
Printed Page 249, 257
In the middle

(1st Edition, 1st Release)

Above picture in 249 page, "./vae/vae.json" should be "./vae/weights.h5".

Above picture in 257 page, "./vae/rnn.json" should be "./rnn/weights.h5".

Haesun Park  Oct 01, 2019 
Printed Page 251
Figure 8-7

(1st Edition, 1st Release)

Two variable names is used interchangable. For example, full_model and vae_full.
encoder, decoder, encoder_mu_log_var has same situation.

Please use only a name not to confuse readers.

Haesun Park  Oct 01, 2019 
Printed Page 267
Last paragraph

(1st Edition, 1st Release)

Standard deviation is intialized at 0.1 in the repo., not 0.5.

Haesun Park  Oct 01, 2019 
Printed Page 281
Whole page

(1st Edition, 1st Release)

In p281 and p282, n^Q and n_Q are used interchangable. n^{KV} and n_{KV} are used in the same way.

I suggest to change n^Q, n^{KV} in p281 to n_Q, n_{KV} respectively

Haesun Park  Oct 02, 2019 
Printed Page 282
3rd paragraph

(1st Edition, 1st Release)

"key-value input" should be "key input".

Haesun Park  Oct 02, 2019 
Printed Page 283
Last paragraph

(1st Edition, 1st Release)

In German, definite articles for objective(the street) is (den, die, das), not (der, die, das)

Haesun Park  Oct 01, 2019 
Printed Page 286
1st paragraph

(1st Edition, 1st Release)

Based on the official repo., small version has 124M params. and medium version has 355M params.

Haesun Park  Oct 01, 2019 
Printed Page 291
Last paragraph

(1st Edition, 1st Release)

"resampleing z that have magnitude greater than a certain threshold"

should be

"resampleing z that have magnitude smaller than a certain threshold"

Haesun Park  Oct 01, 2019 
Printed Page 293
In figure 9-13

(1st Edition, 1st Release)

Three "Const 3x3" should be "Conv 3x3".

Haesun Park  Oct 02, 2019