第7章畳み込みニューラルネットワーク
7.5. Pooling7.5 プーリング
In many cases our ultimate task asks some global question about the image, e.g., does it contain a cat? Consequently, the units of our final layer should be sensitive to the entire input. By gradually aggregating information, yielding coarser and coarser maps, we accomplish this goal of ultimately learning a global representation, while keeping all of the advantages of convolutional layers at the intermediate layers of processing. The deeper we go in the network, the larger the receptive field (relative to the input) to which each hidden node is sensitive. Reducing spatial resolution accelerates this process, since the convolution kernels cover a larger effective area.
英語のヒント
多くの場合、最終的な課題は、画像についての何らかの大域的な問い、たとえば「猫が含まれているか」を問う。その結果、最後の層のユニットは入力全体に敏感であるべきである。情報を徐々に集約して、どんどん粗いマップを生み出していけば、処理の中間の層では畳み込み層の利点をすべて保ちながら、最終的に大域的な表現を学習するというこの目標を達成できる。ネットワークの深くに進むほど、各隠れノードが敏感に反応する受容野は(入力に比べて)大きくなる。空間的な解像度を下げると、畳み込みカーネルがより広い実質的な範囲を覆うので、この過程が速まる。
Moreover, when detecting lower-level features, such as edges (as discussed in Section 7.2), we often want our representations to be somewhat invariant to translation. For instance, if we take the image
X with a sharp delineation between black and white and shift the whole image by one pixel to the right, i.e., Z[i, j] = X[i, j + 1], then the output for the new image Z might be vastly different. The edge will have shifted by one pixel. In reality, objects hardly ever occur exactly at the same place. In fact, even with a tripod and a stationary object, vibration of the camera due to the movement of the shutter might shift everything by a pixel or so (high-end cameras are loaded with special features to address this problem).英語のヒント
さらに、(7.2節で論じたように)縁のような低い水準の特徴量を検出するときには、表現が並進に対してある程度不変であってほしいことが多い。たとえば、白と黒の境目がくっきりした画像
Xをとり、画像全体を1画素右にずらす、つまりZ[i, j] = X[i, j + 1]とすると、新しい画像Zに対する出力は大きく違うものになるかもしれない。縁が1画素ずれてしまうのである。現実には、物体がまったく同じ場所に現れることはまずない。実際、三脚を使い、物体が静止していても、シャッターの動きによるカメラの振動で、すべてが1画素ほどずれることがある(高級なカメラには、この問題に対処するための特別な機能が満載されている)。This section introduces pooling layers, which serve the dual purposes of mitigating the sensitivity of convolutional layers to location and of spatially downsampling representations.
英語のヒント
この節では、畳み込み層の位置への敏感さを和らげることと、表現を空間的にダウンサンプリングすることという、二つの目的を果たすプーリング層を紹介する。
import torch
from torch import nn
from d2l import torch as d2l