completed "Layer Types" section

This commit is contained in:
Clemens Dautermann 2020-01-17 23:28:10 +01:00
parent aaafd4b6f9
commit f20007b599
23 changed files with 389 additions and 131 deletions

View file

@ -86,22 +86,28 @@
\newlabel{Filter_output dargestellt}{{19}{14}{Die jeweils oben stehenden Filter wurden auf das Beispielbild angewandt.\relax }{figure.caption.17}{}} \newlabel{Filter_output dargestellt}{{19}{14}{Die jeweils oben stehenden Filter wurden auf das Beispielbild angewandt.\relax }{figure.caption.17}{}}
\@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {20}{\ignorespaces Beispiele f\IeC {\"u}r low- mid- und high-level Features in Convolutional Neural Nets\newline Quelle: https://tvirdi.github.io/2017-10-29/cnn/}}{15}{figure.caption.18}\protected@file@percent } \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {20}{\ignorespaces Beispiele f\IeC {\"u}r low- mid- und high-level Features in Convolutional Neural Nets\newline Quelle: https://tvirdi.github.io/2017-10-29/cnn/}}{15}{figure.caption.18}\protected@file@percent }
\newlabel{HL_features_conv}{{20}{15}{Beispiele für low- mid- und high-level Features in Convolutional Neural Nets\newline Quelle: https://tvirdi.github.io/2017-10-29/cnn/}{figure.caption.18}{}} \newlabel{HL_features_conv}{{20}{15}{Beispiele für low- mid- und high-level Features in Convolutional Neural Nets\newline Quelle: https://tvirdi.github.io/2017-10-29/cnn/}{figure.caption.18}{}}
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsubsection}{\numberline {3.7.2}Pooling Layers}{16}{subsubsection.3.7.2}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsubsection}{\numberline {3.7.2}Pooling Layers}{15}{subsubsection.3.7.2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {4}PyTorch}{16}{section.4}\protected@file@percent } \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {21}{\ignorespaces Max Pooling mit $2\times 2$ gro\IeC {\ss }en Submatritzen\newline Quelle: https://computersciencewiki.org/index.php/Max-pooling\_/\_Pooling CC BY NC SA Lizenz}}{16}{figure.caption.19}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Datenvorbereitung}{16}{subsection.4.1}\protected@file@percent } \newlabel{Maxpool}{{21}{16}{Max Pooling mit $2\times 2$ großen Submatritzen\newline Quelle: https://computersciencewiki.org/index.php/Max-pooling\_/\_Pooling\\ CC BY NC SA Lizenz}{figure.caption.19}{}}
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Definieren des Netzes}{16}{subsection.4.2}\protected@file@percent } \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {22}{\ignorespaces Average Pooling mit $2\times 2$ gro\IeC {\ss }en Submatritzen\newline Aus: Dominguez-Morales, Juan Pedro. (2018). Neuromorphic audio processing through real-time embedded spiking neural networks. Abbildung 33}}{16}{figure.caption.20}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{16}{subsection.4.3}\protected@file@percent } \newlabel{AvgPool}{{22}{16}{Average Pooling mit $2\times 2$ großen Submatritzen\newline Aus: Dominguez-Morales, Juan Pedro. (2018). Neuromorphic audio processing through real-time embedded spiking neural networks. Abbildung 33}{figure.caption.20}{}}
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{16}{section.5}\protected@file@percent } \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {23}{\ignorespaces Gegen\IeC {\"u}berstellung von Max und Average Pooling\relax }}{17}{figure.caption.21}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Aufgabe}{16}{subsection.5.1}\protected@file@percent } \newlabel{Pooling_Mnist}{{23}{17}{Gegenüberstellung von Max und Average Pooling\relax }{figure.caption.21}{}}
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{16}{subsection.5.2}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {4}PyTorch}{18}{section.4}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.3}Fragmentbasierte Erkennung}{16}{subsection.5.3}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Datenvorbereitung}{18}{subsection.4.1}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.4}Ergebnis}{16}{subsection.5.4}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Definieren des Netzes}{18}{subsection.4.2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{16}{section.6}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{18}{subsection.4.3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Das Prinzip}{16}{subsection.6.1}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{18}{section.5}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{16}{subsection.6.2}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Aufgabe}{18}{subsection.5.1}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{16}{subsection.6.3}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{18}{subsection.5.2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.4}Vergleich}{16}{subsection.6.4}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.3}Fragmentbasierte Erkennung}{18}{subsection.5.3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {7}Schlusswort}{16}{section.7}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.4}Ergebnis}{18}{subsection.5.4}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{18}{section.6}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Das Prinzip}{18}{subsection.6.1}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{18}{subsection.6.2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{18}{subsection.6.3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.4}Vergleich}{18}{subsection.6.4}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {7}Schlusswort}{18}{section.7}\protected@file@percent }
\bibcite{1}{1} \bibcite{1}{1}
\bibcite{2}{2} \bibcite{2}{2}
\bibcite{3}{3} \bibcite{3}{3}

View file

@ -40,3 +40,9 @@
\contentsline {figure}{\numberline {19}{\ignorespaces Die jeweils oben stehenden Filter wurden auf das Beispielbild angewandt.\relax }}{14}{figure.caption.17}% \contentsline {figure}{\numberline {19}{\ignorespaces Die jeweils oben stehenden Filter wurden auf das Beispielbild angewandt.\relax }}{14}{figure.caption.17}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {figure}{\numberline {20}{\ignorespaces Beispiele f\IeC {\"u}r low- mid- und high-level Features in Convolutional Neural Nets\newline Quelle: https://tvirdi.github.io/2017-10-29/cnn/}}{15}{figure.caption.18}% \contentsline {figure}{\numberline {20}{\ignorespaces Beispiele f\IeC {\"u}r low- mid- und high-level Features in Convolutional Neural Nets\newline Quelle: https://tvirdi.github.io/2017-10-29/cnn/}}{15}{figure.caption.18}%
\defcounter {refsection}{0}\relax
\contentsline {figure}{\numberline {21}{\ignorespaces Max Pooling mit $2\times 2$ gro\IeC {\ss }en Submatritzen\newline Quelle: https://computersciencewiki.org/index.php/Max-pooling\_/\_Pooling CC BY NC SA Lizenz}}{16}{figure.caption.19}%
\defcounter {refsection}{0}\relax
\contentsline {figure}{\numberline {22}{\ignorespaces Average Pooling mit $2\times 2$ gro\IeC {\ss }en Submatritzen\newline Aus: Dominguez-Morales, Juan Pedro. (2018). Neuromorphic audio processing through real-time embedded spiking neural networks. Abbildung 33}}{16}{figure.caption.20}%
\defcounter {refsection}{0}\relax
\contentsline {figure}{\numberline {23}{\ignorespaces Gegen\IeC {\"u}berstellung von Max und Average Pooling\relax }}{17}{figure.caption.21}%

View file

@ -1,4 +1,4 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdflatex 2019.12.27) 15 JAN 2020 22:21 This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdflatex 2019.12.27) 17 JAN 2020 23:24
entering extended mode entering extended mode
restricted \write18 enabled. restricted \write18 enabled.
%&-line parsing enabled. %&-line parsing enabled.
@ -1487,29 +1487,37 @@ File: ../graphics/mnist_5/mnist_5_raw.png Graphic file (type png)
Package pdftex.def Info: ../graphics/mnist_5/mnist_5_raw.png used on input lin Package pdftex.def Info: ../graphics/mnist_5/mnist_5_raw.png used on input lin
e 352. e 352.
(pdftex.def) Requested size: 172.5pt x 129.37639pt. (pdftex.def) Requested size: 172.5pt x 129.37639pt.
<../graphics/mnist_5/mnist_5_upper_edges.png, id=328, 462.528pt x 346.896pt> <../graphics/mnist_5/conv_only/mnist_5_upper_edges.png, id=328, 462.528pt x 346
File: ../graphics/mnist_5/mnist_5_upper_edges.png Graphic file (type png) .896pt>
<use ../graphics/mnist_5/mnist_5_upper_edges.png> File: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png Graphic file (type
Package pdftex.def Info: ../graphics/mnist_5/mnist_5_upper_edges.png used on i png)
nput line 361. <use ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png
used on input line 361.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/mnist_5_left_edges.png, id=329, 462.528pt x 346.896pt> <../graphics/mnist_5/conv_only/mnist_5_left_edges.png, id=329, 462.528pt x 346.
File: ../graphics/mnist_5/mnist_5_left_edges.png Graphic file (type png) 896pt>
<use ../graphics/mnist_5/mnist_5_left_edges.png> File: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png Graphic file (type p
Package pdftex.def Info: ../graphics/mnist_5/mnist_5_left_edges.png used on in ng)
put line 366. <use ../graphics/mnist_5/conv_only/mnist_5_left_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png
used on input line 366.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/mnist_5_lower_edges.png, id=330, 462.528pt x 346.896pt> <../graphics/mnist_5/conv_only/mnist_5_lower_edges.png, id=330, 462.528pt x 346
File: ../graphics/mnist_5/mnist_5_lower_edges.png Graphic file (type png) .896pt>
<use ../graphics/mnist_5/mnist_5_lower_edges.png> File: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png Graphic file (type
Package pdftex.def Info: ../graphics/mnist_5/mnist_5_lower_edges.png used on i png)
nput line 371. <use ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png
used on input line 371.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/mnist_5_right_edges.png, id=331, 462.528pt x 346.896pt> <../graphics/mnist_5/conv_only/mnist_5_right_edges.png, id=331, 462.528pt x 346
File: ../graphics/mnist_5/mnist_5_right_edges.png Graphic file (type png) .896pt>
<use ../graphics/mnist_5/mnist_5_right_edges.png> File: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png Graphic file (type
Package pdftex.def Info: ../graphics/mnist_5/mnist_5_right_edges.png used on i png)
nput line 376. <use ../graphics/mnist_5/conv_only/mnist_5_right_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png
used on input line 376.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/features.png, id=334, 833.1125pt x 388.45125pt> <../graphics/features.png, id=334, 833.1125pt x 388.45125pt>
File: ../graphics/features.png Graphic file (type png) File: ../graphics/features.png Graphic file (type png)
@ -1517,23 +1525,135 @@ File: ../graphics/features.png Graphic file (type png)
Package pdftex.def Info: ../graphics/features.png used on input line 387. Package pdftex.def Info: ../graphics/features.png used on input line 387.
(pdftex.def) Requested size: 345.0pt x 160.86047pt. (pdftex.def) Requested size: 345.0pt x 160.86047pt.
Underfull \hbox (badness 10000) in paragraph at lines 298--393 Underfull \hbox (badness 10000) in paragraph at lines 298--394
[] []
[14 <../graphics/mnist_5/mnist_5_raw.png> <../graphics/mnist_5/mnist_5_upper_ed [14 <../graphics/mnist_5/mnist_5_raw.png> <../graphics/mnist_5/conv_only/mnist_
ges.png> <../graphics/mnist_5/mnist_5_left_edges.png> <../graphics/mnist_5/mnis 5_upper_edges.png> <../graphics/mnist_5/conv_only/mnist_5_left_edges.png> <../g
t_5_lower_edges.png> <../graphics/mnist_5/mnist_5_right_edges.png>] raphics/mnist_5/conv_only/mnist_5_lower_edges.png> <../graphics/mnist_5/conv_on
ly/mnist_5_right_edges.png>] [15 <../graphics/features.png>]
<../graphics/MaxpoolSample2.png, id=355, 164.25pt x 68.547pt>
File: ../graphics/MaxpoolSample2.png Graphic file (type png)
<use ../graphics/MaxpoolSample2.png>
Package pdftex.def Info: ../graphics/MaxpoolSample2.png used on input line 405
.
(pdftex.def) Requested size: 241.49895pt x 100.79422pt.
<../graphics/Average-Pooling-Example.png, id=356, 746.79pt x 337.26pt>
File: ../graphics/Average-Pooling-Example.png Graphic file (type png)
<use ../graphics/Average-Pooling-Example.png>
Package pdftex.def Info: ../graphics/Average-Pooling-Example.png used on input
line 413.
(pdftex.def) Requested size: 241.49895pt x 109.0627pt.
File: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png Graphic file (type
png)
<use ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png
used on input line 423.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
File: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png Graphic file (type p
ng)
<use ../graphics/mnist_5/conv_only/mnist_5_left_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png
used on input line 428.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
File: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png Graphic file (type
png)
<use ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png
used on input line 433.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
File: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png Graphic file (type
png)
<use ../graphics/mnist_5/conv_only/mnist_5_right_edges.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png
used on input line 438.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/upper_horiz_pooled.png, id=358, 462.528pt x 346.
896pt>
File: ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png Graphic file (type p
ng)
<use ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png
used on input line 443.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/left_vert_pooled.png, id=359, 462.528pt x 346.89
6pt>
File: ../graphics/mnist_5/conv_pool/left_vert_pooled.png Graphic file (type png
)
<use ../graphics/mnist_5/conv_pool/left_vert_pooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/left_vert_pooled.png us
ed on input line 448.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/lower_horiz_pooled.png, id=360, 462.528pt x 346.
896pt>
File: ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png Graphic file (type p
ng)
<use ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png
used on input line 453.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/right_vert_pooled.png, id=361, 462.528pt x 346.8
96pt>
File: ../graphics/mnist_5/conv_pool/right_vert_pooled.png Graphic file (type pn
g)
<use ../graphics/mnist_5/conv_pool/right_vert_pooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/right_vert_pooled.png u
sed on input line 458.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png, id=362, 462.528pt x 3
46.896pt>
File: ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png Graphic file (typ
e png)
<use ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.pn
g used on input line 463.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/left_vert_avgpooled.png, id=363, 462.528pt x 346
.896pt>
File: ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png Graphic file (type
png)
<use ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png
used on input line 468.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png, id=364, 462.528pt x 3
46.896pt>
File: ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png Graphic file (typ
e png)
<use ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.pn
g used on input line 473.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/right_vert_avgpooled.png, id=365, 462.528pt x 34
6.896pt>
File: ../graphics/mnist_5/conv_pool/right_vert_avgpooled.png Graphic file (type
png)
<use ../graphics/mnist_5/conv_pool/right_vert_avgpooled.png>
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/right_vert_avgpooled.png
used on input line 478.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt.
Underfull \hbox (badness 10000) in paragraph at lines 401--484
[]
[16 <../graphics/MaxpoolSample2.png> <../graphics/Average-pooling-example.png>]
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 398. (hyperref) removing `\newline' on input line 488.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 403. (hyperref) removing `\newline' on input line 493.
[15 <../graphics/features.png>] [16] [17 <../graphics/mnist_5/conv_pool/upper_horiz_pooled.png> <../graphics/mnist_5
Underfull \hbox (badness 10000) in paragraph at lines 420--424 /conv_pool/left_vert_pooled.png> <../graphics/mnist_5/conv_pool/lower_horiz_poo
led.png> <../graphics/mnist_5/conv_pool/right_vert_pooled.png> <../graphics/mni
st_5/conv_pool/upper_horiz_avgpooled.png> <../graphics/mnist_5/conv_pool/left_v
ert_avgpooled.png> <../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png> <.
./graphics/mnist_5/conv_pool/right_vert_avgpooled.png>] [18]
Underfull \hbox (badness 10000) in paragraph at lines 510--514
\T1/LinuxBiolinumT-TLF/m/n/10 Quelle: https://towardsdatascience.com/common-los \T1/LinuxBiolinumT-TLF/m/n/10 Quelle: https://towardsdatascience.com/common-los
s-functions-in-machine- s-functions-in-machine-
[] []
@ -1544,22 +1664,28 @@ Overfull \hbox (21.8196pt too wide) in paragraph at lines 28--28
b/master/README.md b/master/README.md
[] []
[17] [19]
Overfull \hbox (5.42265pt too wide) in paragraph at lines 42--42 Overfull \hbox (5.42265pt too wide) in paragraph at lines 42--42
[][] [][]\T1/LinuxBiolinumT-TLF/m/n/10 Beispiele für low- mid- und high-level [][] [][]\T1/LinuxBiolinumT-TLF/m/n/10 Beispiele für low- mid- und high-level
Fea-tu-res in Con-vo-lu-tio-nal Neural Fea-tu-res in Con-vo-lu-tio-nal Neural
[] []
Overfull \hbox (23.8891pt too wide) in paragraph at lines 44--44
\T1/LinuxBiolinumT-TLF/m/n/10 Quelle: https://computersciencewiki.org/index.ph
p/Max-pooling_/_Pooling
[]
) )
\tf@lof=\write7 \tf@lof=\write7
\openout7 = `Grundlagen_des_maschinellen_lernens.lof'. \openout7 = `Grundlagen_des_maschinellen_lernens.lof'.
[18] [20]
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 427. Package atveryend Info: Empty hook `BeforeClearDocument' on input line 517.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 427. Package atveryend Info: Empty hook `AfterLastShipout' on input line 517.
(./Grundlagen_des_maschinellen_lernens.aux) (./Grundlagen_des_maschinellen_lernens.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 427. Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 517.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 427. Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 517.
Package rerunfilecheck Info: File `Grundlagen_des_maschinellen_lernens.out' has Package rerunfilecheck Info: File `Grundlagen_des_maschinellen_lernens.out' has
not changed. not changed.
(rerunfilecheck) Checksum: B310243FE389BD4A3D39E25B868838EA;2989. (rerunfilecheck) Checksum: B310243FE389BD4A3D39E25B868838EA;2989.
@ -1578,10 +1704,10 @@ un.xml'.
) )
Here is how much of TeX's memory you used: Here is how much of TeX's memory you used:
38343 strings out of 492615 38406 strings out of 492615
854737 string characters out of 6131389 857459 string characters out of 6131389
1381825 words of memory out of 5000000 1382290 words of memory out of 5000000
41550 multiletter control sequences out of 15000+600000 41593 multiletter control sequences out of 15000+600000
83070 words of font info for 118 fonts, out of 8000000 for 9000 83070 words of font info for 118 fonts, out of 8000000 for 9000
1143 hyphenation exceptions out of 8191 1143 hyphenation exceptions out of 8191
62i,14n,100p,1509b,3444s stack positions out of 5000i,500n,10000p,200000b,80000s 62i,14n,100p,1509b,3444s stack positions out of 5000i,500n,10000p,200000b,80000s
@ -1597,11 +1723,11 @@ hare/texlive/texmf-dist/fonts/type1/urw/times/utmb8a.pfb></usr/share/texlive/te
xmf-dist/fonts/type1/urw/times/utmr8a.pfb></usr/share/texlive/texmf-dist/fonts/ xmf-dist/fonts/type1/urw/times/utmr8a.pfb></usr/share/texlive/texmf-dist/fonts/
type1/urw/times/utmr8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times type1/urw/times/utmr8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times
/utmri8a.pfb> /utmri8a.pfb>
Output written on Grundlagen_des_maschinellen_lernens.pdf (19 pages, 1088555 by Output written on Grundlagen_des_maschinellen_lernens.pdf (21 pages, 1178389 by
tes). tes).
PDF statistics: PDF statistics:
465 PDF objects out of 1000 (max. 8388607) 512 PDF objects out of 1000 (max. 8388607)
409 compressed objects within 5 object streams 434 compressed objects within 5 object streams
93 named destinations out of 1000 (max. 500000) 101 named destinations out of 1000 (max. 500000)
383 words of extra memory for PDF output out of 10000 (max. 10000000) 433 words of extra memory for PDF output out of 10000 (max. 10000000)

View file

@ -358,22 +358,22 @@ beispielsweise zur einfachen Kantenerkennung genutzt werden. Zur Veranschaulichu
\begin{figure}[h] \begin{figure}[h]
\begin{minipage}{0.2\linewidth} \begin{minipage}{0.2\linewidth}
\centering \centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/mnist_5_upper_edges.png} \includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_upper_edges.png}
\end{minipage} \end{minipage}
\hfill \hfill
\begin{minipage}{0.2\linewidth} \begin{minipage}{0.2\linewidth}
\centering \centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/mnist_5_left_edges.png} \includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_left_edges.png}
\end{minipage} \end{minipage}
\hfill \hfill
\begin{minipage}{0.2\linewidth} \begin{minipage}{0.2\linewidth}
\centering \centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/mnist_5_lower_edges.png} \includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_lower_edges.png}
\end{minipage} \end{minipage}
\hfill \hfill
\begin{minipage}{0.2\linewidth} \begin{minipage}{0.2\linewidth}
\centering \centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/mnist_5_right_edges.png} \includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_right_edges.png}
\end{minipage} \end{minipage}
\caption{Die jeweils oben stehenden Filter wurden auf das Beispielbild angewandt.} \caption{Die jeweils oben stehenden Filter wurden auf das Beispielbild angewandt.}
\label{Filter_output dargestellt} \label{Filter_output dargestellt}
@ -382,15 +382,105 @@ beispielsweise zur einfachen Kantenerkennung genutzt werden. Zur Veranschaulichu
Der jeweils dunkel dargestellte Bereich kann als das identifiziert werden, was vom convolutional Layer als Kante erkannt wurde. Hier werden eindeutige Limitationen deutlich: Es kann nur als Kante erkannt werden, was auch eindeutig senkrecht oder waagerecht ist. Außerdem kann es zu Fehlentscheidungen kommen.\\ Der jeweils dunkel dargestellte Bereich kann als das identifiziert werden, was vom convolutional Layer als Kante erkannt wurde. Hier werden eindeutige Limitationen deutlich: Es kann nur als Kante erkannt werden, was auch eindeutig senkrecht oder waagerecht ist. Außerdem kann es zu Fehlentscheidungen kommen.\\
Die Kernels werden natürlich nicht per Hand initialisiert und angepasst, sondern setzen sich aus Parameternm zusammen, die im Laufe des Lernprozesses durch das Netz anpassbar sind. Das Netz kann also die Filtermatrix selber verändern. Die Filter werden meißt mit Zufallswerten initialisiert und dann während des Lernens angepasst. Ferner muss ein Kernel auch nicht immer drei Einheiten breit sein, sondern kann jede Größe $\ge2$ annehmen. Je nachdem, wie sich der Kernel über die Eingabematrix bewegt, ist außerdem ein sogenanntes \glqq Padding'' nötig, da gegebenenfalls Werte betrachtet werden müssten, die nicht in der Eingabematrix liegen. In der Regel werden daher alle Werte, die nicht in der Eingabematrix vorhanden sind durch 0 ersetzt. Das Padding ist in Abbildung \ref{Convolution_illustration} als weiß in der Eingabematrix dargestellt. Es ist eine Art \glqq Rand aus Nullen'', der um dasd Bild gelegt wird.\\ Die Kernels werden natürlich nicht per Hand initialisiert und angepasst, sondern setzen sich aus Parameternm zusammen, die im Laufe des Lernprozesses durch das Netz anpassbar sind. Das Netz kann also die Filtermatrix selber verändern. Die Filter werden meißt mit Zufallswerten initialisiert und dann während des Lernens angepasst. Ferner muss ein Kernel auch nicht immer drei Einheiten breit sein, sondern kann jede Größe $\ge2$ annehmen. Je nachdem, wie sich der Kernel über die Eingabematrix bewegt, ist außerdem ein sogenanntes \glqq Padding'' nötig, da gegebenenfalls Werte betrachtet werden müssten, die nicht in der Eingabematrix liegen. In der Regel werden daher alle Werte, die nicht in der Eingabematrix vorhanden sind durch 0 ersetzt. Das Padding ist in Abbildung \ref{Convolution_illustration} als weiß in der Eingabematrix dargestellt. Es ist eine Art \glqq Rand aus Nullen'', der um dasd Bild gelegt wird.\\
\\ \\
Hintereinander können convolutional Layers auch ganze Elemente eines Bildes erkennen. Erkennt das erste Layer wie oben gezeigt beispielsweise Kanten, so kann das Layer darauf Kombinationen aus diesen, wie beispielsweise Ecken oder Winkel, erkennen. Wie gefilterte Bilder für sogenannte \glqq High-Level-Features'' aussehen können ist in Abbilldung \ref{HL_features_conv} dargestellt. Hintereinander können convolutional Layers auch ganze Elemente eines Bildes erkennen. Erkennt das erste Layer wie oben gezeigt beispielsweise Kanten, so kann das Layer darauf Kombinationen aus diesen, wie beispielsweise Ecken oder Winkel, erkennen. Wie gefilterte Bilder für sogenannte \glqq High-Level-Features'' aussehen können ist in Abbilldung \ref{HL_features_conv} dargestellt. Die Ausgabebilder von Convolutional Layers werden als \glqq Feature map'' bezeichnet.
\begin{figure}[h] \begin{figure}[h]
\includegraphics[width=\linewidth]{../graphics/features.png} \includegraphics[width=\linewidth]{../graphics/features.png}
\caption[Beispiele für low- mid- und high-level Features in Convolutional Neural Nets\newline \caption[Beispiele für low- mid- und high-level Features in Convolutional Neural Nets\newline
Quelle: https://tvirdi.github.io/2017-10-29/cnn/]{Beispiele für low- mid- und high-level Features in Convolutional Neural Nets} Quelle: https://tvirdi.github.io/2017-10-29/cnn/]{Beispiele für low- mid- und high-level Features in Convolutional Neural Nets}
\label{HL_features_conv} \label{HL_features_conv}
\end{figure} \end{figure}
\\
Das bemerkenswerte an Convolutional Layers ist vor allem, dass duch ähnliche Optimierungsalgorytmen auch hier maschinelles lernen möglich ist, dass sich ein neuronales Netz diese Filter also selbstständig beibringen kann. Das bemerkenswerte an Convolutional Layers ist vor allem, dass duch ähnliche Optimierungsalgorytmen auch hier maschinelles lernen möglich ist, dass sich ein neuronales Netz diese Filter also selbstständig beibringen kann.
\subsubsection{Pooling Layers} \subsubsection{Pooling Layers}
Pooling Layers werden ebenfalls hauptsächlich in Convolutional Neural Networks verwendet. Sie werden nach Convolutional Layers genutzt um das Ausgabebild herunterzutakten, also verlustbehaftet zu Komprimieren. Dabei wird die Feature Map im wesentlichen zusammengefasst um die Datenmenge, die das Folgende Convolutional Layer erhält zu reduzieren und sie Verschiebungen im Originalbild gegenüber immuner zu machen. Das ist deshalb notwendig, da die Convolutional Layers die Features lokal sehr begrenzt erkennen und daher eine kleine Verschiebung des Originalbildes zur Folge haben kann, dass im Folgenden Convolutional Layer die Kombination der Features gegebenenfalls nicht richtig erkannt wird. Das Pooling Layer kann diesem Effekt entgegenwirken, indem es die Features zusammenfasst. So kann aus einer ganzen Kante beispielsweise ein einziger Pixel werden.\\
Es werden im Wesentlichen zwei Techniken zum Pooling eingesetzt.
\begin{enumerate}
\item Max Pooling (Abbildung \ref{Maxpool})
\item Average Pooling (Abbildung \ref{AvgPool})
\end{enumerate}
Sie unterscheiden sich darin, wie die zu komprimierenden Werte mit einander verrechnet werden, sind ansonsten jedoch identisch.\\
Beim Pooling wird die Eingabematrix in Submatritzen partitioniert\footnote{Hier ist die Mengenteorethische Partitionierung gemeint. Eine Menge wird in nicht leere Teilmengen unterteilt, sodass jedes Element der Ausgangsmenge in genau einer der Teilmengen enthalten ist.}. Jede Submatrix stellt später einen Pixel in der Ausgabematrix dar. Hier unterscheiden sich jetzt Max- und Avarage- Pooling. Beim Max Pooling ist der neue Wert der höhste Wert aus dieser Submatrix, beim Avarage Pooling wird der Durchschnitt aller Werte Der Submatrix gebildet und als Neuer Wert verwendet.
\begin{figure}[h]
\centering
\includegraphics[width=0.7\linewidth]{../graphics/MaxpoolSample2.png}
\caption[Max Pooling mit $2\times2$ großen Submatritzen\newline
Quelle: https://computersciencewiki.org/index.php/Max-pooling\_/\_Pooling\\
CC BY NC SA Lizenz]{Max Pooling mit $2\times2$ großen Submatritzen}
\label{Maxpool}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[width=0.7\linewidth]{../graphics/Average-Pooling-Example.png}
\caption[Average Pooling mit $2\times2$ großen Submatritzen\newline
Aus: Dominguez-Morales, Juan Pedro. (2018). Neuromorphic audio processing through real-time embedded spiking neural networks. Abbildung 33]{Average Pooling mit $2\times2$ großen Submatritzen}
\label{AvgPool}
\end{figure}
\\
Die Dimension der Submatritzen beträgt meißt $2\times2$. In Abbildung \ref{Pooling_Mnist} ist dargestellt, wie Pooling konkret auf das im letzten Abschnitt beschriebene Bild abgewandt aussieht. Dafür sind in der ersten Zeile die $28\times28$ Pixel großen Bilder dargestellt, die das Convolutional Layer mit Hilfe der Kantenerkennungsfilter berechnet hat. In Zeile zwei wurde auf die jeweils darüber stehenden Bilder Max Pooling angewandt, in Zeile drei auf die selben Bilder Average Pooling. Die Bilder sind nach dem Pooling $14\times14$ Pixel groß.
\begin{figure}[h]
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_upper_edges.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_left_edges.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_lower_edges.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_only/mnist_5_right_edges.png}
\end{minipage}
\\
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/upper_horiz_pooled.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/left_vert_pooled.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/lower_horiz_pooled.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/right_vert_pooled.png}
\end{minipage}
\\
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/left_vert_avgpooled.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png}
\end{minipage}
\hfill
\begin{minipage}{0.2\linewidth}
\centering
\includegraphics[width=\linewidth]{../graphics/mnist_5/conv_pool/right_vert_avgpooled.png}
\end{minipage}
\caption{Gegenüberstellung von Max und Average Pooling}
\label{Pooling_Mnist}
\end{figure}
\\
\section{PyTorch} \section{PyTorch}
\subsection{Datenvorbereitung} \subsection{Datenvorbereitung}
\subsection{Definieren des Netzes} \subsection{Definieren des Netzes}

View file

@ -49,34 +49,34 @@
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsubsection}{\numberline {3.7.1}Convolutional Layers}{13}{subsubsection.3.7.1}% \contentsline {subsubsection}{\numberline {3.7.1}Convolutional Layers}{13}{subsubsection.3.7.1}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsubsection}{\numberline {3.7.2}Pooling Layers}{16}{subsubsection.3.7.2}% \contentsline {subsubsection}{\numberline {3.7.2}Pooling Layers}{15}{subsubsection.3.7.2}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {4}PyTorch}{16}{section.4}% \contentsline {section}{\numberline {4}PyTorch}{18}{section.4}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {4.1}Datenvorbereitung}{16}{subsection.4.1}% \contentsline {subsection}{\numberline {4.1}Datenvorbereitung}{18}{subsection.4.1}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {4.2}Definieren des Netzes}{16}{subsection.4.2}% \contentsline {subsection}{\numberline {4.2}Definieren des Netzes}{18}{subsection.4.2}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{16}{subsection.4.3}% \contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{18}{subsection.4.3}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{16}{section.5}% \contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{18}{section.5}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.1}Aufgabe}{16}{subsection.5.1}% \contentsline {subsection}{\numberline {5.1}Aufgabe}{18}{subsection.5.1}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{16}{subsection.5.2}% \contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{18}{subsection.5.2}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.3}Fragmentbasierte Erkennung}{16}{subsection.5.3}% \contentsline {subsection}{\numberline {5.3}Fragmentbasierte Erkennung}{18}{subsection.5.3}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.4}Ergebnis}{16}{subsection.5.4}% \contentsline {subsection}{\numberline {5.4}Ergebnis}{18}{subsection.5.4}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{16}{section.6}% \contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{18}{section.6}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.1}Das Prinzip}{16}{subsection.6.1}% \contentsline {subsection}{\numberline {6.1}Das Prinzip}{18}{subsection.6.1}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{16}{subsection.6.2}% \contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{18}{subsection.6.2}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{16}{subsection.6.3}% \contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{18}{subsection.6.3}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.4}Vergleich}{16}{subsection.6.4}% \contentsline {subsection}{\numberline {6.4}Vergleich}{18}{subsection.6.4}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {7}Schlusswort}{16}{section.7}% \contentsline {section}{\numberline {7}Schlusswort}{18}{section.7}%

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
graphics/MaxpoolSample2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -1,50 +0,0 @@
import torch
import PIL
import numpy
from torchvision import transforms, datasets
import matplotlib.pyplot as plt
def frobdot(mat1, mat2):
return mat1[0][0] * mat2[0][0] + mat1[0][1] * mat2[0][1] + mat1[0][2] * mat2[0][2] + mat1[1][0] * mat2[1][0] + \
mat1[1][1] * mat2[1][1] + mat1[1][2] * mat2[1][2] + mat1[2][0] * mat2[2][0] + mat1[2][1] * mat2[2][1] + \
mat1[2][2] * mat2[2][2]
data = datasets.MNIST('../datasets', train=True, download=True,
transform=transforms.Compose([
transforms.ToTensor()
]))
loader = torch.utils.data.DataLoader(data, batch_size=1, shuffle=False)
examples = enumerate(loader)
batch_idx, (example_data, example_targets) = next(examples)
raw_img = example_data[0][0]
new_img = numpy.zeros((28, 28))
kernel = numpy.array([[1, 20, 1],
[20, 0, 20],
[1, 20, 1]])
print(new_img.shape)
for y, line in enumerate(raw_img):
for x, value in enumerate(line):
tempmat = numpy.zeros((3, 3))
possible_positions = [[y + 1, x - 1], [y + 1, x], [y + 1, x + 1], [y, x - 1], [y, x], [y, x + 1],
[y - 1, x - y], [y - 1, x], [y - 1, x - 1]]
n = -1
for i, pos in enumerate(possible_positions):
if i % 3 is 0:
n += 1
if (pos[0] < 0) or (pos[0] > 27) or (pos[1] < 0) or (pos[1] > 27):
tempmat[n][i % 3] = 0
else:
tempmat[n][i % 3] = raw_img[pos[0]][pos[1]]
new_img[y][x] = frobdot(tempmat, kernel)
plt.xticks([])
plt.yticks([])
plt.imshow(new_img, cmap='gray')
plt.show()

View file

@ -0,0 +1,80 @@
import torch
import PIL
import numpy
from torchvision import transforms, datasets
import matplotlib.pyplot as plt
def frobdot(mat1, mat2):
return mat1[0][0] * mat2[0][0] + mat1[0][1] * mat2[0][1] + mat1[0][2] * mat2[0][2] + mat1[1][0] * mat2[1][0] + \
mat1[1][1] * mat2[1][1] + mat1[1][2] * mat2[1][2] + mat1[2][0] * mat2[2][0] + mat1[2][1] * mat2[2][1] + \
mat1[2][2] * mat2[2][2]
data = datasets.MNIST('../datasets', train=True, download=True,
transform=transforms.Compose([
transforms.ToTensor()
]))
loader = torch.utils.data.DataLoader(data, batch_size=1, shuffle=False)
examples = enumerate(loader)
batch_idx, (example_data, example_targets) = next(examples)
raw_img = example_data[0][0]
def convolve(raw_img, kernel):
new_img = numpy.zeros((28, 28))
for y, line in enumerate(raw_img):
for x, value in enumerate(line):
tempmat = numpy.zeros((3, 3))
possible_positions = [[y + 1, x - 1], [y + 1, x], [y + 1, x + 1], [y, x - 1], [y, x], [y, x + 1],
[y - 1, x - y], [y - 1, x], [y - 1, x - 1]]
n = -1
for i, pos in enumerate(possible_positions):
if i % 3 is 0:
n += 1
if (pos[0] < 0) or (pos[0] > 27) or (pos[1] < 0) or (pos[1] > 27):
tempmat[n][i % 3] = 0
else:
tempmat[n][i % 3] = raw_img[pos[0]][pos[1]]
new_img[y][x] = frobdot(tempmat, kernel)
return new_img
def maxpool(raw_image):
new_img = numpy.zeros((14, 14))
new_y = -1
for y in range(0, 28, 2):
new_x = -1
new_y += 1
for x in range(0, 28, 2):
new_x += 1
new_img[new_y][new_x] = max(
[raw_image[y][x], raw_image[y][x + 1], raw_image[y + 1][x], raw_image[y + 1][x + 1]])
return new_img
def avgpool(raw_image):
new_img = numpy.zeros((14, 14))
new_y = -1
for y in range(0, 28, 2):
new_x = -1
new_y += 1
for x in range(0, 28, 2):
new_x += 1
new_img[new_y][new_x] = sum(
[raw_image[y][x], raw_image[y][x + 1], raw_image[y + 1][x], raw_image[y + 1][x + 1]]) / 4
return new_img
kernel = numpy.array([[-1, -1, -1],
[1, 1, 1],
[0, 0, 0]])
plt.xticks([])
plt.yticks([])
plt.imshow(avgpool(convolve(raw_img, kernel)), cmap='gray')
plt.show()