16.03.2021 Views

Advanced Deep Learning with Keras

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For simplicity, in this figure, we'll only show four layers. Notice that the input

to layer l is the concatenation of all previous feature maps. If we designate the

BN-ReLU-Conv2D as the operation H(x), then the output of layer l is:

( , , , , )

xl

= H x x x x

0 1 2

… (Equation 2.4.1)

l 1

Chapter 2

Conv2D uses a kernel of size 3. The number of feature maps generated per layer

is called the growth rate, k. Normally, k = 12, but k = 24 is also used in the paper,

Densely Connected Convolutional Networks, Huang, and others, 2017 [5]. Therefore,

if the number of feature maps x

0

is k , then the total number of feature maps at the

0

end of the 4-layer Dense block in Figure 2.4.1 will be 4× k + k .

0

DenseNet also recommends that the Dense block is preceded by BN-ReLU-Conv2D,

along with the number of feature maps twice the growth rate, k0 = 2× k . Therefore,

at the end of the Dense block, the total number of feature maps will be 72. We'll also

use the same kernel size, which is 3. At the output layer, DenseNet suggests that we

perform an average pooling before the Dense() and softmax classifier. If the data

augmentation is not used, a dropout layer must follow the Dense block Conv2D:

Figure 2.4.2: A layer in a Dense block of DenseNet, with and without the bottleneck layer

BN-ReLU-Conv2D(1). We'll include the kernel size as an argument of Conv2D for clarity.

As the network gets deeper, two new problems will occur. Firstly, since every layer

contributes k feature maps, the number of inputs at layer l is ( l − 1) × k + k0

. Therefore,

the feature maps can grow rapidly within deep layers, resulting in the computation

becoming slow. For example, for a 101-layer network this will be 1200 + 24 = 1224

for k = 12.

Secondly, similar to ResNet, as the network gets deeper the feature maps size will be

reduced to increase the coverage of the kernel. If DenseNet uses concatenation in the

merge operation, it must reconcile the differences in size.

[ 63 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!