For faster navigation, this Iframe is preloading the Wikiwand page for 畳み込みニューラルネットワーク.

畳み込みニューラルネットワーク

畳み込みニューラルネットワーク(たたみこみニューラルネットワーク、: convolutional neural network、略称: CNNまたはConvNet)は、畳み込みを使用しているニューラルネットワークの総称である。画像認識や動画認識、音声言語翻訳[1]レコメンダシステム[2]自然言語処理[3]コンピュータ将棋[4]コンピュータ囲碁[4]などに使用されている。

数式表記

[編集]

畳み込みニューラルネットワークの定義は厳密に決まっているわけではないが、画像認識の(縦, 横, 色)の2次元画像の多クラス分類の場合、以下の擬似コードで書かれるのが基本形である[5]。ここから色々なバリエーションが作られている。損失関数交差エントロピーを使用し、パラメータは確率的勾配降下法で学習するのが基本形である。これらの偏微分自動微分を参照。

以下の繰り返し
    畳み込み層と活性化関数
    最大値プーリング
ベクトルに平坦化(flatten)
以下の繰り返し
    全結合層と活性化関数
ソフトマックス関数

畳み込み層

[編集]

基本形は、入力 とカーネル とバイアス から出力 を下記で計算する。カーネルとバイアスが学習対象である。

より一般的な畳み込みは以下のように PyTorch では実装している[6]はm番目の入力チャンネルを、はn番目の出力チャンネルを、相互相関関数を意味する。

すなわち各出力チャンネルごとに入力チャンネル 枚分のカーネル が用意され、入力の各チャンネルのカーネルを用いた畳み込みの総和へバイアス項 が加算され、出力の各チャンネルとなっている。

畳み込み自体にその様な制限があるわけではないが、PyTorch 2.3 現在は、式からわかるように、入力チャンネル間は畳み込み処理ではなく和で計算され、また入力チャンネル に畳み込まれるカーネル は出力チャンネルごとに異なるという実装になっている。引数 groups を指定するとここら辺の挙動も変わる。

カーネルはしばしばフィルタと呼ばれる[7]。これは位置関係をもつ重みづけ和のスライド演算(畳み込み)がフィルタ適用と等価なことに由来する。

畳み込み処理自体は単純な線形変換である。出力のある1点を見ると局所以外の重みが全て0の全結合と等価であることからこれはわかる。多くのCNNでは畳み込み処理に引き続いてシグモイド関数やReLUなどの活性化関数による非線形変換をおこなう。[要出典]

活性化関数

[編集]

活性化関数がReLUの場合、入力 から出力 を下記で計算する。学習するパラメータは無い。

最大値プーリング

[編集]

カーネルの大きさが の場合、入力 から出力 を下記で計算する[8]。学習するパラメータは無い。

全結合層

[編集]

ベクトルの全結合層は 入力 と重み とバイアス から出力 を下記で計算する。重みとバイアスが学習対象である。

シフト不変性

[編集]

畳み込みニューラルネットワークは、その重み(行列の)共有構造と並進不変特性に基づいて、シフト不変(shift invariant)あるいは位置不変(space invariant)人工ニューラルネットワークSIANN)とも呼ばれている[9][10]

畳み込み層のバリエーション

[編集]

畳み込みニューラルネットワークの核となる手法は畳み込み処理(convolution)であり、それには様々な変種がある。以下はその一例である。

点単位畳み込み

[編集]

2次元画像の場合は、下記を点単位畳み込みと呼ぶ。

がスカラーの畳み込みは点単位畳み込み(pointwise convolution)や1x1畳み込み(1x1 convolution)と呼称される[11]。例えば2DConvにおける1x1カーネルがある。出力チャネル に着目するとこの畳み込みは入力チャネルの加重平均とみなせる。あるいは各点(pointwise)での入力チャネルを跨いだ全結合とみなせる。処理全体では出力チャネルごとに異なる加重を用いて入力チャネル平均を取ることと同義である。利用目的には位置情報を保った(pointwiseな)変換、出力次元数 調整などが挙げられる。実装上は最小カーネルによる畳み込みで表現される(例: 2DConvにおける カーネル)。全結合層(Linear)を用いても容易に表現できる。

深さ単位畳み込み

[編集]

2次元画像の場合は、下記を深さ単位畳み込みと呼ぶ。 である。

グループ化畳み込みのグループ数をチャネル数と一致させる、すなわちチャネル間の和をなくしたものは深さ単位畳み込み(depthwise convolution)と呼称される[12]

グループ化畳み込み

[編集]

畳み込みの変種としてグループ化畳み込み(grouped convolution)がある。通常の畳み込みでは全入力チャネルの畳み込み和を計算するが、グループ化畳み込みでは入出力チャネルをいくつかのグループに分割しグループ内で通常の畳み込みと和をおこなう[13][14]。これによりカーネル枚数・計算量の削減、複数GPUを用いた学習、別技術と組み合わせた性能の向上などが可能になる(c.f. AlexNet, ResNeXt)。

深さ単位分離可能畳み込み

[編集]

2次元画像の場合は、下記の深さ単位畳み込みして点単位畳み込みしたものを深さ単位分離可能畳み込みと呼ぶ。

深さ単位分離可能畳み込み(depthwise separable convolution)は空間方向の畳み込み層とチャネル方向の全結合層に分離した畳み込みモジュールである。すなわち通常の畳み込みを 深さ単位畳み込み + 点単位畳み込み で置き換えるモジュールである[15]。計算量・パラメータ量を1/10スケールで削減できる利点がある。

転置畳み込み

[編集]

2次元画像の場合は、ストライドを とした時、下記の擬似コードで書かれるものを転置畳み込み(transposed convolution)と呼ぶ。 の時、最大値プーリングは約半分の大きさになるが、転置畳み込みは約2倍の大きさになる。[16]

for i, j, k, l, m, n in それぞれの値域
     += 

逆畳み込み(decovolution)やfractionally-strided convolutionとも呼ばれるが、逆畳み込みは別の意味で使われている言葉なので誤用である。[17]

畳み込みニューラルネットワークのバリエーション

[編集]

畳み込みニューラルネットワークは畳み込み処理を用いたニューラルネットワークの総称である。畳み込みの種類、カーネルのサイズと層の関係、特殊なモジュールの有無などにより様々なサブタイプ(変種)が存在する。

Recurrent CNN

[編集]

単純なCNNは順伝播型 (FFN)、すなわち浅い層から深い層へのみ結合をもつ。ただしCNNは2層間の結合様式を規定するクラスでありFFNと限らない[要出典]。非FFN型CNNの一例として大局的に回帰結合をもち層間では畳み込みをおこなうRecurrent CNNが提唱されている[18]

Recurrent CNN(RCNN)は回帰結合を持つ畳み込みニューラルネットワークである[19]。すなわちフィードフォワード型 (FFN) ではなく回帰型 (RNN) のネットワーク構造を持ち、層間の結合に全結合 (MLP) ではなく畳み込みを採用したニューラルネットワークである。ゆえにCNNでありRNNでもある。

U-Net

[編集]

U-Net はセマンティック・セグメンテーション用の畳み込みニューラルネットワーク。

受容野

[編集]

受容野: receptive field)は出力中の一点と結合している入力の広さ・幅である[20][21]。すなわち出力中の一点へと情報を伝達しうる入力域である。視覚等の感覚神経における「受容野」から転用して名付けられた。

例えば1次元の入出力をもつ1層のCNNがあったとする。CNNのカーネルサイズが だった場合、出力 は入力 , , の重みづけ和で計算されるため受容野は になる。このCNNを2層重ねた場合、 は中間層 , , の和でありさらに , , , , の和となるため、CNNの受容野は になる。

Convパラメータ・変種およびネットワーク変種によって受容野サイズへ異なる影響を与える。以下はその一例である。

  • Kernelパラメータ: 受容野の端をカーネルで置き換える形で広げる
  • Strided Convolution: 受容野の端以外の部分をstride倍率に合わせて倍増させる
  • Dilated Convolution: 歯抜けカーネルであるため、より大きいカーネルとして振る舞う(例: k3d2はk5と同じ受容野)

受容野のサイズは再帰的に求めることができる。

層の畳み込みからのなるCNNを考える。ここでは第 を畳み込み で変換して次の層 を得る(例: 入力層 を作用させて中間層 を得る)。ここで はカーネルサイズ 、ストライド をもつとする。出力層 から見た における受容野を としたとき、次の式が成立する(図参照)[22]

CNN受容野の再帰計算

よって を初期条件としてこの式を入力層受容野 まで再帰することで受容野を計算できる。

歴史

[編集]

画像処理フィルタとして畳み込みを使用するという手法はコンピューターでの画像処理が登場した初期の段階から使われている手法である。エッジ検出ガウシアンぼかしなど多数ある。

畳み込みニューラルネットワークは動物の視覚野から発想を得て[23]福島邦彦によって提唱されたネオコグニトロンに起源を持つ[24][25][26]。ネオコグニトロンはニューラルネットワークで畳み込みを使用した。

有名なモデルとして以下のものがある。

2012年からのディープラーニングブームより前の画像認識は画像(ピクセルデータ)を注意深く設計されたデータ前処理により特徴量(1999年のSIFTや2006年のSURFなど)へ変換し、それを用いた学習が主流だった。例えば AlexNet が優勝した ILSVRC 2012 の2位のモデルの ISI は SIFT などを使用している[27]。畳み込みニューラルネットワークはピクセルを直接入力に用いることができ、特徴量設計において専門家の知識に依存しない特徴をもつとされた[30]。現在では畳み込みニューラルネットワーク以外のニューラルネットワーク(例: Vision Transformer; ViTMLPベースの gMLP)でもピクセル入力の画像処理が実現されている[31][32]。ゆえに畳み込みそのものが特徴量設計を不要にするキー技術であるとは言えないことがわかっている[要出典]

脚注

[編集]

注釈

[編集]

出典

[編集]
  1. ^ K-Pop Hit Song Recorded in 6 Languages Using Deep Learning” (英語). K-Pop Hit Song Recorded in 6 Languages Using Deep Learning (2023年8月2日). 2024年2月20日閲覧。
  2. ^ van den Oord, Aaron; Dieleman, Sander; Schrauwen, Benjamin (2013-01-01). Burges, C. J. C.. ed. Deep content-based music recommendation. Curran Associates, Inc.. pp. 2643–2651. http://papers.nips.cc/paper/5004-deep-content-based-music-recommendation.pdf 
  3. ^ Collobert, Ronan; Weston, Jason (2008-01-01). “A Unified Architecture for Natural Language Processing: Deep Neural Networks with Multitask Learning”. Proceedings of the 25th International Conference on Machine Learning. ICML '08 (New York, NY, USA: ACM): 160–167. doi:10.1145/1390156.1390177. ISBN 978-1-60558-205-4. https://doiorg/10.1145/1390156.1390177. 
  4. ^ a b 誰もdlshogiには敵わなくなって将棋AIの世界が終わってしまった件 | やねうら王 公式サイト”. yaneuraou.yaneu.com. 2024年7月15日閲覧。
  5. ^ examples/mnist/main.py at main · pytorch/examples”. 2024年7月15日閲覧。
  6. ^ Conv2d — PyTorch 2.3 documentation”. pytorch.org. 2024年7月15日閲覧。
  7. ^ "convolved with its own set of filters" PyTorch 1.10 Conv1D
  8. ^ MaxPool2d — PyTorch 2.3 documentation”. pytorch.org. 2024年7月15日閲覧。
  9. ^ Zhang, Wei (1988). “Shift-invariant pattern recognition neural network and its optical architecture”. Proceedings of annual conference of the Japan Society of Applied Physics. https://drive.google.com/file/d/0B65v6Wo67Tk5Zm03Tm1kaEdIYkE/view?usp=sharing. 
  10. ^ Zhang, Wei (1990). “Parallel distributed processing model with local space-invariant interconnections and its optical architecture”. Applied Optics 29 (32). https://drive.google.com/file/d/0B65v6Wo67Tk5ODRzZmhSR29VeDg/view?usp=sharing. 
  11. ^ "a 1×1 convolution called a pointwise convolution." Andrew (2017) MobileNets Arxiv
  12. ^ "Depthwise convolution with one filter per input channel (input depth)" Andrew G. Howard. (2017). MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. Arxiv
  13. ^ "In a group conv layer ..., input and output channels are divided into C groups, and convolutions are separately performed within each group." Saining (2017). Aggregated Residual Transformations for Deep Neural Networks. Arxiv
  14. ^ "groups controls the connections between inputs and outputs. ... At groups=1, all inputs are convolved to all outputs ... At groups= in_channels, each input channel is convolved with its own set of filters" PyTorch nn.Conv2d
  15. ^ "depthwise separable convolutions which is a form of factorized convolutions which factorize a standard convolution into a depthwise convolution and a 1×1 convolution called a pointwise convolution." Howard, et al. (2017). MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.
  16. ^ 14.10. Transposed Convolution — Dive into Deep Learning 1.0.3 documentation”. d2l.ai. 2024年7月23日閲覧。
  17. ^ ConvTranspose2d — PyTorch 2.3 documentation”. pytorch.org. 2024年7月23日閲覧。
  18. ^ "we propose a recurrent CNN (RCNN) for object recognition by incorporating recurrent connections into each convolutional layer" p.3367 and "This work shows that it is possible to boost the performance of CNN by incorporating more facts of the brain. " p.3374 of Liang, et al. (2015). Recurrent Convolutional Neural Network for Object Recognition.
  19. ^ "we propose a recurrent CNN (RCNN) for object recognition by incorporating recurrent connections into each convolutional layer" Liang, et al. (2015). Recurrent Convolutional Neural Network for Object Recognition.
  20. ^ "予測の際に使用する有限長の過去のデータ点数 R は受容野 (receptive field) の大きさを表す." 松本. (2019). WaveNetによる言語情報を含まない感情音声合成方式の検討. 情報処理学会研究報告.
  21. ^ "Effective Receptive Field (ERF): is the area of the original image that can possibly influence the activation of a neuron. ... ERF and RF are sometimes used interchangeably" Le. (2017). What are the Receptive, Effective Receptive, and Projective Fields of Neurons in Convolutional Neural Networks?. Arxiv.
  22. ^ "layer k ... Rk be the ERF ... fk represent the filter size ... the final top-down equation: "
  23. ^ Matusugu, Masakazu; Katsuhiko Mori; Yusuke Mitari; Yuji Kaneda (2003). “Subject independent facial expression recognition with robust face detection using a convolutional neural network”. Neural Networks 16 (5): 555–559. doi:10.1016/S0893-6080(03)00115-1. http://www.iro.umontreal.ca/~pift6080/H09/documents/papers/sparse/matsugo_etal_face_expression_conv_nnet.pdf 2013年11月17日閲覧。. 
  24. ^ Fukushima, K. (2007). “Neocognitron”. Scholarpedia 2 (1): 1717. doi:10.4249/scholarpedia.1717. 
  25. ^ Fukushima, Kunihiko (1980). “Neocognitron: A Self-organizing Neural Network Model for a Mechanism of Pattern Recognition Unaffected by Shift in Position”. Biological Cybernetics 36 (4): 193–202. doi:10.1007/BF00344251. PMID 7370364. http://www.cs.princeton.edu/courses/archive/spr08/cos598B/Readings/Fukushima1980.pdf 2013年11月16日閲覧。. 
  26. ^ LeCun, Yann. “LeNet-5, convolutional neural networks”. 2013年11月16日閲覧。
  27. ^ a b ImageNet Large Scale Visual Recognition Competition 2012 (ILSVRC2012)”. image-net.org. 2024年7月16日閲覧。
  28. ^ ILSVRC2014 Results”. image-net.org. 2024年7月16日閲覧。
  29. ^ ILSVRC2015 Results”. image-net.org. 2024年7月16日閲覧。
  30. ^ 藤吉 2019, p. 293-294.
  31. ^ Dosovitskiy, et al. (2021). An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. ICLR 2021.
  32. ^ Liu, et al. (2021). Pay Attention to MLPs. NeurIPS 2021.

参考文献

[編集]
  • 藤吉, 弘亘 (2019-04). “リレー解説 機械学習の可能性 《第1回》機械学習の進展による画像認識技術の変遷”. 計測と制御 (計測自動制御学会) 58 (4): 291-297. doi:10.11499/sicejl.58.291. ISSN 1883-8170. 

関連項目

[編集]
{{bottomLinkPreText}} {{bottomLinkText}}
畳み込みニューラルネットワーク
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?