update on week42

This commit is contained in:
mhjensen
2020-10-12 22:50:31 +02:00
parent ba48ed5f53
commit 1c928b64ac
32 changed files with 2251 additions and 1990 deletions
+60 -58
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -192,7 +194,7 @@ MathJax.Hub.Config({
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Oct 11, 2020</h4></center> <!-- date -->
<center><h4>Oct 12, 2020</h4></center> <!-- date -->
<br>
<p>
@@ -216,7 +218,7 @@ MathJax.Hub.Config({
<li><a href="._week42-bs008.html">9</a></li>
<li><a href="._week42-bs009.html">10</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+59 -57
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -200,7 +202,7 @@ extbooks/TensorflowML.pdf" target="_self">Aurelien Geron's chapters 13 and 14</a
<li><a href="._week42-bs009.html">10</a></li>
<li><a href="._week42-bs010.html">11</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs002.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+59 -57
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -227,7 +229,7 @@ Another good read is the article here <a href="https://arxiv.org/pdf/1603.07285.
<li><a href="._week42-bs010.html">11</a></li>
<li><a href="._week42-bs011.html">12</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs003.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+86 -75
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,30 +175,39 @@ MathJax.Hub.Config({
<a name="part0003"></a>
<!-- !split -->
<h2 id="___sec2" class="anchor">Regular NNs don&#8217;t scale well to full images </h2>
<h2 id="___sec2" class="anchor">Neural Networks vs CNNs </h2>
<p>
As an example, consider
an image of size \( 32\times 32\times 3 \) (32 wide, 32 high, 3 color channels), so a
single fully-connected neuron in a first hidden layer of a regular
Neural Network would have \( 32\times 32\times 3 = 3072 \) weights. This amount still
seems manageable, but clearly this fully-connected structure does not
scale to larger images. For example, an image of more respectable
size, say \( 200\times 200\times 3 \), would lead to neurons that have
\( 200\times 200\times 3 = 120,000 \) weights.
Neural networks are defined as <b>affine transformations</b>, that is
a vector is received as input and is multiplied with a matrix of so-called weights (our unknown paramters) to produce an
output (to which a bias vector is usually added before passing the result
through a nonlinear activation function). This is applicable to any type of input, be it an
image, a sound clip or an unordered collection of features: whatever their
dimensionality, their representation can always be flattened into a vector
before the transformation.
<p>
We could have
several such neurons, and the parameters would add up quickly! Clearly,
this full connectivity is wasteful and the huge number of parameters
would quickly lead to possible overfitting.
However, when we consider images, sound clips and many other similar kinds of data, these data have an intrinsic
structure. More formally, they share these important properties:
<ul>
<li> They are stored as multi-dimensional arrays (think of the pixels of a figure) .</li>
<li> They feature one or more axes for which ordering matters (e.g., width and height axes for an image, time axis for a sound clip).</li>
<li> One axis, called the channel axis, is used to access different views of the data (e.g., the red, green and blue channels of a color image, or the left and right channels of a stereo audio track).</li>
</ul>
These properties are not exploited when an affine transformation is applied; in
fact, all the axes are treated in the same way and the topological information
is not taken into account. Still, taking advantage of the implicit structure of
the data may prove very handy in solving some tasks, like computer vision and
speech recognition, and in these cases it would be best to preserve it. This is
where discrete convolutions come into play.
<p>
<center> <!-- FIGURE -->
<hr class="figure">
<center><p class="caption">Figure 1: A regular 3-layer Neural Network. </p></center>
<p><img src="figslides/nn.jpeg" align="bottom" width=500></p>
</center>
A discrete convolution is a linear transformation that preserves this notion of
ordering. It is sparse (only a few input units contribute to a given output
unit) and reuses parameters (the same weights are applied to multiple locations
in the input).
<p>
<p>
@@ -217,7 +228,7 @@ would quickly lead to possible overfitting.
<li><a href="._week42-bs011.html">12</a></li>
<li><a href="._week42-bs012.html">13</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs004.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+74 -84
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,41 +175,29 @@ MathJax.Hub.Config({
<a name="part0004"></a>
<!-- !split -->
<h2 id="___sec3" class="anchor">3D volumes of neurons </h2>
<h2 id="___sec3" class="anchor">Regular NNs don&#8217;t scale well to full images </h2>
<p>
Convolutional Neural Networks take advantage of the fact that the
input consists of images and they constrain the architecture in a more
sensible way.
As an example, consider
an image of size \( 32\times 32\times 3 \) (32 wide, 32 high, 3 color channels), so a
single fully-connected neuron in a first hidden layer of a regular
Neural Network would have \( 32\times 32\times 3 = 3072 \) weights. This amount still
seems manageable, but clearly this fully-connected structure does not
scale to larger images. For example, an image of more respectable
size, say \( 200\times 200\times 3 \), would lead to neurons that have
\( 200\times 200\times 3 = 120,000 \) weights.
<p>
In particular, unlike a regular Neural Network, the
layers of a CNN have neurons arranged in 3 dimensions: width,
height, depth. (Note that the word depth here refers to the third
dimension of an activation volume, not to the depth of a full Neural
Network, which can refer to the total number of layers in a network.)
<p>
To understand it better, the above example of an image
with an input volume of
activations has dimensions \( 32\times 32\times 3 \) (width, height,
depth respectively).
<p>
The neurons in a layer will
only be connected to a small region of the layer before it, instead of
all of the neurons in a fully-connected manner. Moreover, the final
output layer could for this specific image have dimensions \( 1\times 1 \times 10 \),
because by the
end of the CNN architecture we will reduce the full image into a
single vector of class scores, arranged along the depth
dimension.
We could have
several such neurons, and the parameters would add up quickly! Clearly,
this full connectivity is wasteful and the huge number of parameters
would quickly lead to possible overfitting.
<p>
<center> <!-- FIGURE -->
<hr class="figure">
<center><p class="caption">Figure 2: A CNN arranges its neurons in three dimensions (width, height, depth), as visualized in one of the layers. Every layer of a CNN transforms the 3D input volume to a 3D output volume of neuron activations. In this example, the red input layer holds the image, so its width and height would be the dimensions of the image, and the depth would be 3 (Red, Green, Blue channels). </p></center>
<p><img src="figslides/cnn.jpeg" align="bottom" width=500></p>
<center><p class="caption">Figure 1: A regular 3-layer Neural Network. </p></center>
<p><img src="figslides/nn.jpeg" align="bottom" width=500></p>
</center>
<p>
@@ -230,7 +220,7 @@ dimension.
<li><a href="._week42-bs012.html">13</a></li>
<li><a href="._week42-bs013.html">14</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs005.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+92 -73
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -171,29 +173,46 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0005"></a>
<!-- !split -->
<!-- !split -->
<h2 id="___sec4" class="anchor">Layers used to build CNNs </h2>
<h2 id="___sec4" class="anchor">3D volumes of neurons </h2>
<p>
A simple CNN is a sequence of layers, and every layer of a CNN
transforms one volume of activations to another through a
differentiable function. We use three main types of layers to build
CNN architectures: Convolutional Layer, Pooling Layer, and
Fully-Connected Layer (exactly as seen in regular Neural Networks). We
will stack these layers to form a full CNN architecture.
Convolutional Neural Networks take advantage of the fact that the
input consists of images and they constrain the architecture in a more
sensible way.
<p>
A simple CNN for image classification could have the architecture:
In particular, unlike a regular Neural Network, the
layers of a CNN have neurons arranged in 3 dimensions: width,
height, depth. (Note that the word depth here refers to the third
dimension of an activation volume, not to the depth of a full Neural
Network, which can refer to the total number of layers in a network.)
<ul>
<li> <b>INPUT</b> (\( 32\times 32 \times 3 \)) will hold the raw pixel values of the image, in this case an image of width 32, height 32, and with three color channels R,G,B.</li>
<li> <b>CONV</b> (convolutional )layer will compute the output of neurons that are connected to local regions in the input, each computing a dot product between their weights and a small region they are connected to in the input volume. This may result in volume such as \( [32\times 32\times 12] \) if we decided to use 12 filters.</li>
<li> <b>RELU</b> layer will apply an elementwise activation function, such as the \( max(0,x) \) thresholding at zero. This leaves the size of the volume unchanged (\( [32\times 32\times 12] \)).</li>
<li> <b>POOL</b> (pooling) layer will perform a downsampling operation along the spatial dimensions (width, height), resulting in volume such as \( [16\times 16\times 12] \).</li>
<li> <b>FC</b> (i.e. fully-connected) layer will compute the class scores, resulting in volume of size \( [1\times 1\times 10] \), where each of the 10 numbers correspond to a class score, such as among the 10 categories of the MNIST images we considered above . As with ordinary Neural Networks and as the name implies, each neuron in this layer will be connected to all the numbers in the previous volume.</li>
</ul>
<p>
To understand it better, the above example of an image
with an input volume of
activations has dimensions \( 32\times 32\times 3 \) (width, height,
depth respectively).
<p>
The neurons in a layer will
only be connected to a small region of the layer before it, instead of
all of the neurons in a fully-connected manner. Moreover, the final
output layer could for this specific image have dimensions \( 1\times 1 \times 10 \),
because by the
end of the CNN architecture we will reduce the full image into a
single vector of class scores, arranged along the depth
dimension.
<p>
<center> <!-- FIGURE -->
<hr class="figure">
<center><p class="caption">Figure 2: A CNN arranges its neurons in three dimensions (width, height, depth), as visualized in one of the layers. Every layer of a CNN transforms the 3D input volume to a 3D output volume of neuron activations. In this example, the red input layer holds the image, so its width and height would be the dimensions of the image, and the depth would be 3 (Red, Green, Blue channels). </p></center>
<p><img src="figslides/cnn.jpeg" align="bottom" width=500></p>
</center>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -214,7 +233,7 @@ A simple CNN for image classification could have the architecture:
<li><a href="._week42-bs013.html">14</a></li>
<li><a href="._week42-bs014.html">15</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs006.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+76 -70
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -171,25 +173,29 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0006"></a>
<!-- !split -->
<!-- !split -->
<h2 id="___sec5" class="anchor">Transforming images </h2>
<h2 id="___sec5" class="anchor">Layers used to build CNNs </h2>
<p>
CNNs transform the original image layer by layer from the original
pixel values to the final class scores.
A simple CNN is a sequence of layers, and every layer of a CNN
transforms one volume of activations to another through a
differentiable function. We use three main types of layers to build
CNN architectures: Convolutional Layer, Pooling Layer, and
Fully-Connected Layer (exactly as seen in regular Neural Networks). We
will stack these layers to form a full CNN architecture.
<p>
Observe that some layers contain
parameters and other don&#8217;t. In particular, the CNN layers perform
transformations that are a function of not only the activations in the
input volume, but also of the parameters (the weights and biases of
the neurons). On the other hand, the RELU/POOL layers will implement a
fixed function. The parameters in the CONV/FC layers will be trained
with gradient descent so that the class scores that the CNN computes
are consistent with the labels in the training set for each image.
A simple CNN for image classification could have the architecture:
<ul>
<li> <b>INPUT</b> (\( 32\times 32 \times 3 \)) will hold the raw pixel values of the image, in this case an image of width 32, height 32, and with three color channels R,G,B.</li>
<li> <b>CONV</b> (convolutional )layer will compute the output of neurons that are connected to local regions in the input, each computing a dot product between their weights and a small region they are connected to in the input volume. This may result in volume such as \( [32\times 32\times 12] \) if we decided to use 12 filters.</li>
<li> <b>RELU</b> layer will apply an elementwise activation function, such as the \( max(0,x) \) thresholding at zero. This leaves the size of the volume unchanged (\( [32\times 32\times 12] \)).</li>
<li> <b>POOL</b> (pooling) layer will perform a downsampling operation along the spatial dimensions (width, height), resulting in volume such as \( [16\times 16\times 12] \).</li>
<li> <b>FC</b> (i.e. fully-connected) layer will compute the class scores, resulting in volume of size \( [1\times 1\times 10] \), where each of the 10 numbers correspond to a class score, such as among the 10 categories of the MNIST images we considered above . As with ordinary Neural Networks and as the name implies, each neuron in this layer will be connected to all the numbers in the previous volume.</li>
</ul>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -211,7 +217,7 @@ are consistent with the labels in the training set for each image.
<li><a href="._week42-bs014.html">15</a></li>
<li><a href="._week42-bs015.html">16</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs007.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+71 -71
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,23 +175,21 @@ MathJax.Hub.Config({
<a name="part0007"></a>
<!-- !split -->
<h2 id="___sec6" class="anchor">CNNs in brief </h2>
<h2 id="___sec6" class="anchor">Transforming images </h2>
<p>
In summary:
CNNs transform the original image layer by layer from the original
pixel values to the final class scores.
<ul>
<li> A CNN architecture is in the simplest case a list of Layers that transform the image volume into an output volume (e.g. holding the class scores)</li>
<li> There are a few distinct types of Layers (e.g. CONV/FC/RELU/POOL are by far the most popular)</li>
<li> Each Layer accepts an input 3D volume and transforms it to an output 3D volume through a differentiable function</li>
<li> Each Layer may or may not have parameters (e.g. CONV/FC do, RELU/POOL don&#8217;t)</li>
<li> Each Layer may or may not have additional hyperparameters (e.g. CONV/FC/POOL do, RELU doesn&#8217;t)</li>
</ul>
For more material on convolutional networks, we strongly recommend
the course
<a href="https://www.uio.no/studier/emner/matnat/ifi/IN5400/index-eng.html" target="_self">IN5400 &#8211; Machine Learning for Image Analysis</a>
and the slides of <a href="http://cs231n.github.io/convolutional-networks/" target="_self">CS231</a> which is taught at Stanford University (consistently ranked as one of the top computer science programs in the world). <a href="http://neuralnetworksanddeeplearning.com/chap6.html" target="_self">Michael Nielsen's book is a must read, in particular chapter 6 which deals with CNNs</a>.
<p>
Observe that some layers contain
parameters and other don&#8217;t. In particular, the CNN layers perform
transformations that are a function of not only the activations in the
input volume, but also of the parameters (the weights and biases of
the neurons). On the other hand, the RELU/POOL layers will implement a
fixed function. The parameters in the CONV/FC layers will be trained
with gradient descent so that the class scores that the CNN computes
are consistent with the labels in the training set for each image.
<p>
<p>
@@ -214,7 +214,7 @@ and the slides of <a href="http://cs231n.github.io/convolutional-networks/" targ
<li><a href="._week42-bs015.html">16</a></li>
<li><a href="._week42-bs016.html">17</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs008.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+73 -66
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,18 +175,23 @@ MathJax.Hub.Config({
<a name="part0008"></a>
<!-- !split -->
<h2 id="___sec7" class="anchor">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<h2 id="___sec7" class="anchor">CNNs in brief </h2>
<p>
As discussed above, CNNs are neural networks built from the assumption that the inputs
to the network are 2D images. This is important because the number of features or pixels in images
grows very fast with the image size, and an enormous number of weights and biases are needed in order to build an accurate network.
In summary:
<p>
As before, we still have our input, a hidden layer and an output. What's novel about convolutional networks
are the <b>convolutional</b> and <b>pooling</b> layers stacked in pairs between the input and the hidden layer.
In addition, the data is no longer represented as a 2D feature matrix, instead each input is a number of 2D
matrices, typically 1 for each color dimension (Red, Green, Blue).
<ul>
<li> A CNN architecture is in the simplest case a list of Layers that transform the image volume into an output volume (e.g. holding the class scores)</li>
<li> There are a few distinct types of Layers (e.g. CONV/FC/RELU/POOL are by far the most popular)</li>
<li> Each Layer accepts an input 3D volume and transforms it to an output 3D volume through a differentiable function</li>
<li> Each Layer may or may not have parameters (e.g. CONV/FC do, RELU/POOL don&#8217;t)</li>
<li> Each Layer may or may not have additional hyperparameters (e.g. CONV/FC/POOL do, RELU doesn&#8217;t)</li>
</ul>
For more material on convolutional networks, we strongly recommend
the course
<a href="https://www.uio.no/studier/emner/matnat/ifi/IN5400/index-eng.html" target="_self">IN5400 &#8211; Machine Learning for Image Analysis</a>
and the slides of <a href="http://cs231n.github.io/convolutional-networks/" target="_self">CS231</a> which is taught at Stanford University (consistently ranked as one of the top computer science programs in the world). <a href="http://neuralnetworksanddeeplearning.com/chap6.html" target="_self">Michael Nielsen's book is a must read, in particular chapter 6 which deals with CNNs</a>.
<p>
<p>
@@ -210,7 +217,7 @@ matrices, typically 1 for each color dimension (Red, Green, Blue).
<li><a href="._week42-bs016.html">17</a></li>
<li><a href="._week42-bs017.html">18</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs009.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+69 -63
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,14 +175,18 @@ MathJax.Hub.Config({
<a name="part0009"></a>
<!-- !split -->
<h2 id="___sec8" class="anchor">Setting it up </h2>
<h2 id="___sec8" class="anchor">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<p>
It means that to represent the entire
dataset of images, we require a 4D matrix or <b>tensor</b>. This tensor has the dimensions:
$$
(n_{inputs},\, n_{pixels, width},\, n_{pixels, height},\, depth) .
$$
As discussed above, CNNs are neural networks built from the assumption that the inputs
to the network are 2D images. This is important because the number of features or pixels in images
grows very fast with the image size, and an enormous number of weights and biases are needed in order to build an accurate network.
<p>
As before, we still have our input, a hidden layer and an output. What's novel about convolutional networks
are the <b>convolutional</b> and <b>pooling</b> layers stacked in pairs between the input and the hidden layer.
In addition, the data is no longer represented as a 2D feature matrix, instead each input is a number of 2D
matrices, typically 1 for each color dimension (Red, Green, Blue).
<p>
<p>
@@ -207,7 +213,7 @@ $$
<li><a href="._week42-bs017.html">18</a></li>
<li><a href="._week42-bs018.html">19</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs010.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+65 -69
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,20 +175,14 @@ MathJax.Hub.Config({
<a name="part0010"></a>
<!-- !split -->
<h2 id="___sec9" class="anchor">The MNIST dataset again </h2>
<h2 id="___sec9" class="anchor">Setting it up </h2>
<p>
The MNIST dataset consists of grayscale images with a pixel size of
\( 28\times 28 \), meaning we require \( 28 \times 28 = 724 \) weights to each
neuron in the first hidden layer.
<p>
If we were to analyze images of size \( 128\times 128 \) we would require
\( 128 \times 128 = 16384 \) weights to each neuron. Even worse if we were
dealing with color images, as most images are, we have an image matrix
of size \( 128\times 128 \) for each color dimension (Red, Green, Blue),
meaning 3 times the number of weights \( = 49152 \) are required for every
single neuron in the first hidden layer.
It means that to represent the entire
dataset of images, we require a 4D matrix or <b>tensor</b>. This tensor has the dimensions:
$$
(n_{inputs},\, n_{pixels, width},\, n_{pixels, height},\, depth) .
$$
<p>
<p>
@@ -214,7 +210,7 @@ single neuron in the first hidden layer.
<li><a href="._week42-bs018.html">19</a></li>
<li><a href="._week42-bs019.html">20</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs011.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+69 -67
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,20 +175,20 @@ MathJax.Hub.Config({
<a name="part0011"></a>
<!-- !split -->
<h2 id="___sec10" class="anchor">Strong correlations </h2>
<h2 id="___sec10" class="anchor">The MNIST dataset again </h2>
<p>
Images typically have strong local correlations, meaning that a small
part of the image varies little from its neighboring regions. If for
example we have an image of a blue car, we can roughly assume that a
small blue part of the image is surrounded by other blue regions.
The MNIST dataset consists of grayscale images with a pixel size of
\( 28\times 28 \), meaning we require \( 28 \times 28 = 724 \) weights to each
neuron in the first hidden layer.
<p>
Therefore, instead of connecting every single pixel to a neuron in the
first hidden layer, as we have previously done with deep neural
networks, we can instead connect each neuron to a small part of the
image (in all 3 RGB depth dimensions). The size of each small area is
fixed, and known as a <a href="https://en.wikipedia.org/wiki/Receptive_field" target="_self">receptive</a>.
If we were to analyze images of size \( 128\times 128 \) we would require
\( 128 \times 128 = 16384 \) weights to each neuron. Even worse if we were
dealing with color images, as most images are, we have an image matrix
of size \( 128\times 128 \) for each color dimension (Red, Green, Blue),
meaning 3 times the number of weights \( = 49152 \) are required for every
single neuron in the first hidden layer.
<p>
<p>
@@ -214,7 +216,7 @@ fixed, and known as a <a href="https://en.wikipedia.org/wiki/Receptive_field" ta
<li><a href="._week42-bs019.html">20</a></li>
<li><a href="._week42-bs020.html">21</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs012.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+70 -72
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -171,26 +173,22 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0012"></a>
<!-- !split -->
<!-- !split -->
<h2 id="___sec11" class="anchor">Layers of a CNN </h2>
The layers of a convolutional neural network arrange neurons in 3D: width, height and depth.
The input image is typically a square matrix of depth 3.
<h2 id="___sec11" class="anchor">Strong correlations </h2>
<p>
A <b>convolution</b> is performed on the image which outputs
a 3D volume of neurons. The weights to the input are arranged in a number of 2D matrices, known as <b>filters</b>.
Images typically have strong local correlations, meaning that a small
part of the image varies little from its neighboring regions. If for
example we have an image of a blue car, we can roughly assume that a
small blue part of the image is surrounded by other blue regions.
<p>
Each filter slides along the input image, taking the dot product
between each small part of the image and the filter, in all depth
dimensions. This is then passed through a non-linear function,
typically the <b>Rectified Linear (ReLu)</b> function, which serves as the
activation of the neurons in the first convolutional layer. This is
further passed through a <b>pooling layer</b>, which reduces the size of the
convolutional layer, e.g. by taking the maximum or average across some
small regions, and this serves as input to the next convolutional
layer.
Therefore, instead of connecting every single pixel to a neuron in the
first hidden layer, as we have previously done with deep neural
networks, we can instead connect each neuron to a small part of the
image (in all 3 RGB depth dimensions). The size of each small area is
fixed, and known as a <a href="https://en.wikipedia.org/wiki/Receptive_field" target="_self">receptive</a>.
<p>
<p>
@@ -218,7 +216,7 @@ layer.
<li><a href="._week42-bs020.html">21</a></li>
<li><a href="._week42-bs021.html">22</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs013.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+76 -67
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -171,19 +173,26 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0013"></a>
<!-- !split -->
<!-- !split -->
<h2 id="___sec12" class="anchor">Systematic reduction </h2>
<h2 id="___sec12" class="anchor">Layers of a CNN </h2>
The layers of a convolutional neural network arrange neurons in 3D: width, height and depth.
The input image is typically a square matrix of depth 3.
<p>
By systematically reducing the size of the input volume, through
convolution and pooling, the network should create representations of
small parts of the input, and then from them assemble representations
of larger areas. The final pooling layer is flattened to serve as
input to a hidden layer, such that each neuron in the final pooling
layer is connected to every single neuron in the hidden layer. This
then serves as input to the output layer, e.g. a softmax output for
classification.
A <b>convolution</b> is performed on the image which outputs
a 3D volume of neurons. The weights to the input are arranged in a number of 2D matrices, known as <b>filters</b>.
<p>
Each filter slides along the input image, taking the dot product
between each small part of the image and the filter, in all depth
dimensions. This is then passed through a non-linear function,
typically the <b>Rectified Linear (ReLu)</b> function, which serves as the
activation of the neurons in the first convolutional layer. This is
further passed through a <b>pooling layer</b>, which reduces the size of the
convolutional layer, e.g. by taking the maximum or average across some
small regions, and this serves as input to the next convolutional
layer.
<p>
<p>
@@ -211,7 +220,7 @@ classification.
<li><a href="._week42-bs021.html">22</a></li>
<li><a href="._week42-bs022.html">23</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs014.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+69 -100
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,51 +175,18 @@ MathJax.Hub.Config({
<a name="part0014"></a>
<!-- !split -->
<h2 id="___sec13" class="anchor">Prerequisites: Collect and pre-process data </h2>
<h2 id="___sec13" class="anchor">Systematic reduction </h2>
<p>
By systematically reducing the size of the input volume, through
convolution and pooling, the network should create representations of
small parts of the input, and then from them assemble representations
of larger areas. The final pooling layer is flattened to serve as
input to a hidden layer, such that each neuron in the final pooling
layer is connected to every single neuron in the hidden layer. This
then serves as input to the output layer, e.g. a softmax output for
classification.
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic"># import necessary packages</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn</span> <span style="color: #008000; font-weight: bold">import</span> datasets
<span style="color: #408080; font-style: italic"># ensure the same random numbers appear every time</span>
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">0</span>)
<span style="color: #408080; font-style: italic"># display images in notebook</span>
<span style="color: #666666">%</span>matplotlib inline
plt<span style="color: #666666">.</span>rcParams[<span style="color: #BA2121">&#39;figure.figsize&#39;</span>] <span style="color: #666666">=</span> (<span style="color: #666666">12</span>,<span style="color: #666666">12</span>)
<span style="color: #408080; font-style: italic"># download MNIST dataset</span>
digits <span style="color: #666666">=</span> datasets<span style="color: #666666">.</span>load_digits()
<span style="color: #408080; font-style: italic"># define inputs and labels</span>
inputs <span style="color: #666666">=</span> digits<span style="color: #666666">.</span>images
labels <span style="color: #666666">=</span> digits<span style="color: #666666">.</span>target
<span style="color: #408080; font-style: italic"># RGB images have a depth of 3</span>
<span style="color: #408080; font-style: italic"># our images are grayscale so they should have a depth of 1</span>
inputs <span style="color: #666666">=</span> inputs[:,:,:,np<span style="color: #666666">.</span>newaxis]
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;inputs = (n_inputs, pixel_width, pixel_height, depth) = &quot;</span> <span style="color: #666666">+</span> <span style="color: #008000">str</span>(inputs<span style="color: #666666">.</span>shape))
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;labels = (n_inputs) = &quot;</span> <span style="color: #666666">+</span> <span style="color: #008000">str</span>(labels<span style="color: #666666">.</span>shape))
<span style="color: #408080; font-style: italic"># choose some random images to display</span>
n_inputs <span style="color: #666666">=</span> <span style="color: #008000">len</span>(inputs)
indices <span style="color: #666666">=</span> np<span style="color: #666666">.</span>arange(n_inputs)
random_indices <span style="color: #666666">=</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>choice(indices, size<span style="color: #666666">=5</span>)
<span style="color: #008000; font-weight: bold">for</span> i, image <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(digits<span style="color: #666666">.</span>images[random_indices]):
plt<span style="color: #666666">.</span>subplot(<span style="color: #666666">1</span>, <span style="color: #666666">5</span>, i<span style="color: #666666">+1</span>)
plt<span style="color: #666666">.</span>axis(<span style="color: #BA2121">&#39;off&#39;</span>)
plt<span style="color: #666666">.</span>imshow(image, cmap<span style="color: #666666">=</span>plt<span style="color: #666666">.</span>cm<span style="color: #666666">.</span>gray_r, interpolation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;nearest&#39;</span>)
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">&quot;Label: </span><span style="color: #BB6688; font-weight: bold">%d</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">%</span> digits<span style="color: #666666">.</span>target[random_indices[i]])
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -244,7 +213,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week42-bs022.html">23</a></li>
<li><a href="._week42-bs023.html">24</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs015.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+97 -77
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,32 +175,50 @@ MathJax.Hub.Config({
<a name="part0015"></a>
<!-- !split -->
<h2 id="___sec14" class="anchor">Importing Keras and Tensorflow </h2>
<h2 id="___sec14" class="anchor">Prerequisites: Collect and pre-process data </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> datasets, layers, models
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.layers</span> <span style="color: #008000; font-weight: bold">import</span> Input
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.models</span> <span style="color: #008000; font-weight: bold">import</span> Sequential <span style="color: #408080; font-style: italic">#This allows appending layers to existing models</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.layers</span> <span style="color: #008000; font-weight: bold">import</span> Dense <span style="color: #408080; font-style: italic">#This allows defining the characteristics of a particular layer</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> optimizers <span style="color: #408080; font-style: italic">#This allows using whichever optimiser we want (sgd,adam,RMSprop)</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> regularizers <span style="color: #408080; font-style: italic">#This allows using whichever regularizer we want (l1,l2,l1_l2)</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.utils</span> <span style="color: #008000; font-weight: bold">import</span> to_categorical <span style="color: #408080; font-style: italic">#This allows using categorical cross entropy as the cost function</span>
<span style="color: #408080; font-style: italic">#from tensorflow.keras import Conv2D</span>
<span style="color: #408080; font-style: italic">#from tensorflow.keras import MaxPooling2D</span>
<span style="color: #408080; font-style: italic">#from tensorflow.keras import Flatten</span>
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic"># import necessary packages</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn</span> <span style="color: #008000; font-weight: bold">import</span> datasets
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.model_selection</span> <span style="color: #008000; font-weight: bold">import</span> train_test_split
<span style="color: #408080; font-style: italic"># representation of labels</span>
labels <span style="color: #666666">=</span> to_categorical(labels)
<span style="color: #408080; font-style: italic"># ensure the same random numbers appear every time</span>
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">0</span>)
<span style="color: #408080; font-style: italic"># split into train and test data</span>
<span style="color: #408080; font-style: italic"># one-liner from scikit-learn library</span>
train_size <span style="color: #666666">=</span> <span style="color: #666666">0.8</span>
test_size <span style="color: #666666">=</span> <span style="color: #666666">1</span> <span style="color: #666666">-</span> train_size
X_train, X_test, Y_train, Y_test <span style="color: #666666">=</span> train_test_split(inputs, labels, train_size<span style="color: #666666">=</span>train_size,
test_size<span style="color: #666666">=</span>test_size)
<span style="color: #408080; font-style: italic"># display images in notebook</span>
<span style="color: #666666">%</span>matplotlib inline
plt<span style="color: #666666">.</span>rcParams[<span style="color: #BA2121">&#39;figure.figsize&#39;</span>] <span style="color: #666666">=</span> (<span style="color: #666666">12</span>,<span style="color: #666666">12</span>)
<span style="color: #408080; font-style: italic"># download MNIST dataset</span>
digits <span style="color: #666666">=</span> datasets<span style="color: #666666">.</span>load_digits()
<span style="color: #408080; font-style: italic"># define inputs and labels</span>
inputs <span style="color: #666666">=</span> digits<span style="color: #666666">.</span>images
labels <span style="color: #666666">=</span> digits<span style="color: #666666">.</span>target
<span style="color: #408080; font-style: italic"># RGB images have a depth of 3</span>
<span style="color: #408080; font-style: italic"># our images are grayscale so they should have a depth of 1</span>
inputs <span style="color: #666666">=</span> inputs[:,:,:,np<span style="color: #666666">.</span>newaxis]
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;inputs = (n_inputs, pixel_width, pixel_height, depth) = &quot;</span> <span style="color: #666666">+</span> <span style="color: #008000">str</span>(inputs<span style="color: #666666">.</span>shape))
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;labels = (n_inputs) = &quot;</span> <span style="color: #666666">+</span> <span style="color: #008000">str</span>(labels<span style="color: #666666">.</span>shape))
<span style="color: #408080; font-style: italic"># choose some random images to display</span>
n_inputs <span style="color: #666666">=</span> <span style="color: #008000">len</span>(inputs)
indices <span style="color: #666666">=</span> np<span style="color: #666666">.</span>arange(n_inputs)
random_indices <span style="color: #666666">=</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>choice(indices, size<span style="color: #666666">=5</span>)
<span style="color: #008000; font-weight: bold">for</span> i, image <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(digits<span style="color: #666666">.</span>images[random_indices]):
plt<span style="color: #666666">.</span>subplot(<span style="color: #666666">1</span>, <span style="color: #666666">5</span>, i<span style="color: #666666">+1</span>)
plt<span style="color: #666666">.</span>axis(<span style="color: #BA2121">&#39;off&#39;</span>)
plt<span style="color: #666666">.</span>imshow(image, cmap<span style="color: #666666">=</span>plt<span style="color: #666666">.</span>cm<span style="color: #666666">.</span>gray_r, interpolation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;nearest&#39;</span>)
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">&quot;Label: </span><span style="color: #BB6688; font-weight: bold">%d</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">%</span> digits<span style="color: #666666">.</span>target[random_indices[i]])
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
<p>
@@ -226,7 +246,7 @@ X_train, X_test, Y_train, Y_test <span style="color: #666666">=</span> train_tes
<li><a href="._week42-bs023.html">24</a></li>
<li><a href="._week42-bs024.html">25</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs016.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+81 -84
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -171,39 +173,34 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0016"></a>
<!-- !split -->
<h2 id="___sec15" class="anchor">Running with Keras </h2>
<!-- !split -->
<h2 id="___sec15" class="anchor">Importing Keras and Tensorflow </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">create_convolutional_neural_network_keras</span>(input_shape, receptive_field,
n_filters, n_neurons_connected, n_categories,
eta, lmbd):
model <span style="color: #666666">=</span> Sequential()
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(n_filters, (receptive_field, receptive_field), input_shape<span style="color: #666666">=</span>input_shape, padding<span style="color: #666666">=</span><span style="color: #BA2121">&#39;same&#39;</span>,
activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>, kernel_regularizer<span style="color: #666666">=</span>regularizers<span style="color: #666666">.</span>l2(lmbd)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D(pool_size<span style="color: #666666">=</span>(<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Flatten())
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(n_neurons_connected, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>, kernel_regularizer<span style="color: #666666">=</span>regularizers<span style="color: #666666">.</span>l2(lmbd)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(n_categories, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;softmax&#39;</span>, kernel_regularizer<span style="color: #666666">=</span>regularizers<span style="color: #666666">.</span>l2(lmbd)))
sgd <span style="color: #666666">=</span> optimizers<span style="color: #666666">.</span>SGD(lr<span style="color: #666666">=</span>eta)
model<span style="color: #666666">.</span>compile(loss<span style="color: #666666">=</span><span style="color: #BA2121">&#39;categorical_crossentropy&#39;</span>, optimizer<span style="color: #666666">=</span>sgd, metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">&#39;accuracy&#39;</span>])
<span style="color: #008000; font-weight: bold">return</span> model
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> datasets, layers, models
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.layers</span> <span style="color: #008000; font-weight: bold">import</span> Input
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.models</span> <span style="color: #008000; font-weight: bold">import</span> Sequential <span style="color: #408080; font-style: italic">#This allows appending layers to existing models</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.layers</span> <span style="color: #008000; font-weight: bold">import</span> Dense <span style="color: #408080; font-style: italic">#This allows defining the characteristics of a particular layer</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> optimizers <span style="color: #408080; font-style: italic">#This allows using whichever optimiser we want (sgd,adam,RMSprop)</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> regularizers <span style="color: #408080; font-style: italic">#This allows using whichever regularizer we want (l1,l2,l1_l2)</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras.utils</span> <span style="color: #008000; font-weight: bold">import</span> to_categorical <span style="color: #408080; font-style: italic">#This allows using categorical cross entropy as the cost function</span>
<span style="color: #408080; font-style: italic">#from tensorflow.keras import Conv2D</span>
<span style="color: #408080; font-style: italic">#from tensorflow.keras import MaxPooling2D</span>
<span style="color: #408080; font-style: italic">#from tensorflow.keras import Flatten</span>
epochs <span style="color: #666666">=</span> <span style="color: #666666">100</span>
batch_size <span style="color: #666666">=</span> <span style="color: #666666">100</span>
input_shape <span style="color: #666666">=</span> X_train<span style="color: #666666">.</span>shape[<span style="color: #666666">1</span>:<span style="color: #666666">4</span>]
receptive_field <span style="color: #666666">=</span> <span style="color: #666666">3</span>
n_filters <span style="color: #666666">=</span> <span style="color: #666666">10</span>
n_neurons_connected <span style="color: #666666">=</span> <span style="color: #666666">50</span>
n_categories <span style="color: #666666">=</span> <span style="color: #666666">10</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.model_selection</span> <span style="color: #008000; font-weight: bold">import</span> train_test_split
eta_vals <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-5</span>, <span style="color: #666666">1</span>, <span style="color: #666666">7</span>)
lmbd_vals <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-5</span>, <span style="color: #666666">1</span>, <span style="color: #666666">7</span>)
<span style="color: #408080; font-style: italic"># representation of labels</span>
labels <span style="color: #666666">=</span> to_categorical(labels)
<span style="color: #408080; font-style: italic"># split into train and test data</span>
<span style="color: #408080; font-style: italic"># one-liner from scikit-learn library</span>
train_size <span style="color: #666666">=</span> <span style="color: #666666">0.8</span>
test_size <span style="color: #666666">=</span> <span style="color: #666666">1</span> <span style="color: #666666">-</span> train_size
X_train, X_test, Y_train, Y_test <span style="color: #666666">=</span> train_test_split(inputs, labels, train_size<span style="color: #666666">=</span>train_size,
test_size<span style="color: #666666">=</span>test_size)
</pre></div>
<p>
<p>
@@ -231,7 +228,7 @@ lmbd_vals <span style="color: #666666">=</span> np<span style="color: #666666">.
<li><a href="._week42-bs024.html">25</a></li>
<li><a href="._week42-bs025.html">26</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs017.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+86 -74
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -171,29 +173,39 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0017"></a>
<!-- !split -->
<!-- !split -->
<h2 id="___sec16" class="anchor">Final part </h2>
<h2 id="___sec16" class="anchor">Running with Keras </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>CNN_keras <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(eta_vals), <span style="color: #008000">len</span>(lmbd_vals)), dtype<span style="color: #666666">=</span><span style="color: #008000">object</span>)
<span style="color: #008000; font-weight: bold">for</span> i, eta <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(eta_vals):
<span style="color: #008000; font-weight: bold">for</span> j, lmbd <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(lmbd_vals):
CNN <span style="color: #666666">=</span> create_convolutional_neural_network_keras(input_shape, receptive_field,
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">create_convolutional_neural_network_keras</span>(input_shape, receptive_field,
n_filters, n_neurons_connected, n_categories,
eta, lmbd)
CNN<span style="color: #666666">.</span>fit(X_train, Y_train, epochs<span style="color: #666666">=</span>epochs, batch_size<span style="color: #666666">=</span>batch_size, verbose<span style="color: #666666">=0</span>)
scores <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>evaluate(X_test, Y_test)
CNN_keras[i][j] <span style="color: #666666">=</span> CNN
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Learning rate = &quot;</span>, eta)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Lambda = &quot;</span>, lmbd)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Test accuracy: </span><span style="color: #BB6688; font-weight: bold">%.3f</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">%</span> scores[<span style="color: #666666">1</span>])
<span style="color: #008000">print</span>()
eta, lmbd):
model <span style="color: #666666">=</span> Sequential()
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(n_filters, (receptive_field, receptive_field), input_shape<span style="color: #666666">=</span>input_shape, padding<span style="color: #666666">=</span><span style="color: #BA2121">&#39;same&#39;</span>,
activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>, kernel_regularizer<span style="color: #666666">=</span>regularizers<span style="color: #666666">.</span>l2(lmbd)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D(pool_size<span style="color: #666666">=</span>(<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Flatten())
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(n_neurons_connected, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>, kernel_regularizer<span style="color: #666666">=</span>regularizers<span style="color: #666666">.</span>l2(lmbd)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(n_categories, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;softmax&#39;</span>, kernel_regularizer<span style="color: #666666">=</span>regularizers<span style="color: #666666">.</span>l2(lmbd)))
sgd <span style="color: #666666">=</span> optimizers<span style="color: #666666">.</span>SGD(lr<span style="color: #666666">=</span>eta)
model<span style="color: #666666">.</span>compile(loss<span style="color: #666666">=</span><span style="color: #BA2121">&#39;categorical_crossentropy&#39;</span>, optimizer<span style="color: #666666">=</span>sgd, metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">&#39;accuracy&#39;</span>])
<span style="color: #008000; font-weight: bold">return</span> model
epochs <span style="color: #666666">=</span> <span style="color: #666666">100</span>
batch_size <span style="color: #666666">=</span> <span style="color: #666666">100</span>
input_shape <span style="color: #666666">=</span> X_train<span style="color: #666666">.</span>shape[<span style="color: #666666">1</span>:<span style="color: #666666">4</span>]
receptive_field <span style="color: #666666">=</span> <span style="color: #666666">3</span>
n_filters <span style="color: #666666">=</span> <span style="color: #666666">10</span>
n_neurons_connected <span style="color: #666666">=</span> <span style="color: #666666">50</span>
n_categories <span style="color: #666666">=</span> <span style="color: #666666">10</span>
eta_vals <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-5</span>, <span style="color: #666666">1</span>, <span style="color: #666666">7</span>)
lmbd_vals <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-5</span>, <span style="color: #666666">1</span>, <span style="color: #666666">7</span>)
</pre></div>
<p>
<p>
@@ -221,7 +233,7 @@ MathJax.Hub.Config({
<li><a href="._week42-bs025.html">26</a></li>
<li><a href="._week42-bs026.html">27</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs018.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+75 -87
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,41 +175,27 @@ MathJax.Hub.Config({
<a name="part0018"></a>
<!-- !split -->
<h2 id="___sec17" class="anchor">Final visualization </h2>
<h2 id="___sec17" class="anchor">Final part </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic"># visual representation of grid search</span>
<span style="color: #408080; font-style: italic"># uses seaborn heatmap, could probably do this in matplotlib</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">seaborn</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">sns</span>
sns<span style="color: #666666">.</span>set()
train_accuracy <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(eta_vals), <span style="color: #008000">len</span>(lmbd_vals)))
test_accuracy <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(eta_vals), <span style="color: #008000">len</span>(lmbd_vals)))
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #008000">len</span>(eta_vals)):
<span style="color: #008000; font-weight: bold">for</span> j <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #008000">len</span>(lmbd_vals)):
CNN <span style="color: #666666">=</span> CNN_keras[i][j]
train_accuracy[i][j] <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>evaluate(X_train, Y_train)[<span style="color: #666666">1</span>]
test_accuracy[i][j] <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>evaluate(X_test, Y_test)[<span style="color: #666666">1</span>]
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>CNN_keras <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(eta_vals), <span style="color: #008000">len</span>(lmbd_vals)), dtype<span style="color: #666666">=</span><span style="color: #008000">object</span>)
fig, ax <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>subplots(figsize <span style="color: #666666">=</span> (<span style="color: #666666">10</span>, <span style="color: #666666">10</span>))
sns<span style="color: #666666">.</span>heatmap(train_accuracy, annot<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>, ax<span style="color: #666666">=</span>ax, cmap<span style="color: #666666">=</span><span style="color: #BA2121">&quot;viridis&quot;</span>)
ax<span style="color: #666666">.</span>set_title(<span style="color: #BA2121">&quot;Training Accuracy&quot;</span>)
ax<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">&quot;$\eta$&quot;</span>)
ax<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">&quot;$\lambda$&quot;</span>)
plt<span style="color: #666666">.</span>show()
fig, ax <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>subplots(figsize <span style="color: #666666">=</span> (<span style="color: #666666">10</span>, <span style="color: #666666">10</span>))
sns<span style="color: #666666">.</span>heatmap(test_accuracy, annot<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>, ax<span style="color: #666666">=</span>ax, cmap<span style="color: #666666">=</span><span style="color: #BA2121">&quot;viridis&quot;</span>)
ax<span style="color: #666666">.</span>set_title(<span style="color: #BA2121">&quot;Test Accuracy&quot;</span>)
ax<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">&quot;$\eta$&quot;</span>)
ax<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">&quot;$\lambda$&quot;</span>)
plt<span style="color: #666666">.</span>show()
<span style="color: #008000; font-weight: bold">for</span> i, eta <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(eta_vals):
<span style="color: #008000; font-weight: bold">for</span> j, lmbd <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(lmbd_vals):
CNN <span style="color: #666666">=</span> create_convolutional_neural_network_keras(input_shape, receptive_field,
n_filters, n_neurons_connected, n_categories,
eta, lmbd)
CNN<span style="color: #666666">.</span>fit(X_train, Y_train, epochs<span style="color: #666666">=</span>epochs, batch_size<span style="color: #666666">=</span>batch_size, verbose<span style="color: #666666">=0</span>)
scores <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>evaluate(X_test, Y_test)
CNN_keras[i][j] <span style="color: #666666">=</span> CNN
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Learning rate = &quot;</span>, eta)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Lambda = &quot;</span>, lmbd)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Test accuracy: </span><span style="color: #BB6688; font-weight: bold">%.3f</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">%</span> scores[<span style="color: #666666">1</span>])
<span style="color: #008000">print</span>()
</pre></div>
<p>
<p>
@@ -235,7 +223,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week42-bs026.html">27</a></li>
<li><a href="._week42-bs027.html">28</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs019.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+87 -71
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,27 +175,41 @@ MathJax.Hub.Config({
<a name="part0019"></a>
<!-- !split -->
<h2 id="___sec18" class="anchor">The CIFAR01 data set </h2>
<p>
The CIFAR10 dataset contains 60,000 color images in 10 classes, with
6,000 images in each class. The dataset is divided into 50,000
training images and 10,000 testing images. The classes are mutually
exclusive and there is no overlap between them.
<h2 id="___sec18" class="anchor">Final visualization </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">tensorflow</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">tf</span>
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #408080; font-style: italic"># visual representation of grid search</span>
<span style="color: #408080; font-style: italic"># uses seaborn heatmap, could probably do this in matplotlib</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">seaborn</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">sns</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> datasets, layers, models
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
sns<span style="color: #666666">.</span>set()
<span style="color: #408080; font-style: italic"># We import the data set</span>
(train_images, train_labels), (test_images, test_labels) <span style="color: #666666">=</span> datasets<span style="color: #666666">.</span>cifar10<span style="color: #666666">.</span>load_data()
train_accuracy <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(eta_vals), <span style="color: #008000">len</span>(lmbd_vals)))
test_accuracy <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(eta_vals), <span style="color: #008000">len</span>(lmbd_vals)))
<span style="color: #408080; font-style: italic"># Normalize pixel values to be between 0 and 1 by dividing by 255. </span>
train_images, test_images <span style="color: #666666">=</span> train_images <span style="color: #666666">/</span> <span style="color: #666666">255.0</span>, test_images <span style="color: #666666">/</span> <span style="color: #666666">255.0</span>
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #008000">len</span>(eta_vals)):
<span style="color: #008000; font-weight: bold">for</span> j <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #008000">len</span>(lmbd_vals)):
CNN <span style="color: #666666">=</span> CNN_keras[i][j]
train_accuracy[i][j] <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>evaluate(X_train, Y_train)[<span style="color: #666666">1</span>]
test_accuracy[i][j] <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>evaluate(X_test, Y_test)[<span style="color: #666666">1</span>]
fig, ax <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>subplots(figsize <span style="color: #666666">=</span> (<span style="color: #666666">10</span>, <span style="color: #666666">10</span>))
sns<span style="color: #666666">.</span>heatmap(train_accuracy, annot<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>, ax<span style="color: #666666">=</span>ax, cmap<span style="color: #666666">=</span><span style="color: #BA2121">&quot;viridis&quot;</span>)
ax<span style="color: #666666">.</span>set_title(<span style="color: #BA2121">&quot;Training Accuracy&quot;</span>)
ax<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">&quot;$\eta$&quot;</span>)
ax<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">&quot;$\lambda$&quot;</span>)
plt<span style="color: #666666">.</span>show()
fig, ax <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>subplots(figsize <span style="color: #666666">=</span> (<span style="color: #666666">10</span>, <span style="color: #666666">10</span>))
sns<span style="color: #666666">.</span>heatmap(test_accuracy, annot<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>, ax<span style="color: #666666">=</span>ax, cmap<span style="color: #666666">=</span><span style="color: #BA2121">&quot;viridis&quot;</span>)
ax<span style="color: #666666">.</span>set_title(<span style="color: #BA2121">&quot;Test Accuracy&quot;</span>)
ax<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">&quot;$\eta$&quot;</span>)
ax<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">&quot;$\lambda$&quot;</span>)
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
<p>
@@ -221,7 +237,7 @@ train_images, test_images <span style="color: #666666">=</span> train_images <sp
<li><a href="._week42-bs027.html">28</a></li>
<li><a href="._week42-bs028.html">29</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs020.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+74 -73
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,28 +175,27 @@ MathJax.Hub.Config({
<a name="part0020"></a>
<!-- !split -->
<h2 id="___sec19" class="anchor">Verifying the data set </h2>
<h2 id="___sec19" class="anchor">The CIFAR01 data set </h2>
<p>
To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the class name below each image.
The CIFAR10 dataset contains 60,000 color images in 10 classes, with
6,000 images in each class. The dataset is divided into 50,000
training images and 10,000 testing images. The classes are mutually
exclusive and there is no overlap between them.
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>class_names <span style="color: #666666">=</span> [<span style="color: #BA2121">&#39;airplane&#39;</span>, <span style="color: #BA2121">&#39;automobile&#39;</span>, <span style="color: #BA2121">&#39;bird&#39;</span>, <span style="color: #BA2121">&#39;cat&#39;</span>, <span style="color: #BA2121">&#39;deer&#39;</span>,
<span style="color: #BA2121">&#39;dog&#39;</span>, <span style="color: #BA2121">&#39;frog&#39;</span>, <span style="color: #BA2121">&#39;horse&#39;</span>, <span style="color: #BA2121">&#39;ship&#39;</span>, <span style="color: #BA2121">&#39;truck&#39;</span>]
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">10</span>,<span style="color: #666666">10</span>))
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #666666">25</span>):
plt<span style="color: #666666">.</span>subplot(<span style="color: #666666">5</span>,<span style="color: #666666">5</span>,i<span style="color: #666666">+1</span>)
plt<span style="color: #666666">.</span>xticks([])
plt<span style="color: #666666">.</span>yticks([])
plt<span style="color: #666666">.</span>grid(<span style="color: #008000; font-weight: bold">False</span>)
plt<span style="color: #666666">.</span>imshow(train_images[i], cmap<span style="color: #666666">=</span>plt<span style="color: #666666">.</span>cm<span style="color: #666666">.</span>binary)
<span style="color: #408080; font-style: italic"># The CIFAR labels happen to be arrays, </span>
<span style="color: #408080; font-style: italic"># which is why you need the extra index</span>
plt<span style="color: #666666">.</span>xlabel(class_names[train_labels[i][<span style="color: #666666">0</span>]])
plt<span style="color: #666666">.</span>show()
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">tensorflow</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">tf</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">tensorflow.keras</span> <span style="color: #008000; font-weight: bold">import</span> datasets, layers, models
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #408080; font-style: italic"># We import the data set</span>
(train_images, train_labels), (test_images, test_labels) <span style="color: #666666">=</span> datasets<span style="color: #666666">.</span>cifar10<span style="color: #666666">.</span>load_data()
<span style="color: #408080; font-style: italic"># Normalize pixel values to be between 0 and 1 by dividing by 255. </span>
train_images, test_images <span style="color: #666666">=</span> train_images <span style="color: #666666">/</span> <span style="color: #666666">255.0</span>, test_images <span style="color: #666666">/</span> <span style="color: #666666">255.0</span>
</pre></div>
<p>
<p>
@@ -222,7 +223,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week42-bs028.html">29</a></li>
<li><a href="._week42-bs029.html">30</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs021.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+76 -74
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,31 +175,29 @@ MathJax.Hub.Config({
<a name="part0021"></a>
<!-- !split -->
<h2 id="___sec20" class="anchor">Set up the model </h2>
<h2 id="___sec20" class="anchor">Verifying the data set </h2>
<p>
The 6 lines of code below define the convolutional base using a common pattern: a stack of Conv2D and MaxPooling2D layers.
<p>
As input, a CNN takes tensors of shape (image_height, image_width, color_channels), ignoring the batch size. If you are new to these dimensions, color_channels refers to (R,G,B). In this example, you will configure our CNN to process inputs of shape (32, 32, 3), which is the format of CIFAR images. You can do this by passing the argument input_shape to our first layer.
To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the class name below each image.
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>model <span style="color: #666666">=</span> models<span style="color: #666666">.</span>Sequential()
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">32</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>, input_shape<span style="color: #666666">=</span>(<span style="color: #666666">32</span>, <span style="color: #666666">32</span>, <span style="color: #666666">3</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D((<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D((<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
<span style="color: #408080; font-style: italic"># Let&#39;s display the architecture of our model so far.</span>
model<span style="color: #666666">.</span>summary()
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>class_names <span style="color: #666666">=</span> [<span style="color: #BA2121">&#39;airplane&#39;</span>, <span style="color: #BA2121">&#39;automobile&#39;</span>, <span style="color: #BA2121">&#39;bird&#39;</span>, <span style="color: #BA2121">&#39;cat&#39;</span>, <span style="color: #BA2121">&#39;deer&#39;</span>,
<span style="color: #BA2121">&#39;dog&#39;</span>, <span style="color: #BA2121">&#39;frog&#39;</span>, <span style="color: #BA2121">&#39;horse&#39;</span>, <span style="color: #BA2121">&#39;ship&#39;</span>, <span style="color: #BA2121">&#39;truck&#39;</span>]
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">10</span>,<span style="color: #666666">10</span>))
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #666666">25</span>):
plt<span style="color: #666666">.</span>subplot(<span style="color: #666666">5</span>,<span style="color: #666666">5</span>,i<span style="color: #666666">+1</span>)
plt<span style="color: #666666">.</span>xticks([])
plt<span style="color: #666666">.</span>yticks([])
plt<span style="color: #666666">.</span>grid(<span style="color: #008000; font-weight: bold">False</span>)
plt<span style="color: #666666">.</span>imshow(train_images[i], cmap<span style="color: #666666">=</span>plt<span style="color: #666666">.</span>cm<span style="color: #666666">.</span>binary)
<span style="color: #408080; font-style: italic"># The CIFAR labels happen to be arrays, </span>
<span style="color: #408080; font-style: italic"># which is why you need the extra index</span>
plt<span style="color: #666666">.</span>xlabel(class_names[train_labels[i][<span style="color: #666666">0</span>]])
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
You can see that the output of every Conv2D and MaxPooling2D layer is a 3D tensor of shape (height, width, channels). The width and height dimensions tend to shrink as you go deeper in the network. The number of output channels for each Conv2D layer is controlled by the first argument (e.g., 32 or 64). Typically, as the width and height shrink, you can afford (computationally) to add more output channels in each Conv2D layer.
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -223,6 +223,8 @@ You can see that the output of every Conv2D and MaxPooling2D layer is a 3D tenso
<li><a href="._week42-bs028.html">29</a></li>
<li><a href="._week42-bs029.html">30</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs022.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+73 -69
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,29 +175,30 @@ MathJax.Hub.Config({
<a name="part0022"></a>
<!-- !split -->
<h2 id="___sec21" class="anchor">Add Dense layers on top </h2>
<h2 id="___sec21" class="anchor">Set up the model </h2>
<p>
To complete our model, you will feed the last output tensor from the
convolutional base (of shape (4, 4, 64)) into one or more Dense layers
to perform classification. Dense layers take vectors as input (which
are 1D), while the current output is a 3D tensor. First, you will
flatten (or unroll) the 3D output to 1D, then add one or more Dense
layers on top. CIFAR has 10 output classes, so you use a final Dense
layer with 10 outputs and a softmax activation.
The 6 lines of code below define the convolutional base using a common pattern: a stack of Conv2D and MaxPooling2D layers.
<p>
As input, a CNN takes tensors of shape (image_height, image_width, color_channels), ignoring the batch size. If you are new to these dimensions, color_channels refers to (R,G,B). In this example, you will configure our CNN to process inputs of shape (32, 32, 3), which is the format of CIFAR images. You can do this by passing the argument input_shape to our first layer.
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Flatten())
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">64</span>, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">10</span>))
Here<span style="color: #BA2121">&#39;s the complete architecture of our model.</span>
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>model <span style="color: #666666">=</span> models<span style="color: #666666">.</span>Sequential()
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">32</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>, input_shape<span style="color: #666666">=</span>(<span style="color: #666666">32</span>, <span style="color: #666666">32</span>, <span style="color: #666666">3</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D((<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D((<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
<span style="color: #408080; font-style: italic"># Let&#39;s display the architecture of our model so far.</span>
model<span style="color: #666666">.</span>summary()
</pre></div>
<p>
As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers.
You can see that the output of every Conv2D and MaxPooling2D layer is a 3D tensor of shape (height, width, channels). The width and height dimensions tend to shrink as you go deeper in the network. The number of output channels for each Conv2D layer is controlled by the first argument (e.g., 32 or 64). Typically, as the width and height shrink, you can afford (computationally) to add more output channels in each Conv2D layer.
<p>
<p>
@@ -221,6 +224,7 @@ As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (102
<li><a href="._week42-bs028.html">29</a></li>
<li><a href="._week42-bs029.html">30</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs023.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+78 -63
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,18 +175,30 @@ MathJax.Hub.Config({
<a name="part0023"></a>
<!-- !split -->
<h2 id="___sec22" class="anchor">Compile and train the model </h2>
<h2 id="___sec22" class="anchor">Add Dense layers on top </h2>
<p>
To complete our model, you will feed the last output tensor from the
convolutional base (of shape (4, 4, 64)) into one or more Dense layers
to perform classification. Dense layers take vectors as input (which
are 1D), while the current output is a 3D tensor. First, you will
flatten (or unroll) the 3D output to 1D, then add one or more Dense
layers on top. CIFAR has 10 output classes, so you use a final Dense
layer with 10 outputs and a softmax activation.
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>model<span style="color: #666666">.</span>compile(optimizer<span style="color: #666666">=</span><span style="color: #BA2121">&#39;adam&#39;</span>,
loss<span style="color: #666666">=</span>tf<span style="color: #666666">.</span>keras<span style="color: #666666">.</span>losses<span style="color: #666666">.</span>SparseCategoricalCrossentropy(from_logits<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>),
metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">&#39;accuracy&#39;</span>])
history <span style="color: #666666">=</span> model<span style="color: #666666">.</span>fit(train_images, train_labels, epochs<span style="color: #666666">=10</span>,
validation_data<span style="color: #666666">=</span>(test_images, test_labels))
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Flatten())
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">64</span>, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">10</span>))
Here<span style="color: #BA2121">&#39;s the complete architecture of our model.</span>
model<span style="color: #666666">.</span>summary()
</pre></div>
<p>
As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers.
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -208,6 +222,7 @@ history <span style="color: #666666">=</span> model<span style="color: #666666">
<li><a href="._week42-bs028.html">29</a></li>
<li><a href="._week42-bs029.html">30</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs024.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+66 -67
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -173,21 +175,17 @@ MathJax.Hub.Config({
<a name="part0024"></a>
<!-- !split -->
<h2 id="___sec23" class="anchor">Finally, evaluate the model </h2>
<h2 id="___sec23" class="anchor">Compile and train the model </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>plt<span style="color: #666666">.</span>plot(history<span style="color: #666666">.</span>history[<span style="color: #BA2121">&#39;accuracy&#39;</span>], label<span style="color: #666666">=</span><span style="color: #BA2121">&#39;accuracy&#39;</span>)
plt<span style="color: #666666">.</span>plot(history<span style="color: #666666">.</span>history[<span style="color: #BA2121">&#39;val_accuracy&#39;</span>], label <span style="color: #666666">=</span> <span style="color: #BA2121">&#39;val_accuracy&#39;</span>)
plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39;Epoch&#39;</span>)
plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">&#39;Accuracy&#39;</span>)
plt<span style="color: #666666">.</span>ylim([<span style="color: #666666">0.5</span>, <span style="color: #666666">1</span>])
plt<span style="color: #666666">.</span>legend(loc<span style="color: #666666">=</span><span style="color: #BA2121">&#39;lower right&#39;</span>)
test_loss, test_acc <span style="color: #666666">=</span> model<span style="color: #666666">.</span>evaluate(test_images, test_labels, verbose<span style="color: #666666">=2</span>)
<span style="color: #008000">print</span>(test_acc)
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>model<span style="color: #666666">.</span>compile(optimizer<span style="color: #666666">=</span><span style="color: #BA2121">&#39;adam&#39;</span>,
loss<span style="color: #666666">=</span>tf<span style="color: #666666">.</span>keras<span style="color: #666666">.</span>losses<span style="color: #666666">.</span>SparseCategoricalCrossentropy(from_logits<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>),
metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">&#39;accuracy&#39;</span>])
history <span style="color: #666666">=</span> model<span style="color: #666666">.</span>fit(train_images, train_labels, epochs<span style="color: #666666">=10</span>,
validation_data<span style="color: #666666">=</span>(test_images, test_labels))
</pre></div>
<p>
<p>
@@ -211,6 +209,7 @@ test_loss, test_acc <span style="color: #666666">=</span> model<span style="colo
<li><a href="._week42-bs028.html">29</a></li>
<li><a href="._week42-bs029.html">30</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs025.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+60 -58
View File
@@ -46,51 +46,52 @@ Automatically generated HTML file from DocOnce source
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -130,34 +131,35 @@ MathJax.Hub.Config({
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week42-bs001.html#___sec0" style="font-size: 80%;">Plan for week 42</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs002.html#___sec1" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs003.html#___sec2" style="font-size: 80%;">Neural Networks vs CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs004.html#___sec3" style="font-size: 80%;">Regular NNs dont scale well to full images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs005.html#___sec4" style="font-size: 80%;">3D volumes of neurons</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs006.html#___sec5" style="font-size: 80%;">Layers used to build CNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs007.html#___sec6" style="font-size: 80%;">Transforming images</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs008.html#___sec7" style="font-size: 80%;">CNNs in brief</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs009.html#___sec8" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs010.html#___sec9" style="font-size: 80%;">Setting it up</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs011.html#___sec10" style="font-size: 80%;">The MNIST dataset again</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs012.html#___sec11" style="font-size: 80%;">Strong correlations</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs013.html#___sec12" style="font-size: 80%;">Layers of a CNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs014.html#___sec13" style="font-size: 80%;">Systematic reduction</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs015.html#___sec14" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs016.html#___sec15" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs017.html#___sec16" style="font-size: 80%;">Running with Keras</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs018.html#___sec17" style="font-size: 80%;">Final part</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs019.html#___sec18" style="font-size: 80%;">Final visualization</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs020.html#___sec19" style="font-size: 80%;">The CIFAR01 data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs021.html#___sec20" style="font-size: 80%;">Verifying the data set</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs022.html#___sec21" style="font-size: 80%;">Set up the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs023.html#___sec22" style="font-size: 80%;">Add Dense layers on top</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs024.html#___sec23" style="font-size: 80%;">Compile and train the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs025.html#___sec24" style="font-size: 80%;">Finally, evaluate the model</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs026.html#___sec25" style="font-size: 80%;">Recurrent neural networks: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs027.html#___sec26" style="font-size: 80%;">Set up of an RNN</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs028.html#___sec27" style="font-size: 80%;">Solving differential equations and eigenvalue problems with RNNs</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs029.html#___sec28" style="font-size: 80%;">Long-Short Time Memory</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs030.html#___sec29" style="font-size: 80%;">Autoencoders: Overarching view</a></li>
<!-- navigation toc: --> <li><a href="._week42-bs031.html#___sec30" style="font-size: 80%;">Simple examples of Autoencoders</a></li>
</ul>
</li>
@@ -192,7 +194,7 @@ MathJax.Hub.Config({
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Oct 11, 2020</h4></center> <!-- date -->
<center><h4>Oct 12, 2020</h4></center> <!-- date -->
<br>
<p>
@@ -216,7 +218,7 @@ MathJax.Hub.Config({
<li><a href="._week42-bs008.html">9</a></li>
<li><a href="._week42-bs009.html">10</a></li>
<li><a href="">...</a></li>
<li><a href="._week42-bs030.html">31</a></li>
<li><a href="._week42-bs031.html">32</a></li>
<li><a href="._week42-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+67 -29
View File
@@ -148,7 +148,7 @@ MathJax.Hub.Config({
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>&nbsp;<br>
<center><h4>Oct 11, 2020</h4></center> <!-- date -->
<center><h4>Oct 12, 2020</h4></center> <!-- date -->
<br>
<p>
@@ -212,7 +212,45 @@ Another good read is the article here <a href="https://arxiv.org/pdf/1603.07285.
<section>
<h2 id="___sec2">Regular NNs don&#8217;t scale well to full images </h2>
<h2 id="___sec2">Neural Networks vs CNNs </h2>
<p>
Neural networks are defined as <b>affine transformations</b>, that is
a vector is received as input and is multiplied with a matrix of so-called weights (our unknown paramters) to produce an
output (to which a bias vector is usually added before passing the result
through a nonlinear activation function). This is applicable to any type of input, be it an
image, a sound clip or an unordered collection of features: whatever their
dimensionality, their representation can always be flattened into a vector
before the transformation.
<p>
However, when we consider images, sound clips and many other similar kinds of data, these data have an intrinsic
structure. More formally, they share these important properties:
<ul>
<p><li> They are stored as multi-dimensional arrays (think of the pixels of a figure) .</li>
<p><li> They feature one or more axes for which ordering matters (e.g., width and height axes for an image, time axis for a sound clip).</li>
<p><li> One axis, called the channel axis, is used to access different views of the data (e.g., the red, green and blue channels of a color image, or the left and right channels of a stereo audio track).</li>
</ul>
<p>
These properties are not exploited when an affine transformation is applied; in
fact, all the axes are treated in the same way and the topological information
is not taken into account. Still, taking advantage of the implicit structure of
the data may prove very handy in solving some tasks, like computer vision and
speech recognition, and in these cases it would be best to preserve it. This is
where discrete convolutions come into play.
<p>
A discrete convolution is a linear transformation that preserves this notion of
ordering. It is sparse (only a few input units contribute to a given output
unit) and reuses parameters (the same weights are applied to multiple locations
in the input).
</section>
<section>
<h2 id="___sec3">Regular NNs don&#8217;t scale well to full images </h2>
<p>
As an example, consider
@@ -240,7 +278,7 @@ would quickly lead to possible overfitting.
<section>
<h2 id="___sec3">3D volumes of neurons </h2>
<h2 id="___sec4">3D volumes of neurons </h2>
<p>
Convolutional Neural Networks take advantage of the fact that the
@@ -280,7 +318,7 @@ dimension.
<section>
<h2 id="___sec4">Layers used to build CNNs </h2>
<h2 id="___sec5">Layers used to build CNNs </h2>
<p>
A simple CNN is a sequence of layers, and every layer of a CNN
@@ -304,7 +342,7 @@ A simple CNN for image classification could have the architecture:
<section>
<h2 id="___sec5">Transforming images </h2>
<h2 id="___sec6">Transforming images </h2>
<p>
CNNs transform the original image layer by layer from the original
@@ -323,7 +361,7 @@ are consistent with the labels in the training set for each image.
<section>
<h2 id="___sec6">CNNs in brief </h2>
<h2 id="___sec7">CNNs in brief </h2>
<p>
In summary:
@@ -345,7 +383,7 @@ and the slides of <a href="http://cs231n.github.io/convolutional-networks/" targ
<section>
<h2 id="___sec7">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<h2 id="___sec8">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<p>
As discussed above, CNNs are neural networks built from the assumption that the inputs
@@ -361,7 +399,7 @@ matrices, typically 1 for each color dimension (Red, Green, Blue).
<section>
<h2 id="___sec8">Setting it up </h2>
<h2 id="___sec9">Setting it up </h2>
<p>
It means that to represent the entire
@@ -376,7 +414,7 @@ $$
<section>
<h2 id="___sec9">The MNIST dataset again </h2>
<h2 id="___sec10">The MNIST dataset again </h2>
<p>
The MNIST dataset consists of grayscale images with a pixel size of
@@ -394,7 +432,7 @@ single neuron in the first hidden layer.
<section>
<h2 id="___sec10">Strong correlations </h2>
<h2 id="___sec11">Strong correlations </h2>
<p>
Images typically have strong local correlations, meaning that a small
@@ -412,7 +450,7 @@ fixed, and known as a <a href="https://en.wikipedia.org/wiki/Receptive_field" ta
<section>
<h2 id="___sec11">Layers of a CNN </h2>
<h2 id="___sec12">Layers of a CNN </h2>
The layers of a convolutional neural network arrange neurons in 3D: width, height and depth.
The input image is typically a square matrix of depth 3.
@@ -434,7 +472,7 @@ layer.
<section>
<h2 id="___sec12">Systematic reduction </h2>
<h2 id="___sec13">Systematic reduction </h2>
<p>
By systematically reducing the size of the input volume, through
@@ -449,7 +487,7 @@ classification.
<section>
<h2 id="___sec13">Prerequisites: Collect and pre-process data </h2>
<h2 id="___sec14">Prerequisites: Collect and pre-process data </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
@@ -498,7 +536,7 @@ plt.show()
<section>
<h2 id="___sec14">Importing Keras and Tensorflow </h2>
<h2 id="___sec15">Importing Keras and Tensorflow </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
@@ -529,7 +567,7 @@ X_train, X_test, Y_train, Y_test = train_test_split(inputs, labels, train_size=t
<section>
<h2 id="___sec15">Running with Keras </h2>
<h2 id="___sec16">Running with Keras </h2>
<p>
@@ -565,7 +603,7 @@ lmbd_vals = np.logspace(-<span style="color: #B452CD">5</span>, <span style="col
<section>
<h2 id="___sec16">Final part </h2>
<h2 id="___sec17">Final part </h2>
<p>
@@ -591,7 +629,7 @@ lmbd_vals = np.logspace(-<span style="color: #B452CD">5</span>, <span style="col
<section>
<h2 id="___sec17">Final visualization </h2>
<h2 id="___sec18">Final visualization </h2>
<p>
@@ -631,7 +669,7 @@ plt.show()
<section>
<h2 id="___sec18">The CIFAR01 data set </h2>
<h2 id="___sec19">The CIFAR01 data set </h2>
<p>
The CIFAR10 dataset contains 60,000 color images in 10 classes, with
@@ -657,7 +695,7 @@ train_images, test_images = train_images / <span style="color: #B452CD">255.0</s
<section>
<h2 id="___sec19">Verifying the data set </h2>
<h2 id="___sec20">Verifying the data set </h2>
<p>
To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the class name below each image.
@@ -684,7 +722,7 @@ plt.show()
<section>
<h2 id="___sec20">Set up the model </h2>
<h2 id="___sec21">Set up the model </h2>
<p>
The 6 lines of code below define the convolutional base using a common pattern: a stack of Conv2D and MaxPooling2D layers.
@@ -712,7 +750,7 @@ You can see that the output of every Conv2D and MaxPooling2D layer is a 3D tenso
<section>
<h2 id="___sec21">Add Dense layers on top </h2>
<h2 id="___sec22">Add Dense layers on top </h2>
<p>
To complete our model, you will feed the last output tensor from the
@@ -739,7 +777,7 @@ As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (102
<section>
<h2 id="___sec22">Compile and train the model </h2>
<h2 id="___sec23">Compile and train the model </h2>
<p>
@@ -755,7 +793,7 @@ history = model.fit(train_images, train_labels, epochs=<span style="color: #B452
<section>
<h2 id="___sec23">Finally, evaluate the model </h2>
<h2 id="___sec24">Finally, evaluate the model </h2>
<p>
@@ -775,7 +813,7 @@ test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=<span st
<section>
<h2 id="___sec24">Recurrent neural networks: Overarching view </h2>
<h2 id="___sec25">Recurrent neural networks: Overarching view </h2>
<p>
Till now our focus has been, including convolutional neural networks
@@ -800,7 +838,7 @@ systems such as automatic translation and speech-to-text.
<section>
<h2 id="___sec25">Set up of an RNN </h2>
<h2 id="___sec26">Set up of an RNN </h2>
<p>
The figure here displays a simple example of an RNN, with inputs \( x_t \)
@@ -821,7 +859,7 @@ More material will be added here.
<section>
<h2 id="___sec26">Solving differential equations and eigenvalue problems with RNNs </h2>
<h2 id="___sec27">Solving differential equations and eigenvalue problems with RNNs </h2>
<p>
In our discussions of ordinary differential equations and partial
@@ -837,7 +875,7 @@ we start directly with an eigenvaule problem.
<section>
<h2 id="___sec27">Long-Short Time Memory </h2>
<h2 id="___sec28">Long-Short Time Memory </h2>
<p>
Discussions about dynamic unrolling through time. discuss memory cells, input and output
@@ -845,7 +883,7 @@ Discussions about dynamic unrolling through time. discuss memory cells, input an
<section>
<h2 id="___sec28">Autoencoders: Overarching view </h2>
<h2 id="___sec29">Autoencoders: Overarching view </h2>
<p>
Autoencoders are artificial neural networks capable of learning
@@ -877,7 +915,7 @@ learn the identity function under some constraints.
<section>
<h2 id="___sec29">Simple examples of Autoencoders </h2>
<h2 id="___sec30">Simple examples of Autoencoders </h2>
</section>
+95 -57
View File
@@ -40,51 +40,52 @@ div { text-align: justify; text-justify: inter-word; }
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -126,7 +127,7 @@ MathJax.Hub.Config({
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Oct 11, 2020</h4></center> <!-- date -->
<center><h4>Oct 12, 2020</h4></center> <!-- date -->
<br>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
@@ -183,7 +184,44 @@ Another good read is the article here <a href="https://arxiv.org/pdf/1603.07285.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec2">Regular NNs don&#8217;t scale well to full images </h2>
<h2 id="___sec2">Neural Networks vs CNNs </h2>
<p>
Neural networks are defined as <b>affine transformations</b>, that is
a vector is received as input and is multiplied with a matrix of so-called weights (our unknown paramters) to produce an
output (to which a bias vector is usually added before passing the result
through a nonlinear activation function). This is applicable to any type of input, be it an
image, a sound clip or an unordered collection of features: whatever their
dimensionality, their representation can always be flattened into a vector
before the transformation.
<p>
However, when we consider images, sound clips and many other similar kinds of data, these data have an intrinsic
structure. More formally, they share these important properties:
<ul>
<li> They are stored as multi-dimensional arrays (think of the pixels of a figure) .</li>
<li> They feature one or more axes for which ordering matters (e.g., width and height axes for an image, time axis for a sound clip).</li>
<li> One axis, called the channel axis, is used to access different views of the data (e.g., the red, green and blue channels of a color image, or the left and right channels of a stereo audio track).</li>
</ul>
These properties are not exploited when an affine transformation is applied; in
fact, all the axes are treated in the same way and the topological information
is not taken into account. Still, taking advantage of the implicit structure of
the data may prove very handy in solving some tasks, like computer vision and
speech recognition, and in these cases it would be best to preserve it. This is
where discrete convolutions come into play.
<p>
A discrete convolution is a linear transformation that preserves this notion of
ordering. It is sparse (only a few input units contribute to a given output
unit) and reuses parameters (the same weights are applied to multiple locations
in the input).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">Regular NNs don&#8217;t scale well to full images </h2>
<p>
As an example, consider
@@ -211,7 +249,7 @@ would quickly lead to possible overfitting.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">3D volumes of neurons </h2>
<h2 id="___sec4">3D volumes of neurons </h2>
<p>
Convolutional Neural Networks take advantage of the fact that the
@@ -251,7 +289,7 @@ dimension.
<p>
<!-- !split -->
<h2 id="___sec4">Layers used to build CNNs </h2>
<h2 id="___sec5">Layers used to build CNNs </h2>
<p>
A simple CNN is a sequence of layers, and every layer of a CNN
@@ -274,7 +312,7 @@ A simple CNN for image classification could have the architecture:
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec5">Transforming images </h2>
<h2 id="___sec6">Transforming images </h2>
<p>
CNNs transform the original image layer by layer from the original
@@ -293,7 +331,7 @@ are consistent with the labels in the training set for each image.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec6">CNNs in brief </h2>
<h2 id="___sec7">CNNs in brief </h2>
<p>
In summary:
@@ -314,7 +352,7 @@ and the slides of <a href="http://cs231n.github.io/convolutional-networks/" targ
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec7">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<h2 id="___sec8">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<p>
As discussed above, CNNs are neural networks built from the assumption that the inputs
@@ -330,7 +368,7 @@ matrices, typically 1 for each color dimension (Red, Green, Blue).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec8">Setting it up </h2>
<h2 id="___sec9">Setting it up </h2>
<p>
It means that to represent the entire
@@ -342,7 +380,7 @@ $$
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec9">The MNIST dataset again </h2>
<h2 id="___sec10">The MNIST dataset again </h2>
<p>
The MNIST dataset consists of grayscale images with a pixel size of
@@ -360,7 +398,7 @@ single neuron in the first hidden layer.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec10">Strong correlations </h2>
<h2 id="___sec11">Strong correlations </h2>
<p>
Images typically have strong local correlations, meaning that a small
@@ -378,7 +416,7 @@ fixed, and known as a <a href="https://en.wikipedia.org/wiki/Receptive_field" ta
<p>
<!-- !split -->
<h2 id="___sec11">Layers of a CNN </h2>
<h2 id="___sec12">Layers of a CNN </h2>
The layers of a convolutional neural network arrange neurons in 3D: width, height and depth.
The input image is typically a square matrix of depth 3.
@@ -400,7 +438,7 @@ layer.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec12">Systematic reduction </h2>
<h2 id="___sec13">Systematic reduction </h2>
<p>
By systematically reducing the size of the input volume, through
@@ -415,7 +453,7 @@ classification.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec13">Prerequisites: Collect and pre-process data </h2>
<h2 id="___sec14">Prerequisites: Collect and pre-process data </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
@@ -463,7 +501,7 @@ plt.show()
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec14">Importing Keras and Tensorflow </h2>
<h2 id="___sec15">Importing Keras and Tensorflow </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
@@ -493,7 +531,7 @@ X_train, X_test, Y_train, Y_test = train_test_split(inputs, labels, train_size=t
<p>
<!-- !split -->
<h2 id="___sec15">Running with Keras </h2>
<h2 id="___sec16">Running with Keras </h2>
<p>
@@ -528,7 +566,7 @@ lmbd_vals = np.logspace(-<span style="color: #B452CD">5</span>, <span style="col
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec16">Final part </h2>
<h2 id="___sec17">Final part </h2>
<p>
@@ -553,7 +591,7 @@ lmbd_vals = np.logspace(-<span style="color: #B452CD">5</span>, <span style="col
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec17">Final visualization </h2>
<h2 id="___sec18">Final visualization </h2>
<p>
@@ -592,7 +630,7 @@ plt.show()
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec18">The CIFAR01 data set </h2>
<h2 id="___sec19">The CIFAR01 data set </h2>
<p>
The CIFAR10 dataset contains 60,000 color images in 10 classes, with
@@ -617,7 +655,7 @@ train_images, test_images = train_images / <span style="color: #B452CD">255.0</s
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec19">Verifying the data set </h2>
<h2 id="___sec20">Verifying the data set </h2>
<p>
To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the class name below each image.
@@ -643,7 +681,7 @@ plt.show()
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec20">Set up the model </h2>
<h2 id="___sec21">Set up the model </h2>
<p>
The 6 lines of code below define the convolutional base using a common pattern: a stack of Conv2D and MaxPooling2D layers.
@@ -671,7 +709,7 @@ You can see that the output of every Conv2D and MaxPooling2D layer is a 3D tenso
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec21">Add Dense layers on top </h2>
<h2 id="___sec22">Add Dense layers on top </h2>
<p>
To complete our model, you will feed the last output tensor from the
@@ -698,7 +736,7 @@ As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (102
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec22">Compile and train the model </h2>
<h2 id="___sec23">Compile and train the model </h2>
<p>
@@ -713,7 +751,7 @@ history = model.fit(train_images, train_labels, epochs=<span style="color: #B452
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec23">Finally, evaluate the model </h2>
<h2 id="___sec24">Finally, evaluate the model </h2>
<p>
@@ -732,7 +770,7 @@ test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=<span st
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec24">Recurrent neural networks: Overarching view </h2>
<h2 id="___sec25">Recurrent neural networks: Overarching view </h2>
<p>
Till now our focus has been, including convolutional neural networks
@@ -757,7 +795,7 @@ systems such as automatic translation and speech-to-text.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec25">Set up of an RNN </h2>
<h2 id="___sec26">Set up of an RNN </h2>
<p>
The figure here displays a simple example of an RNN, with inputs \( x_t \)
@@ -778,7 +816,7 @@ More material will be added here.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec26">Solving differential equations and eigenvalue problems with RNNs </h2>
<h2 id="___sec27">Solving differential equations and eigenvalue problems with RNNs </h2>
<p>
In our discussions of ordinary differential equations and partial
@@ -794,7 +832,7 @@ we start directly with an eigenvaule problem.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec27">Long-Short Time Memory </h2>
<h2 id="___sec28">Long-Short Time Memory </h2>
<p>
Discussions about dynamic unrolling through time. discuss memory cells, input and output
@@ -802,7 +840,7 @@ Discussions about dynamic unrolling through time. discuss memory cells, input an
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec28">Autoencoders: Overarching view </h2>
<h2 id="___sec29">Autoencoders: Overarching view </h2>
<p>
Autoencoders are artificial neural networks capable of learning
@@ -834,7 +872,7 @@ learn the identity function under some constraints.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec29">Simple examples of Autoencoders </h2>
<h2 id="___sec30">Simple examples of Autoencoders </h2>
<p>
+95 -57
View File
@@ -45,51 +45,52 @@ div { text-align: justify; text-justify: inter-word; }
2,
None,
'___sec1'),
('Neural Networks vs CNNs', 2, None, '___sec2'),
('Regular NNs dont scale well to full images',
2,
None,
'___sec2'),
('3D volumes of neurons', 2, None, '___sec3'),
('Layers used to build CNNs', 2, None, '___sec4'),
('Transforming images', 2, None, '___sec5'),
('CNNs in brief', 2, None, '___sec6'),
'___sec3'),
('3D volumes of neurons', 2, None, '___sec4'),
('Layers used to build CNNs', 2, None, '___sec5'),
('Transforming images', 2, None, '___sec6'),
('CNNs in brief', 2, None, '___sec7'),
('CNNs in more detail, building convolutional neural networks in '
'Tensorflow and Keras',
2,
None,
'___sec7'),
('Setting it up', 2, None, '___sec8'),
('The MNIST dataset again', 2, None, '___sec9'),
('Strong correlations', 2, None, '___sec10'),
('Layers of a CNN', 2, None, '___sec11'),
('Systematic reduction', 2, None, '___sec12'),
'___sec8'),
('Setting it up', 2, None, '___sec9'),
('The MNIST dataset again', 2, None, '___sec10'),
('Strong correlations', 2, None, '___sec11'),
('Layers of a CNN', 2, None, '___sec12'),
('Systematic reduction', 2, None, '___sec13'),
('Prerequisites: Collect and pre-process data',
2,
None,
'___sec13'),
('Importing Keras and Tensorflow', 2, None, '___sec14'),
('Running with Keras', 2, None, '___sec15'),
('Final part', 2, None, '___sec16'),
('Final visualization', 2, None, '___sec17'),
('The CIFAR01 data set', 2, None, '___sec18'),
('Verifying the data set', 2, None, '___sec19'),
('Set up the model', 2, None, '___sec20'),
('Add Dense layers on top', 2, None, '___sec21'),
('Compile and train the model', 2, None, '___sec22'),
('Finally, evaluate the model', 2, None, '___sec23'),
'___sec14'),
('Importing Keras and Tensorflow', 2, None, '___sec15'),
('Running with Keras', 2, None, '___sec16'),
('Final part', 2, None, '___sec17'),
('Final visualization', 2, None, '___sec18'),
('The CIFAR01 data set', 2, None, '___sec19'),
('Verifying the data set', 2, None, '___sec20'),
('Set up the model', 2, None, '___sec21'),
('Add Dense layers on top', 2, None, '___sec22'),
('Compile and train the model', 2, None, '___sec23'),
('Finally, evaluate the model', 2, None, '___sec24'),
('Recurrent neural networks: Overarching view',
2,
None,
'___sec24'),
('Set up of an RNN', 2, None, '___sec25'),
'___sec25'),
('Set up of an RNN', 2, None, '___sec26'),
('Solving differential equations and eigenvalue problems with '
'RNNs',
2,
None,
'___sec26'),
('Long-Short Time Memory', 2, None, '___sec27'),
('Autoencoders: Overarching view', 2, None, '___sec28'),
('Simple examples of Autoencoders', 2, None, '___sec29')]}
'___sec27'),
('Long-Short Time Memory', 2, None, '___sec28'),
('Autoencoders: Overarching view', 2, None, '___sec29'),
('Simple examples of Autoencoders', 2, None, '___sec30')]}
end of tocinfo -->
<body>
@@ -131,7 +132,7 @@ MathJax.Hub.Config({
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Oct 11, 2020</h4></center> <!-- date -->
<center><h4>Oct 12, 2020</h4></center> <!-- date -->
<br>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
@@ -188,7 +189,44 @@ Another good read is the article here <a href="https://arxiv.org/pdf/1603.07285.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec2">Regular NNs don&#8217;t scale well to full images </h2>
<h2 id="___sec2">Neural Networks vs CNNs </h2>
<p>
Neural networks are defined as <b>affine transformations</b>, that is
a vector is received as input and is multiplied with a matrix of so-called weights (our unknown paramters) to produce an
output (to which a bias vector is usually added before passing the result
through a nonlinear activation function). This is applicable to any type of input, be it an
image, a sound clip or an unordered collection of features: whatever their
dimensionality, their representation can always be flattened into a vector
before the transformation.
<p>
However, when we consider images, sound clips and many other similar kinds of data, these data have an intrinsic
structure. More formally, they share these important properties:
<ul>
<li> They are stored as multi-dimensional arrays (think of the pixels of a figure) .</li>
<li> They feature one or more axes for which ordering matters (e.g., width and height axes for an image, time axis for a sound clip).</li>
<li> One axis, called the channel axis, is used to access different views of the data (e.g., the red, green and blue channels of a color image, or the left and right channels of a stereo audio track).</li>
</ul>
These properties are not exploited when an affine transformation is applied; in
fact, all the axes are treated in the same way and the topological information
is not taken into account. Still, taking advantage of the implicit structure of
the data may prove very handy in solving some tasks, like computer vision and
speech recognition, and in these cases it would be best to preserve it. This is
where discrete convolutions come into play.
<p>
A discrete convolution is a linear transformation that preserves this notion of
ordering. It is sparse (only a few input units contribute to a given output
unit) and reuses parameters (the same weights are applied to multiple locations
in the input).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">Regular NNs don&#8217;t scale well to full images </h2>
<p>
As an example, consider
@@ -216,7 +254,7 @@ would quickly lead to possible overfitting.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">3D volumes of neurons </h2>
<h2 id="___sec4">3D volumes of neurons </h2>
<p>
Convolutional Neural Networks take advantage of the fact that the
@@ -256,7 +294,7 @@ dimension.
<p>
<!-- !split -->
<h2 id="___sec4">Layers used to build CNNs </h2>
<h2 id="___sec5">Layers used to build CNNs </h2>
<p>
A simple CNN is a sequence of layers, and every layer of a CNN
@@ -279,7 +317,7 @@ A simple CNN for image classification could have the architecture:
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec5">Transforming images </h2>
<h2 id="___sec6">Transforming images </h2>
<p>
CNNs transform the original image layer by layer from the original
@@ -298,7 +336,7 @@ are consistent with the labels in the training set for each image.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec6">CNNs in brief </h2>
<h2 id="___sec7">CNNs in brief </h2>
<p>
In summary:
@@ -319,7 +357,7 @@ and the slides of <a href="http://cs231n.github.io/convolutional-networks/" targ
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec7">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<h2 id="___sec8">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras </h2>
<p>
As discussed above, CNNs are neural networks built from the assumption that the inputs
@@ -335,7 +373,7 @@ matrices, typically 1 for each color dimension (Red, Green, Blue).
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec8">Setting it up </h2>
<h2 id="___sec9">Setting it up </h2>
<p>
It means that to represent the entire
@@ -347,7 +385,7 @@ $$
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec9">The MNIST dataset again </h2>
<h2 id="___sec10">The MNIST dataset again </h2>
<p>
The MNIST dataset consists of grayscale images with a pixel size of
@@ -365,7 +403,7 @@ single neuron in the first hidden layer.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec10">Strong correlations </h2>
<h2 id="___sec11">Strong correlations </h2>
<p>
Images typically have strong local correlations, meaning that a small
@@ -383,7 +421,7 @@ fixed, and known as a <a href="https://en.wikipedia.org/wiki/Receptive_field" ta
<p>
<!-- !split -->
<h2 id="___sec11">Layers of a CNN </h2>
<h2 id="___sec12">Layers of a CNN </h2>
The layers of a convolutional neural network arrange neurons in 3D: width, height and depth.
The input image is typically a square matrix of depth 3.
@@ -405,7 +443,7 @@ layer.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec12">Systematic reduction </h2>
<h2 id="___sec13">Systematic reduction </h2>
<p>
By systematically reducing the size of the input volume, through
@@ -420,7 +458,7 @@ classification.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec13">Prerequisites: Collect and pre-process data </h2>
<h2 id="___sec14">Prerequisites: Collect and pre-process data </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
@@ -468,7 +506,7 @@ plt<span style="color: #666666">.</span>show()
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec14">Importing Keras and Tensorflow </h2>
<h2 id="___sec15">Importing Keras and Tensorflow </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
@@ -498,7 +536,7 @@ X_train, X_test, Y_train, Y_test <span style="color: #666666">=</span> train_tes
<p>
<!-- !split -->
<h2 id="___sec15">Running with Keras </h2>
<h2 id="___sec16">Running with Keras </h2>
<p>
@@ -533,7 +571,7 @@ lmbd_vals <span style="color: #666666">=</span> np<span style="color: #666666">.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec16">Final part </h2>
<h2 id="___sec17">Final part </h2>
<p>
@@ -558,7 +596,7 @@ lmbd_vals <span style="color: #666666">=</span> np<span style="color: #666666">.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec17">Final visualization </h2>
<h2 id="___sec18">Final visualization </h2>
<p>
@@ -597,7 +635,7 @@ plt<span style="color: #666666">.</span>show()
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec18">The CIFAR01 data set </h2>
<h2 id="___sec19">The CIFAR01 data set </h2>
<p>
The CIFAR10 dataset contains 60,000 color images in 10 classes, with
@@ -622,7 +660,7 @@ train_images, test_images <span style="color: #666666">=</span> train_images <sp
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec19">Verifying the data set </h2>
<h2 id="___sec20">Verifying the data set </h2>
<p>
To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the class name below each image.
@@ -648,7 +686,7 @@ plt<span style="color: #666666">.</span>show()
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec20">Set up the model </h2>
<h2 id="___sec21">Set up the model </h2>
<p>
The 6 lines of code below define the convolutional base using a common pattern: a stack of Conv2D and MaxPooling2D layers.
@@ -676,7 +714,7 @@ You can see that the output of every Conv2D and MaxPooling2D layer is a 3D tenso
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec21">Add Dense layers on top </h2>
<h2 id="___sec22">Add Dense layers on top </h2>
<p>
To complete our model, you will feed the last output tensor from the
@@ -703,7 +741,7 @@ As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (102
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec22">Compile and train the model </h2>
<h2 id="___sec23">Compile and train the model </h2>
<p>
@@ -718,7 +756,7 @@ history <span style="color: #666666">=</span> model<span style="color: #666666">
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec23">Finally, evaluate the model </h2>
<h2 id="___sec24">Finally, evaluate the model </h2>
<p>
@@ -737,7 +775,7 @@ test_loss, test_acc <span style="color: #666666">=</span> model<span style="colo
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec24">Recurrent neural networks: Overarching view </h2>
<h2 id="___sec25">Recurrent neural networks: Overarching view </h2>
<p>
Till now our focus has been, including convolutional neural networks
@@ -762,7 +800,7 @@ systems such as automatic translation and speech-to-text.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec25">Set up of an RNN </h2>
<h2 id="___sec26">Set up of an RNN </h2>
<p>
The figure here displays a simple example of an RNN, with inputs \( x_t \)
@@ -783,7 +821,7 @@ More material will be added here.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec26">Solving differential equations and eigenvalue problems with RNNs </h2>
<h2 id="___sec27">Solving differential equations and eigenvalue problems with RNNs </h2>
<p>
In our discussions of ordinary differential equations and partial
@@ -799,7 +837,7 @@ we start directly with an eigenvaule problem.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec27">Long-Short Time Memory </h2>
<h2 id="___sec28">Long-Short Time Memory </h2>
<p>
Discussions about dynamic unrolling through time. discuss memory cells, input and output
@@ -807,7 +845,7 @@ Discussions about dynamic unrolling through time. discuss memory cells, input an
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec28">Autoencoders: Overarching view </h2>
<h2 id="___sec29">Autoencoders: Overarching view </h2>
<p>
Autoencoders are artificial neural networks capable of learning
@@ -839,7 +877,7 @@ learn the identity function under some constraints.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec29">Simple examples of Autoencoders </h2>
<h2 id="___sec30">Simple examples of Autoencoders </h2>
<p>
Binary file not shown.
+37 -1
View File
@@ -10,7 +10,7 @@
"<!-- Author: --> \n",
"**Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University\n",
"\n",
"Date: **Oct 11, 2020**\n",
"Date: **Oct 12, 2020**\n",
"\n",
"Copyright 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n",
"\n",
@@ -62,6 +62,42 @@
"\n",
"Another good read is the article here <https://arxiv.org/pdf/1603.07285.pdf>. \n",
"\n",
"\n",
"\n",
"\n",
"## Neural Networks vs CNNs\n",
"\n",
"Neural networks are defined as **affine transformations**, that is \n",
"a vector is received as input and is multiplied with a matrix of so-called weights (our unknown paramters) to produce an\n",
"output (to which a bias vector is usually added before passing the result\n",
"through a nonlinear activation function). This is applicable to any type of input, be it an\n",
"image, a sound clip or an unordered collection of features: whatever their\n",
"dimensionality, their representation can always be flattened into a vector\n",
"before the transformation.\n",
"\n",
"However, when we consider images, sound clips and many other similar kinds of data, these data have an intrinsic\n",
"structure. More formally, they share these important properties:\n",
"* They are stored as multi-dimensional arrays (think of the pixels of a figure) .\n",
"\n",
"* They feature one or more axes for which ordering matters (e.g., width and height axes for an image, time axis for a sound clip).\n",
"\n",
"* One axis, called the channel axis, is used to access different views of the data (e.g., the red, green and blue channels of a color image, or the left and right channels of a stereo audio track).\n",
"\n",
"These properties are not exploited when an affine transformation is applied; in\n",
"fact, all the axes are treated in the same way and the topological information\n",
"is not taken into account. Still, taking advantage of the implicit structure of\n",
"the data may prove very handy in solving some tasks, like computer vision and\n",
"speech recognition, and in these cases it would be best to preserve it. This is\n",
"where discrete convolutions come into play.\n",
"\n",
"A discrete convolution is a linear transformation that preserves this notion of\n",
"ordering. It is sparse (only a few input units contribute to a given output\n",
"unit) and reuses parameters (the same weights are applied to multiple locations\n",
"in the input).\n",
"\n",
"\n",
"\n",
"\n",
"## Regular NNs dont scale well to full images\n",
"\n",
"As an example, consider\n",
+36
View File
@@ -49,6 +49,41 @@ and the slides of "CS231":"http://cs231n.github.io/convolutional-networks/".
Another good read is the article here URL:"https://arxiv.org/pdf/1603.07285.pdf".
!split
===== Neural Networks vs CNNs =====
Neural networks are defined as _affine transformations_, that is
a vector is received as input and is multiplied with a matrix of so-called weights (our unknown paramters) to produce an
output (to which a bias vector is usually added before passing the result
through a nonlinear activation function). This is applicable to any type of input, be it an
image, a sound clip or an unordered collection of features: whatever their
dimensionality, their representation can always be flattened into a vector
before the transformation.
However, when we consider images, sound clips and many other similar kinds of data, these data have an intrinsic
structure. More formally, they share these important properties:
* They are stored as multi-dimensional arrays (think of the pixels of a figure) .
* They feature one or more axes for which ordering matters (e.g., width and height axes for an image, time axis for a sound clip).
* One axis, called the channel axis, is used to access different views of the data (e.g., the red, green and blue channels of a color image, or the left and right channels of a stereo audio track).
These properties are not exploited when an affine transformation is applied; in
fact, all the axes are treated in the same way and the topological information
is not taken into account. Still, taking advantage of the implicit structure of
the data may prove very handy in solving some tasks, like computer vision and
speech recognition, and in these cases it would be best to preserve it. This is
where discrete convolutions come into play.
A discrete convolution is a linear transformation that preserves this notion of
ordering. It is sparse (only a few input units contribute to a given output
unit) and reuses parameters (the same weights are applied to multiple locations
in the input).
!split
===== Regular NNs dont scale well to full images =====
@@ -623,3 +658,4 @@ learn the identity function under some constraints.