torch.nn.Dropout2dについて。畳み込み層に適用するDropout

概要

畳み込み層の後によく実装されるtorch.nn.Dropout2dについて、普通のDropoutとの違いを確認しました。

ドキュメントを確認

torch.nn.Dropout2dによると

  • nn.Dropout2dは入力の形が(N, C, H, W)に限られる。

また、

As described in the paper Efficient Object Localization Using Convolutional Networks, if adjacent pixels within feature maps are strongly correlated (as is normally the case in early convolution layers) then i.i.d. dropout will not regularize the activations and will otherwise just result in an effective learning rate decrease.

In this case, nn.Dropout2d() will help promote independence between feature maps and should be used instead.

  • CNNの浅い層では隣接したピクセルが強い相関を持つことが多く、その際にdropoutがうまく機能しないため、dropout2dを適用する。

とのこと。

元となった論文を確認

Efficient Object Localization Using Convolutional Networksを見てみると、

  • 普通のDropoutだと、相関の強い隣り合うピクセルによって補完されてしまうため冗長性が高まらない。 f_2aからの勾配はゼロになるが、f_2aと強い相関を持つf_2bの勾配は残るためピクセル間の独立性が高まらないとのこと。 f:id:Rtakaha:20210704165555p:plain

  • featureマップレベルでDropoutを適用することで、モデルの冗長性を高めることができる。 f:id:Rtakaha:20210704165612p:plain

なるほどねーという感じですね。