Suche senden
Hochladen
Rabbit challenge 3 DNN Day2
•
Als PPTX, PDF herunterladen
•
0 gefällt mir
•
25 views
T
TOMMYLINK1
Folgen
over fitting optimization convolution neural network (CNN)
Weniger lesen
Mehr lesen
Ingenieurwesen
Melden
Teilen
Melden
Teilen
1 von 32
Jetzt herunterladen
Empfohlen
Rabbit challenge 5_dnn3
Rabbit challenge 5_dnn3
TOMMYLINK1
Rabbit challenge 3 DNN Day1
Rabbit challenge 3 DNN Day1
TOMMYLINK1
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifier
홍배 김
The world of loss function
The world of loss function
홍배 김
Svm V SVC
Svm V SVC
AMR koura
Anomaly Detection and Localization Using GAN and One-Class Classifier
Anomaly Detection and Localization Using GAN and One-Class Classifier
홍배 김
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Backpropagation (DLAI D3L1 2017 UPC Deep Learning for Artificial Intelligence)
Backpropagation (DLAI D3L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
Empfohlen
Rabbit challenge 5_dnn3
Rabbit challenge 5_dnn3
TOMMYLINK1
Rabbit challenge 3 DNN Day1
Rabbit challenge 3 DNN Day1
TOMMYLINK1
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifier
홍배 김
The world of loss function
The world of loss function
홍배 김
Svm V SVC
Svm V SVC
AMR koura
Anomaly Detection and Localization Using GAN and One-Class Classifier
Anomaly Detection and Localization Using GAN and One-Class Classifier
홍배 김
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Backpropagation (DLAI D3L1 2017 UPC Deep Learning for Artificial Intelligence)
Backpropagation (DLAI D3L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
Learning Financial Market Data with Recurrent Autoencoders and TensorFlow
Learning Financial Market Data with Recurrent Autoencoders and TensorFlow
Altoros
Hands-on Tutorial of Machine Learning in Python
Hands-on Tutorial of Machine Learning in Python
Chun-Ming Chang
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Universitat Politècnica de Catalunya
The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)
Universitat Politècnica de Catalunya
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
홍배 김
Lesson 38
Lesson 38
Avijit Kumar
Backpropagation in Convolutional Neural Network
Backpropagation in Convolutional Neural Network
Hiroshi Kuwajima
Deep Learning for AI (2)
Deep Learning for AI (2)
Dongheon Lee
Iclr2016 vaeまとめ
Iclr2016 vaeまとめ
Deep Learning JP
K-means, EM and Mixture models
K-means, EM and Mixture models
Vu Pham
Lesson 39
Lesson 39
Avijit Kumar
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Gilles Louppe
Kernels and Support Vector Machines
Kernels and Support Vector Machines
Edgar Marca
Lecture 06 marco aurelio ranzato - deep learning
Lecture 06 marco aurelio ranzato - deep learning
mustafa sarac
Support Vector Machines
Support Vector Machines
nextlib
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Universitat Politècnica de Catalunya
Gaussian processing
Gaussian processing
홍배 김
机器学习Adaboost
机器学习Adaboost
Shocky1
Introduction
Introduction
butest
Weitere ähnliche Inhalte
Was ist angesagt?
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
Learning Financial Market Data with Recurrent Autoencoders and TensorFlow
Learning Financial Market Data with Recurrent Autoencoders and TensorFlow
Altoros
Hands-on Tutorial of Machine Learning in Python
Hands-on Tutorial of Machine Learning in Python
Chun-Ming Chang
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Universitat Politècnica de Catalunya
The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)
Universitat Politècnica de Catalunya
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
홍배 김
Lesson 38
Lesson 38
Avijit Kumar
Backpropagation in Convolutional Neural Network
Backpropagation in Convolutional Neural Network
Hiroshi Kuwajima
Deep Learning for AI (2)
Deep Learning for AI (2)
Dongheon Lee
Iclr2016 vaeまとめ
Iclr2016 vaeまとめ
Deep Learning JP
K-means, EM and Mixture models
K-means, EM and Mixture models
Vu Pham
Lesson 39
Lesson 39
Avijit Kumar
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Gilles Louppe
Kernels and Support Vector Machines
Kernels and Support Vector Machines
Edgar Marca
Lecture 06 marco aurelio ranzato - deep learning
Lecture 06 marco aurelio ranzato - deep learning
mustafa sarac
Support Vector Machines
Support Vector Machines
nextlib
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Universitat Politècnica de Catalunya
Gaussian processing
Gaussian processing
홍배 김
Was ist angesagt?
(20)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Learning Financial Market Data with Recurrent Autoencoders and TensorFlow
Learning Financial Market Data with Recurrent Autoencoders and TensorFlow
Hands-on Tutorial of Machine Learning in Python
Hands-on Tutorial of Machine Learning in Python
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
Lesson 38
Lesson 38
Backpropagation in Convolutional Neural Network
Backpropagation in Convolutional Neural Network
Deep Learning for AI (2)
Deep Learning for AI (2)
Iclr2016 vaeまとめ
Iclr2016 vaeまとめ
K-means, EM and Mixture models
K-means, EM and Mixture models
Lesson 39
Lesson 39
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Kernels and Support Vector Machines
Kernels and Support Vector Machines
Lecture 06 marco aurelio ranzato - deep learning
Lecture 06 marco aurelio ranzato - deep learning
Support Vector Machines
Support Vector Machines
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Gaussian processing
Gaussian processing
Ähnlich wie Rabbit challenge 3 DNN Day2
机器学习Adaboost
机器学习Adaboost
Shocky1
Introduction
Introduction
butest
ECCV2010: feature learning for image classification, part 4
ECCV2010: feature learning for image classification, part 4
zukun
Survey Demo
Survey Demo
Anthony Castellani
Introduction to Neural Netwoks
Introduction to Neural Netwoks
Abdallah Bashir
03 image transformations_i
03 image transformations_i
ankit_ppt
Tutorial on convolutional neural networks
Tutorial on convolutional neural networks
Hojin Yang
Lecture7 cross validation
Lecture7 cross validation
Stéphane Canu
Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)
Gaurav Mittal
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
Tribhuwan Pant
Gradient Boosted Regression Trees in scikit-learn
Gradient Boosted Regression Trees in scikit-learn
DataRobot
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Universitat Politècnica de Catalunya
Deep learning image classification aplicado al mundo de la moda
Deep learning image classification aplicado al mundo de la moda
Javier Abadía
Neural networks
Neural networks
HarshitGupta367
Convolution Neural Network Lecture Slides
Convolution Neural Network Lecture Slides
AdnanHaider234505
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
Masahiro Sakai
Scaling Deep Learning with MXNet
Scaling Deep Learning with MXNet
AI Frontiers
Svm dbeth
Svm dbeth
Garisha Chowdhary
06 spatial filtering DIP
06 spatial filtering DIP
babak danyal
畳み込みについて
畳み込みについて
HironoriKanazawa
Ähnlich wie Rabbit challenge 3 DNN Day2
(20)
机器学习Adaboost
机器学习Adaboost
Introduction
Introduction
ECCV2010: feature learning for image classification, part 4
ECCV2010: feature learning for image classification, part 4
Survey Demo
Survey Demo
Introduction to Neural Netwoks
Introduction to Neural Netwoks
03 image transformations_i
03 image transformations_i
Tutorial on convolutional neural networks
Tutorial on convolutional neural networks
Lecture7 cross validation
Lecture7 cross validation
Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
Gradient Boosted Regression Trees in scikit-learn
Gradient Boosted Regression Trees in scikit-learn
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Multilayer Perceptron - Elisa Sayrol - UPC Barcelona 2018
Deep learning image classification aplicado al mundo de la moda
Deep learning image classification aplicado al mundo de la moda
Neural networks
Neural networks
Convolution Neural Network Lecture Slides
Convolution Neural Network Lecture Slides
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
Scaling Deep Learning with MXNet
Scaling Deep Learning with MXNet
Svm dbeth
Svm dbeth
06 spatial filtering DIP
06 spatial filtering DIP
畳み込みについて
畳み込みについて
Kürzlich hochgeladen
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
Romil Mishra
Virtual memory management in Operating System
Virtual memory management in Operating System
Rashmi Bhat
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
jennyeacort
welding defects observed during the welding
welding defects observed during the welding
MuhammadUzairLiaqat
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
Dr SOUNDIRARAJ N
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
bim.edu.pl
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
RajuKanojiya4
Transport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
GOPINATHS437943
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
HafizMudaserAhmad
Crystal Structure analysis and detailed information pptx
Crystal Structure analysis and detailed information pptx
achiever3003
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Dr.Costas Sachpazis
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
ssuserb6619e
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction Project
Erbil Polytechnic University
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
Alluxio, Inc.
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
Erbil Polytechnic University
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes examples
Dr. Gudipudi Nageswara Rao
multiple access in wireless communication
multiple access in wireless communication
panditadesh123
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.ppt
Narmatha D
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
Mebane Rash
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptx
NiranjanYadav41
Kürzlich hochgeladen
(20)
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
Virtual memory management in Operating System
Virtual memory management in Operating System
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
welding defects observed during the welding
welding defects observed during the welding
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
Transport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
Crystal Structure analysis and detailed information pptx
Crystal Structure analysis and detailed information pptx
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction Project
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes examples
multiple access in wireless communication
multiple access in wireless communication
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.ppt
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptx
Rabbit challenge 3 DNN Day2
1.
Rabbit Challenge 3-2 深層学習
DAY2 勾配消失問題、最適化アルゴリズム、CNN他
2.
目的 Rabbit Challengeの課題レポートとして、 学習内容をまとめる
3.
1.勾配消失問題と対策 2.最適化アルゴリズム 3.過学習と対策 4.畳み込みニューラルネットワーク(CNN) 5.実装演習 github情報
4.
1.1 勾配消失問題 正解率 エポック数 正解率 エポック数 エポック数が増えるごとに正解率が上昇 →正常に学習が進んでいる エポック数が増えても正解率が横ばい →勾配消失が生じている可能性が高い →パラメータがほとんど変わっていない状態
5.
1.2 対策1:活性化関数の改善 出力 シグモイド関数は、微分すると最大0.25 →これが何層も掛け合わされると ゼロに近くなる 入力 シグモイド関数:𝑓 𝑢
= 1 1+ⅇ−𝑢 微分 入力 0.25 微分
6.
1.2 対策1:活性化関数の改善 出力 シグモイド関数は、微分すると最大0.25 →これが何層も掛け合わされると ゼロに近くなる 入力 シグモイド関数:𝑓 𝑢
= 1 1+ⅇ−𝑢 微分 入力 0.25 Relu関数:𝑓 𝑢 = 𝑢 𝑢 ≥ 0 0 𝑢 < 0 出力 入力 微分 微分 1 中間層ではRelu関数を使うことで、 勾配消失を防止することができる ※スパース化(不要なところがゼロになる)にも貢献する
7.
1.3 対策2:重みの初期値改善 ※シグモイドやtanhを活性化関数に使った場合の出力は0 or
1 に偏りがちになる。これを微分した結果は0に近い値になる。 Xavierで初期化するとある程度のばらつきを持った値になる 名称 Xavier(ザビエル)※ He(ヒー) 内容 重みの初期値𝑤0を前の層のノード数 𝑛の平方根で除算した値にする 𝑤0 = 1 𝑛 重みの初期値𝑤0を前の層のノード数𝑛の 逆数を2倍した平方根にする 𝑤0 = 2 𝑛 使用される 活性化関数 シグモイド関数 tanh関数 Relu関数
8.
1.4 対策3:バッチ正規化 入力値の偏りを抑制するためミニバッチ単位で正規化する 以下、その手順を示す ①ミニバッチの平均を取る 𝜇𝑡
= 1 𝑁𝑡 𝑖 𝑁𝑡 𝑥𝑖 ②ミニバッチの分散を計算 σ𝑡 2 = 1 𝑁𝑡 𝑖 𝑁𝑡 (𝑥𝑖 − 𝜇𝑡)2 ③ミニバッチの正規化 𝑥𝑛𝑖 = 𝑥𝑛𝑖 − 𝜇𝑡 𝜎𝑡 2 + 𝜃 ④変倍の移動 𝑦𝑛𝑖 = 𝛾𝑥𝑛𝑖 + 𝛽 mu = X.mean(axis=0) xc = X - mu var = np.mean(xc**2, axis=0) std = np.sqrt(var + 1e-7) xn = xc/std out = gamma*xn + beta 実装例
9.
1.勾配消失問題と対策 2.最適化アルゴリズム 3.過学習と対策 4.畳み込みニューラルネットワーク(CNN) 5.実装演習 github情報
10.
2.1 学習最適化の指針 勾配降下法による重み更新 𝒘𝑘+1 =
𝒘𝑘 − ε 𝜕𝐸 𝒘 𝜕𝒘 =𝒘𝑘 − ε𝛻𝐸 重み更新の最適化の指針 初期の学習率εを大きく、その後徐々に小さくしていき、パラメータごとに学習率を変化させることで、 学習をスムーズに進める
11.
2.2 モメンタム 𝑽𝑘 =
𝜇𝑽𝑘−1 − ε𝛻𝐸 前回の𝐰の変化量に𝜇を掛けて加算する。移動平均のような動きをする。 局所解に停滞しにくい 𝒘𝑘+1 = 𝒘𝑘 + 𝑽𝑘 参考 【機械学習】パラメータ更新の最適化#モメンタム (𝜇を慣性項という) v[k] = momentum * v[k] - learning_rate * grad[k] 実装例 w[k] += v[k]
12.
2.3 AdaGrad ℎ𝑡 =
ℎ𝑡−1+(𝛻𝐸)2 勾配の緩やかな斜面に対して学習が進みやすいが、 大域最適解にたどり着かず、鞍点問題を引き起こしやすい(学習率が徐々に小さくなるため) 𝒘𝑡+1 = 𝒘𝑡 − 𝜀 1 ℎ𝑡 𝛻𝐸 参考 【機械学習】パラメータ更新の最適化#AdaGrad これまでの重みの更新の記憶 h[k] += grad[k]**2 実装例 w[k] - = (learning_rate * grad[k]) / np.sqrt(h[k] + 1e-7)
13.
2.4 RMSProp ℎ𝑡 =
𝛼ℎ𝑡−1+(1 − 𝛼)(𝛻𝐸)2 AdaGradの鞍点問題に陥りやすいデメリットを改善 AdaGradの場合の初期値をうまく調整する必要があったのに対し、 RMSPropはその調整が簡単になった。 𝒘𝑡+1 = 𝒘𝑡 − 𝜀 1 ℎ𝑡 𝛻𝐸 𝛼ℎ𝑡−1前回の重みの更新の記憶 (1 − 𝛼)(𝛻𝐸)2 今回の重み更新 h[k] *= decay_rate 実装例 w[k] - = (learning_rate * grad[k]) / np.sqrt(h[k] + 1e-7) こちらはAdaGradと一緒 #𝛼ℎ𝑡−1 h[k] +=(1 - decay_rate)*grad[k]**2 #(1 − 𝛼)(𝛻𝐸)2
14.
2.5 Adam 𝑚𝑡 =
𝛽1𝑚𝑡−1+(1 − 𝛽1)𝛻𝐸 モメンタム + RMSPropの良いところ取り 𝒘𝑡+1 = 𝒘𝑡 − 𝜀 1 𝑣𝑡 𝑚𝑡 勾配の1乗の記憶 m[k] += (1-beta1)*(grad[k] - m[k]) 実装例 w[k] - = (learning_rate * m[k]) / np.sqrt(v[k] + 1e-7) こちらはAdaGradやRMSPropと類似 (𝛻𝐸が前回の記憶値𝑚𝑡に代わっている) 𝑣𝑡 = 𝛽2𝑣𝑡−1+(1 − 𝛽2)(𝛻𝐸)2 勾配の2乗の記憶 m[k] = m[k] + (1-beta1)*(grad[k]) - (1-beta1)*m[k] = beta1*m[k] + (1-beta1)*(grad[k]) v[k] += (1-beta2)*(grad[k]**2 - v[k])
15.
2.6 各種アルゴリズムのまとめ https://postd.cc/optimizing-gradient-descent/
16.
1.勾配消失問題と対策 2.最適化アルゴリズム 3.過学習と対策 4.畳み込みニューラルネットワーク(CNN) 5.実装演習 github情報
17.
3.1 過学習とは 訓練誤差とテスト誤差の乖離 誤差 エポック数 訓練誤差 テスト誤差 例えば、自分で買った問題集で100点が取れるようになって、 いざ、本番の試験に臨んだ時に50点しか取れないような状態 原因:パラメータ数やノードが多すぎる(NNの自由度が高すぎる) データ数が少ない
18.
3.2 正則化 NNの自由度を抑制する方法の一つ あるノードの重みが大きい=学習において重要な点である =特定の重みがあまりに強調されすぎると過学習に陥る 正則化項を追加することで、重みを抑制し、かつ重みの大きさに多様性を持たせる 𝐸 𝑤
+ 1 𝑝 𝜆 𝑤 𝑝 ※𝑝ノルム : 𝑥 𝑝 = 𝑥1 𝑝 + ⋯ + 𝑥𝑛 𝑝 1 𝑝 誤差関数に𝑝ノルム 𝑤 𝑝(※)を加える 𝑝 = 1 のときL1正規化 (Lasso、スパース推定) 𝑝 = 2 のときL2正規化 (Ridge、縮小推定) p2ノルムはユークリッド距離 𝑤1 2 + 𝑤2 2 𝑤1 𝑤2 p1ノルムはマンハッタン距離𝑤1+ 𝑤2 まとめて誤差と考えて最小化する
19.
3.3 正則化 実装例 s[k]
= np.sign(w[k]) L1ノルム(Lasso)実装例 grad[k] += rate * s[k] 1 𝑝 𝜆 𝑤 𝑝 で𝑝 = 1ならば、𝑤は一次のみなので、 勾配すなわち微分を求めると𝜆 × ±1となる。 L2ノルム(Ridge)実装例 1 𝑝 𝜆 𝑤 𝑝 で𝑝 = 2ならば、𝑤は二次のみなので、 勾配すなわち微分を求めると𝜆 × 𝑤となる。 ここで、微分で出てきた係数は𝜆に吸収されると考えて良い grad[k] += rate * w[k]
20.
3.4 ドロップアウト NNの自由度を抑制する方法の一つ ノード自体をランダムに削除する 誤差 エポック数 誤差(ドロップアウト後) 誤差(ドロップアウト前) 過学習は抑制されるが、 ノードが減る事でデータ数が増えたことと同義となり 収束が遅くなることがある
21.
1.勾配消失問題と対策 2.最適化アルゴリズム 3.過学習と対策 4.畳み込みニューラルネットワーク(CNN) 5.実装演習 github情報
22.
4.1 CNN全体像 入力層 畳込み 層 プーリ ング層 プーリ ング層 畳込み 層 全結合 層 出力層 CNNのひとつLeNetの例 吹き出し内は人間による作業イメージ (32,32)
(28,28,6) (14,14,6) (10,10,16) (5,5,16) (120,) 全結合 層 (84,) (10,) http://yann.lecun.com/exdb/publis/pdf/lecun-99.pdf 6人が それぞれの感覚で特徴を 28x28の意見にまとめる 32x32画像 それぞれの人が 14x14に要約する その要約を使って 今度は16人で特徴を 10x10の意見にまとめる それぞれの人が 5x5に要約する 全員の要約意見を 一つにまとめる 10つのクラスのど れに該当するか結 果を示す
23.
4.2 畳み込み層(1) 元の画像の と、
との積・加算により を抽出 特徴マップ フィルタ(カーネル) 画素値 1 2 3 1 0 0 1 0 0 1 4 5 0 3 1 1 1 4 1 2 3 1 0 0 1 0 0 フィルタ(カーネル) 1 4 5 2 1 3 0 3 1 3 2 0 1 1 4 5 1 2 3 0 2 4 0 3 1 0 1 1 4 5 画像のpixel値 × = 1×1 + 4×2 + 5×3 + 0×1+ 3×0 +1×0 + 1×1 + 1×0 + 4×0 = 25 26 特徴マップ 各要素ごとの積を加算 フィルタは複数用意される フィルタ数はチャンネルという 重みとして学習で更新されていく 25 + 1 𝑓 𝑢 バイアス 活性化関数
24.
4.2 畳み込み層(2) 元の画像の と、
との積・加算により を抽出 特徴マップ フィルタ(カーネル) 画素値 1 2 3 1 0 0 1 0 0 4 5 3 1 1 4 1 2 3 1 0 0 1 0 0 フィルタ(カーネル) 1 4 5 2 1 3 0 3 1 3 2 0 1 1 4 5 1 2 3 0 2 4 0 3 1 0 1 1 4 5 画像のpixel値 × = 4×1 + 5×2 + 2×3 + 3×1+ 1×0 +3×0 + 1×1 + 4×0 + 5×0 = 24 26 25 特徴マップ 24 + 1 𝑓 𝑢 バイアス 活性化関数 2 3 5 フィルタをずらしながら演算 このことで次元間のつながりが保たれる ずらす幅をストライドという ストライドが大きくなると出力画像は小さくなる
25.
4.3 パディングと畳込み結果のサイズ 元画像の周囲にダミー画素を配置することをパディングという メリット ①端の画素の特徴も畳み込み演算に入れられる ②畳み込みを繰り返すことで特徴マップが小さくなりすぎることを防ぐ 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 4 5 2 1 3 0 3 1 3 2 0 1 1 4 5 1 2 3 0 2 4 0 3 1 0 1 1 4 5 特徴マップのサイズ 特徴マップの幅(高さ)= 元画像の幅 高さ + パディング数×2− フィルタ幅(高さ) ストライド幅(高さ) + 1 ※基本的には、元画像の幅(高さ)がストライド幅で割られたサイズになる。 ただし、パディングされると両幅分だけ元画像が大きくなる。 最後にフィルタ幅分引いて、1加算する
26.
4.4 プーリング層 プーリング=いくつかのグループを一つのグループにまとめること CNNでは特徴マップをいくつかのグループに分けて代表値を選択しサイズを縮小する(次元削減する)こと この部分に重みのような学習要素はない 1 2
3 1 0 0 1 0 0 フィルタ(カーネル) 1 4 5 2 1 3 0 3 1 3 2 0 1 1 4 5 1 2 3 0 2 4 0 3 1 0 1 1 4 5 画像のpixel値 25 24 17 21 13 15 19 16 19 24 20 18 特徴マップ 8 14 9 11 25 21 例:2x2の中の最大値を選択 (Maxプーリング) 24 20 プーリングのメリット 微小移動の影響を受けにくくなる (同じオブジェクトでも少しだけずれただけで、全く別物として学習されてしまうのを防ぐ) プーリング結果 プーリングの種類 Maxプーリング:フィルタ領域内の最大値 Averageプーリング:フィルタ領域内の平均値
27.
4.5 全結合層 「畳み込み」、「プーリング」を何度か行った後にデータをフラット化し、 通常のディープニューラルネットワークと同じ手法で学習する 全てのニューロンが結合しているから「全結合層」 Affine層(線形変換なので)、Dense層(密結合なので)、FC層(Fully Connected)などとも呼ばれる ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ また、全結合層の代わりにGlobal
Max Pooling/Global Average Poolingを用いることもある。 →これは、各チャネルの出力をPooling層同様、最大値、平均値でフィルタするものである。 1 2 3 1 0 0 1 0 0 例:最後のプーリング層の出力が、幅:3、高さ:3、層数:100だとして、 全結合層の入力は3×3×100=900となるが、 Global Max/Average Poolingだと、層数分が圧縮され3×3=9となる。 3 3 100
28.
4.6 実装 畳込み層の高速化施策 1
4 5 2 0 3 1 3 1 1 4 5 3 0 2 4 1 4 5 0 3 1 1 1 4 4 5 2 3 1 3 1 4 5 0 3 1 1 1 4 3 0 2 3 1 3 1 4 5 0 2 4 畳み込みされる領域をフィルタのサイズで区切って一列に並べる これにより、フィルタとの掛け算の和は単純な配列の積と和になる def im2col(input_data, filter_h, filter_w, stride=1, pad=0): N, C, H, W = input_data.shape out_h = ( (H + 2*pad - filter_h) // stride ) + 1 out_w = ( (W + 2*pad - filter_w) // stride ) + 1 img = np.pad( input_data, [(0,0), (0,0), (pad, pad), (pad, pad)], 'constant') col = np.zeros((N, C, filter_h, filter_w, out_h, out_w)) for y in range(filter_h): y_max = y + stride * out_h for x in range(filter_w): x_max = x + stride * out_w col[:, :, y, x, :, :] = img[:, :, y:y_max:stride, x:x_max:stride] # (N, C, filter_h, filter_w, out_h, out_w) - > (N, filter_w, out_h, out_w, C, filter_h) col = col.transpose(0, 4, 5, 1, 2, 3) col = col.reshape(N * out_h * out_w, -1) return col 畳み込みの出力データサイズを計算(上の例だと2×2) 元データにパディングを追加 この関数の出力配列(畳み込み領域を一列に並べた配列) フィルタ幅高さ分だけ一つずつずらすため、 一回の取り出しサイズの上限を計算 (上の例だと、y_max,x_maxとも2,3,4) 元の画像を(x:x_max)×(y:y_max)で取り出す(stride分飛ばしながら) フィルタサイズの幅高さに並べ替え、一列にreshape
29.
4.7 実装 プーリング層の逆伝播 Poolingクラス def
forward(self, x): N, C, H, W = x.shape out_h = int(1 + (H - self.pool_h) / self.stride) out_w = int(1 + (W - self.pool_w) / self.stride) # xを行列に変換 col = im2col(x, self.pool_h, self.pool_w, self.stride, self.pad) # プーリングのサイズに合わせてリサイズ col = col.reshape(-1, self.pool_h*self.pool_w) # 行ごとに最大値を求める arg_max = np.argmax(col, axis=1) out = np.max(col, axis=1) # 整形 out = out.reshape(N, out_h, out_w, C).transpose(0, 3, 1, 2) self.x = x self.arg_max = arg_max return out def backward(self, dout): dout = dout.transpose(0, 2, 3, 1) pool_size = self.pool_h * self.pool_w dmax = np.zeros((dout.size, pool_size)) dmax[np.arange(self.arg_max.size), self.arg_max.flatten()] = dout.flatten() dmax = dmax.reshape(dout.shape + (pool_size,)) dcol = dmax.reshape(dmax.shape[0] * dmax.shape[1] * dmax.shape[2], -1) dx = col2im(dcol, self.x.shape, self.pool_h, self.pool_w, self.stride, self.pad) return dx プーリングの出力データサイズを計算 高速化のために一行にする Maxプーリング処理 (argmaxは一行の中の最大値のindexが入る。) arg_max(index)の部分にdoutが入る (Reluの微分のような感じ)
30.
1.勾配消失問題と対策 2.最適化アルゴリズム 3.過学習と対策 4.畳み込みニューラルネットワーク(CNN) 5.実装演習 github情報
31.
5.1 実装演習 2層DNN MNISTデータをAffine-Relu-Affine-Softmaxで学習/検証 MNISTデータは所定の位置にある前提 モメンタム 最適化手法にモメンタムを使用 https://github.com/33quitykubby/Rabbit_DNN_1_2/blob/main/Rabbit_DNN_4_newtwork1.ipynb https://github.com/33quitykubby/Rabbit_DNN_1_2/blob/main/Rabbit_DNN_6_newtwork1_optimize_momentum.ipynb Adam 最適化手法にAdamを使用 https://github.com/33quitykubby/Rabbit_DNN_1_2/blob/main/Rabbit_DNN_7_newtwork1_optimize_adam.ipynb
32.
5.2 実装演習 L2ノルム(Ridge) 過学習対策としてL2ノルムの適用 Dropout 過学習対策としてDropoutを適用 https://github.com/33quitykubby/Rabbit_DNN_1_2/blob/main/Rabbit_DNN_9_newtwork1_L2norm.ipynb https://github.com/33quitykubby/Rabbit_DNN_1_2/blob/main/Rabbit_DNN_A_newtwork1_Dropout.ipynb CNN Convolution-Relu-Pooling-Affine-Relu-AffineのシンプルCNNの実装 https://github.com/33quitykubby/Rabbit_DNN_1_2/blob/main/Rabbit_CNN_1_simple.ipynb
Jetzt herunterladen