コンテンツにスキップ

ニューラルネットワーク

出典: フリー百科事典『ウィキペディア(Wikipedia)』

: neural network; NN[1][1][2] (: artificial neural network) 

[ 1]

[]


 (axon)  (dendrite) [3](synapse)[3][1]Dendrite, Axon [1][ 2]

[1] [4][1][4]

weightsw

[1]appleorange[1]調[1]調orange[1]  調[4]



: : 




/: 



[ 3]

[]


19431949   "  " [5]

1967[6]10[5]

1970[5][5]1986  [5]

[]


1943

1958

1969

1979使

1982

1985

1986

1988[7]1989使[8][9]LeCun

2006[10][11]2010

[]

[]


: Feed-forward Neural Network; FFN, FFNN[12]

FFN/FFNFFN

: 1-layer 

: N-layer 

: N-layer c.f. recurrent CNN; RCNN

[]


FFN1[13]FFNRNN: GPU[ 4]

RBF[]




RBF

GRNNGeneral Regression Neural Network- RBF

[]


1982




[]





再帰型ニューラルネットワーク(リカレントニューラルネット、フィードバックニューラルネット)[編集]

フィードフォワードニューラルネットと違い、双方向に信号が伝播するモデル。すべてのノードが他の全てのノードと結合を持っている場合、全結合リカレントニューラルネットと呼ぶ。シーケンシャルなデータに対して有効で、自然言語処理音声動画の解析などに利用される[14]

Transformer[編集]


Self-Attention[13][13]

使[15]

[]







[]




2015NNQualcommSnapdragon 820[16][17]

[]


[18]

[]




22[18]3



23[ 5][18][19]

/[]


 §  § 

[]



Autoregressive Generative Network § PixelCNNWaveNetWaveRNN=CNNWaveNet沿RNNWaveRNN

[]


 (VAE) AVQ-VAE-2

[]


 (Generative Adversarial Network, GAN) A (Generator) BDCGANStyleGANBigGAN

flow-based[]


flow-basedFlowGlowNICErealNVP

[]



Table. ニューラルネットワークの構成要素
総称/名称 概念 意図/効果
skip connection x = x + f(x) 勾配消失の防止 ResNet
アンサンブル学習 ResNet
位置情報の保持 U-Net
ボトルネック構造 Wshallow > Wmiddle < Wdeep 特徴抽出 AE
圧縮された潜在表現 generative AE
階層構造 middle(x) = f(x + bottom(x)) 局所/全体特徴の両立[20] U-Net GAN
一貫性

consistency

cycle GB2A(GA2B(a)) = a コンテンツ/不変特徴の保持 CycleGAN
latent D(G(z)) = D(G(z+Δ)) 潜在変数ゆらぎへの堅牢性 ICR-BigGAN
データ拡張 D(Aug(x)) = D(x)

D(G(z)) = D(Aug(G(z)))

leakのないデータ拡張 CR-GAN

ICR-BigGAN

progressive output Size(Gt=0(x)) < Size(Gt=1(x)) 学習の高速化・安定化[21] PGGAN
input Input Complexity t0 < t1 学習の高速化・安定化 PA-GAN
正規化 batch y = γc Norm(x) + βc 学習の高速化
layer
instance
group
Conditional y = γcnl,s Norm(c) + βcnl,s スタイル変換
AdaIN y = σ(s) Norm(c) + μ(s) スタイル変換 StyleGAN
SPADE スタイル変換

バッチ正規化[編集]


: Batch Normalization[22]/BNμ, σ (β, γ)  y = γX+β

CNNLayer NormInstance NormGroup NormβγNN(β)NN(γ)

活性化関数[編集]



学習[編集]






 (gradient-free method) [2]

[]


 + ; [23]Level 2 BLAS Level 3 BLAS [24]

[]


3  ReLU使

3XYT   


使


 T 


Python 3.5 Python @ **  * 
import numpy as np

dim_in = 1              # 入力は1次元
dim_out = 1             # 出力は1次元
hidden_count = 1024     # 隠れ層のノードは1024個
learn_rate = 0.005      # 学習率

# 訓練データはxは -1~1yは 2 * x ** 2 - 1
train_count = 64        # 訓練データ数
train_x = np.arange(-1, 1, 2 / train_count).reshape((train_count, dim_in))
train_y = np.array([2 * x ** 2 - 1 for x in train_x]).reshape((train_count, dim_out))

# 重みパラメータ。-0.5 〜 0.5 でランダムに初期化。この行列の値を学習する。
w1 = np.random.rand(hidden_count, dim_in) - 0.5
w2 = np.random.rand(dim_out, hidden_count) - 0.5
b1 = np.random.rand(hidden_count) - 0.5
b2 = np.random.rand(dim_out) - 0.5

# 活性化関数は ReLU
def activation(x):
    return np.maximum(0, x)

# 活性化関数の微分
def activation_dash(x):
    return (np.sign(x) + 1) / 2

# 順方向。学習結果の利用。
def forward(x):
    return w2 @ activation(w1 @ x + b1) + b2

# 逆方向。学習
def backward(x, diff):
    global w1, w2, b1, b2
    v1 = (diff @ w2) * activation_dash(w1 @ x + b1)
    v2 = activation(w1 @ x + b1)

    w1 -= learn_rate * np.outer(v1, x)  # outerは直積
    b1 -= learn_rate * v1
    w2 -= learn_rate * np.outer(diff, v2)
    b2 -= learn_rate * diff

# メイン処理
idxes = np.arange(train_count)          # idxes は 0~63
for epoc in range(1000):                # 1000エポック
    np.random.shuffle(idxes)            # 確率的勾配降下法のため、エポックごとにランダムにシャッフルする
    error = 0                           # 二乗和誤差
    for idx in idxes:
        y = forward(train_x[idx])       # 順方向でxからyを計算する
        diff = y - train_y[idx]         # 訓練データとの誤差
        error += diff ** 2              # 二乗和誤差に蓄積
        backward(train_x[idx], diff)    # 誤差を学習
    print(error.sum())                  # エポックごとに二乗和誤差を出力。徐々に減衰して0に近づく。

推論[編集]


: inference

[]


API[25]GPUCUDAWindowsDirectML[26]NVIDIATensorRT[27] 

[]


: Quantizationweightactivation[28][29]8-bitFP32INT8

[30]

: FP32INT8:IPC1AVX-FP32: 8AVX2-INT8: 32

:   

: [31]

: 

: -

QDQ[32][33] 

 

: Static Quantization: [34]

: Dynamic Quantization: activationactivation[35]weight[36]

fake quantization (Quantize and DeQuantize; QDQ): +[37][38]

[]


: Sparsification



:   

: 

: 

: 



: Pruning

脚注[編集]

注釈[編集]



(一)^ 

(二)^ 11

(三)^ 2020

(四)^ RNN1stepGPU使

(五)^ BP使

出典[編集]

  1. ^ a b c d e f g h i j Charu C.Aggarwal著『ニューラルネットワークとディープラーニング』(データサイエンス大系シリーズ)、学術図書出版社、2022年。ISBN 978-4780607147, 第一章「ニューラルネットワークとは」「はじめに」、pp.1-2
  2. ^ 『2020年版 基本情報技術者 標準教科書』オーム社、p.55
  3. ^ a b 平塚秀雄『よくわかる脳神経外科学』金原出版、1996, pp.14-15「神経細胞とニューロン」
  4. ^ a b c 平野廣美『C++とJavaでつくるニューラルネットワーク』パーソナルメディア株式会社、2008、p.27「学習することは重みが変わること」
  5. ^ a b c d e 平野廣美『C++とJavaでつくるニューラルネットワーク』パーソナルメディア株式会社、2008、pp.9-10「はじめに」
  6. ^ John C. Eccles, Masao Ito, János Szentágothai(1967), The Cerebellum as a Neuronal Machine, (Springer, New York) [1]
  7. ^ Homma, Toshiteru; Les Atlas; Robert Marks II (1988). “An Artificial Neural Network for Spatio-Temporal Bipolar Patters: Application to Phoneme Classification”. Advances in Neural Information Processing Systems 1: 31–40. http://papers.nips.cc/paper/20-an-artificial-neural-network-for-spatio-temporal-bipolar-patterns-application-to-phoneme-classification.pdf. 
  8. ^ Yann Le Cun (June 1989). Generalization and Network Design Strategies. http://yann.lecun.com/exdb/publis/pdf/lecun-89.pdf. 
  9. ^ Y. LeCun; B. Boser; J. S. Denker; D. Henderson; R. E. Howard; W. Hubbard; L. D. Jackel (1989). “Backpropagation applied to handwritten zip code recognition”. Neural Computation 1 (4): 541-551. 
  10. ^ Reducing the Dimensionality of Data with Neural Networks
  11. ^ A fast learning algorithm for deep belief nets
  12. ^ "A nonrecurrent network has no cycles. Nonrecurrent networks can be thought of as computing an input-output function." Jordan, M.I. (1986). Serial order: A parallel distributed processing approach. (Tech. Rep. No. 8604). San Diego: University of California, Institute for Cognitive Science.
  13. ^ a b c Vaswani et al. 2017, p. 6001.
  14. ^ Yu, Yong; Si, Xiaosheng; Hu, Changhua; Zhang, Jianxun (2019-07-01). “A Review of Recurrent Neural Networks: LSTM Cells and Network Architectures”. Neural Computation 31 (7): 1235–1270. doi:10.1162/neco_a_01199. ISSN 0899-7667. https://doi.org/10.1162/neco_a_01199. 
  15. ^ Vaswani, Ashish; Shazeer, Noam; Parmar, Niki; Uszkoreit, Jakob; Jones, Llion; Gomez, Aidan N.; Kaiser, Lukasz; Polosukhin, Illia (2017-12-05). “Attention Is All You Need”. arXiv:1706.03762 [cs]. http://arxiv.org/abs/1706.03762. 
  16. ^ Neuromorphic Processing : A New Frontier in Scaling Computer Architecture Qualcomm 2014年
  17. ^ Qualcomm’s cognitive compute processors are coming to Snapdragon 820 ExtremeTech 2015年3月2日
  18. ^ a b c 複素ニューラルネットワーク
  19. ^ Akira Hirose, Shotaro Yoshida (2012). “Generalization Characteristics of Complex-valued Feedforward Neural Networks in Relation to Signal Coherence”. IEEE TNNLS 23 (4): 541-551. 
  20. ^ The proposed U-Net based architecture allows to provide detailed per-pixel feedback to the generator while maintaining the global coherence of synthesized images
  21. ^ starting from a low resolution, we add new layers that model increasingly fine details as training progresses. This both speeds the training up and greatly stabilizes it PGGAN paper
  22. ^ "making normalization a part of the model architecture and performing the normalization for each training mini-batch." Sergey Ioffe, et. al.. (2015)
  23. ^ "ニューラルネットワークの演算の基本は、多入力の積和演算である。" 百瀬 (2016). 第2章:ディープ・ニューラルネットワークのニューロチップへの実装~その勘所は!!. semiconportal.
  24. ^ "深層学習の…フレームワーク中では, 計算時間の多くが畳み込み計算などの密行列積に費やされており … 計算時間の約90%が畳み込み層での計算時間であることが知られている" p.1 of 関谷, et al. (2017). 低ランク近似を用いた深層学習の行列積の高速化. 情報処理学会研究報告. Vol2017-HPC-158, No.24.
  25. ^ Optimize and Accelerate Machine Learning Inferencing and Training. ONNX Runtime.
  26. ^ "Direct Machine Learning (DirectML) is a low-level API for machine learning." Direct Machine Learning (DirectML). Microsoft.
  27. ^ "TensorRT can optimize and deploy applications to the data center, as well as embedded and automotive environments. It powers key NVIDIA solutions" NVIDIA TensorRT. NVIDIA.
  28. ^ "Quantization works by reducing the precision of the numbers used to represent a model's parameters, which by default are 32-bit floating point numbers." Model optimization. TensorFlow.
  29. ^ "Quantizing a network means converting it to use a reduced precision integer representation for the weights and/or activations." DYNAMIC QUANTIZATION. PyTorch.
  30. ^ "Quantization performance gain comes in 2 part: instruction and cache." Quantize ONNX Models. ONNX Runtime.
  31. ^ "Less memory usage: Smaller models use less RAM when they are run, which frees up memory for other parts of your application to use, and can translate to better performance and stability." Model optimization. TensorFlow.
  32. ^ "Old hardware doesn’t have or has few instruction support for byte computation. And quantization has overhead (quantize and dequantize), so it is not rare to get worse performance on old devices." Quantize ONNX Models. ONNX Runtime.
  33. ^ "Performance improvement depends on your model and hardware." Quantize ONNX Models. ONNX Runtime.
  34. ^ "Static quantization quantizes the weights and activations of the model. ... It requires calibration with a representative dataset to determine optimal quantization parameters for activations." QUANTIZATION. PyTorch.
  35. ^ "with dynamic quantization ... determine the scale factor for activations dynamically based on the data range observed at runtime." DYNAMIC QUANTIZATION. PyTorch.
  36. ^ "The model parameters ... are converted ahead of time and stored in INT8 form." DYNAMIC QUANTIZATION. PyTorch.
  37. ^ "Simulate the quantize and dequantize operations in training time." FAKEQUANTIZE. PyTorch. 2022-03-15閲覧.
  38. ^ "There are 2 ways to represent quantized ONNX models: ... Tensor Oriented, aka Quantize and DeQuantize (QDQ)." Quantize ONNX Models. ONNX RUNTIME. 2022-03-15閲覧.

参考文献[編集]

関連項目[編集]

外部リンク[編集]