第7章畳み込みニューラルネットワーク
7.1.2. Constraining the MLP7.1.2 MLPに制約を加える
To start off, we can consider an MLP with two-dimensional images as inputs and their immediate hidden representations similarly represented as matrices (they are two-dimensional tensors in code), where both and have the same shape. Let that sink in. We now imagine that not only the inputs but also the hidden representations possess spatial structure.
英語のヒント
手始めに、2次元の画像を入力とし、そのすぐ次の隠れ表現も同じく行列(コードでは2次元のテンソル)として表すMLPを考えよう。ここでとはどちらも同じ形状をもつ。このことをよく飲み込んでほしい。今度は、入力だけでなく隠れ表現も空間的な構造をもつと想像するのである。
Let and denote the pixel at location in the input image and hidden representation, respectively. Consequently, to have each of the hidden units receive input from each of the input pixels, we would switch from using weight matrices (as we did previously in MLPs) to representing our parameters as fourth-order weight tensors . Suppose that contains biases, we could formally express the fully connected layer as
英語のヒント
とが、それぞれ入力画像と隠れ表現の位置にある画素を表すとしよう。その結果、隠れユニットのそれぞれが入力の画素のそれぞれから入力を受け取るようにするには、(以前MLPでしたように)重み行列を使うことから、パラメータを4階の重みテンソルとして表すことへと切り替えることになる。がバイアスを含むとすると、全結合層は形式的に次のように表せる。
(7.1.1)
The switch from to is entirely cosmetic for now since there is a one-to-one correspondence between coefficients in both fourth-order tensors. We simply re-index the subscripts such that and . In other words, we set . The indices and run over both positive and negative offsets, covering the entire image. For any given location (, ) in the hidden representation , we compute its value by summing over pixels in , centered around and weighted by . Before we carry on, let’s consider the total number of parameters required for a single layer in this parametrization: a image (1 megapixel) is mapped to a hidden representation. This requires parameters, far beyond what computers currently can handle.
英語のヒント
からへの切り替えは、今のところまったく見た目だけのものである。二つの4階テンソルの係数のあいだには一対一の対応があるからである。単に添え字を、かつとなるように付け直すだけである。言い換えれば、とおく。添え字とは正と負の両方のずれにわたって動き、画像全体を覆う。隠れ表現の任意の位置(, )について、その値は、を中心としで重み付けしたの画素にわたって和をとることで計算する。先に進む前に、このパラメータ化での一つの層に必要なパラメータの総数を考えよう。の画像(100万画素)がの隠れ表現に写される。これには個のパラメータが必要で、今のコンピュータが扱える量をはるかに超えている。
7.1.2.1. Translation Invariance7.1.2.1 並進不変性
Now let’s invoke the first principle established above: translation invariance (Zhang et al., 1988). This implies that a shift in the input should simply lead to a shift in the hidden representation . This is only possible if and do not actually depend on . As such, we have and is a constant, say . As a result, we can simplify the definition for :
英語のヒント
ここで、上で立てた第一の原理、並進不変性(Zhang et al., 1988)をもち出そう。これは、入力のずれが、単に隠れ表現のずれにつながるべきだということを含意する。これが可能なのは、とが実際にはに依存しないときだけである。そこで、となり、は定数、たとえばとなる。その結果、の定義を簡単にできる。
(7.1.2)
This is a convolution! We are effectively weighting pixels at in the vicinity of location with coefficients to obtain the value . Note that needs many fewer coefficients than since it no longer depends on the location within the image. Consequently, the number of parameters required is no longer but a much more reasonable : we still have the dependency on . In short, we have made significant progress. Time-delay neural networks (TDNNs) are some of the first examples to exploit this idea (Waibel et al., 1989).
英語のヒント
これは畳み込みである!値を得るために、実質的には、位置の近くのにある画素に、係数で重みを付けている。は画像の中の位置にもはや依存しないので、よりずっと少ない係数で済むことに注意してほしい。その結果、必要なパラメータの数は、もはやではなく、ずっと手頃なになる。それでも、への依存はまだ残っている。要するに、大きく前進した。時間遅れニューラルネットワーク(TDNN)は、この考えを活用した最初の例の一つである(Waibel et al., 1989)。
7.1.2.2. Locality7.1.2.2 局所性
Now let’s invoke the second principle: locality. As motivated above, we believe that we should not have to look very far away from location in order to glean relevant information to assess what is going on at . This means that outside some range or , we should set . Equivalently, we can rewrite as
英語のヒント
次に、第二の原理である局所性をもち出そう。上で動機づけたように、で何が起きているかを評価するのに必要な情報を集めるために、位置からあまり遠くまで見なくてもよいはずだと考える。つまり、ある範囲の外、またはでは、とすべきである。同じことだが、は次のように書き直せる。
(7.1.3)
This reduces the number of parameters from to , where is typically smaller than . As such, we reduced the number of parameters by another four orders of magnitude. Note that (7.1.3), is what is called, in a nutshell, a convolutional layer. Convolutional neural networks (CNNs) are a special family of neural networks that contain convolutional layers. In the deep learning research community, is referred to as a convolution kernel, a filter, or simply the layer’s weights that are learnable parameters.
英語のヒント
これにより、パラメータの数はからに減る。ここではふつうより小さい。そのため、パラメータの数をさらに4桁減らしたことになる。式(7.1.3)は、一言で言えば、畳み込み層と呼ばれるものであることに注意してほしい。畳み込みニューラルネットワーク(CNN)は、畳み込み層を含むニューラルネットワークの特別な族である。深層学習の研究コミュニティでは、は畳み込みカーネル、フィルタ、あるいは単に学習できるパラメータである層の重みと呼ばれる。
While previously, we might have required billions of parameters to represent just a single layer in an image-processing network, we now typically need just a few hundred, without altering the dimensionality of either the inputs or the hidden representations. The price paid for this drastic reduction in parameters is that our features are now translation invariant and that our layer can only incorporate local information, when determining the value of each hidden activation. All learning depends on imposing inductive bias. When that bias agrees with reality, we get sample-efficient models that generalize well to unseen data. But of course, if those biases do not agree with reality, e.g., if images turned out not to be translation invariant, our models might struggle even to fit our training data.
英語のヒント
以前は、画像処理のネットワークのたった一つの層を表すのに何十億ものパラメータが必要だったかもしれないが、今では、入力の次元も隠れ表現の次元も変えずに、ふつうほんの数百のパラメータで済む。パラメータをこれほど劇的に減らすために払う代価は、特徴量が並進不変になり、各隠れ活性の値を決めるときに、層が局所的な情報しか組み込めなくなることである。あらゆる学習は、帰納バイアスを課すことにかかっている。そのバイアスが現実と合っていれば、見たことのないデータによく汎化する、標本の効率がよいモデルが得られる。しかし、もちろん、そうしたバイアスが現実と合っていなければ、たとえば画像が並進不変でないとわかったら、モデルは訓練データに当てはまることにさえ苦労するかもしれない。
This dramatic reduction in parameters brings us to our last desideratum, namely that deeper layers should represent larger and more complex aspects of an image. This can be achieved by interleaving nonlinearities and convolutional layers repeatedly.
英語のヒント
パラメータのこの劇的な削減によって、最後の望ましい条件、すなわち、より深い層は画像のより大きく複雑な面を表すべきだ、という条件にたどり着く。これは、非線形性と畳み込み層を繰り返し交互に挟むことで達成できる。