update on cnn
@@ -279,7 +279,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ The scikit-learn dataset we will use consists of a selection of 1797 images of s
|
||||
|
||||
<p>
|
||||
To feed data into a feed-forward neural network we need to represent
|
||||
the inputs as a feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
the inputs as a design/feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
row represents an <em>input</em>, in this case a handwritten digit, and
|
||||
each column represents a <em>feature</em>, in this case a pixel. The
|
||||
correct answers, also known as <em>labels</em> or <em>targets</em> are
|
||||
@@ -282,7 +282,7 @@ represented as a 1D array of integers
|
||||
<p>
|
||||
As an example, say we want to build a neural network using supervised learning to predict Body-Mass Index (BMI) from
|
||||
measurements of height (in m)
|
||||
and weight (in kg). If we have measurements of 5 people the feature matrix could be for example:
|
||||
and weight (in kg). If we have measurements of 5 people the design/feature matrix could be for example:
|
||||
|
||||
$$ X = \begin{bmatrix}
|
||||
1.85 & 81\\
|
||||
@@ -300,7 +300,7 @@ $$ Y = (23.7, 22.2, 27.1, 17.5, 21.1) $$
|
||||
<p>
|
||||
Since each input image is a 2D matrix, we need to flatten the image
|
||||
(i.e. "unravel" the 2D matrix into a 1D array) to turn the data into a
|
||||
feature matrix. This means we lose all spatial information in the
|
||||
design/feature matrix. This means we lose all spatial information in the
|
||||
image, such as locality and translational invariance. More complicated
|
||||
architectures such as Convolutional Neural Networks can take advantage
|
||||
of such information, and are most commonly applied when analyzing
|
||||
|
||||
@@ -273,9 +273,9 @@ reduces <em>overfitting</em>.
|
||||
<p>
|
||||
We will measure the size of the weights using the so called <em>L2-norm</em>, meaning our cost function becomes:
|
||||
|
||||
$$ \nabla \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
$$ \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
|
||||
<p>
|
||||
i.e. we sum up all the weights squared. The factor \( \lambda \) is known as a regularization parameter.
|
||||
|
||||
@@ -279,7 +279,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
|
||||
@@ -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> <br>
|
||||
<center><h4>Oct 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
@@ -1445,7 +1445,7 @@ The scikit-learn dataset we will use consists of a selection of 1797 images of s
|
||||
|
||||
<p>
|
||||
To feed data into a feed-forward neural network we need to represent
|
||||
the inputs as a feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
the inputs as a design/feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
row represents an <em>input</em>, in this case a handwritten digit, and
|
||||
each column represents a <em>feature</em>, in this case a pixel. The
|
||||
correct answers, also known as <em>labels</em> or <em>targets</em> are
|
||||
@@ -1455,7 +1455,7 @@ represented as a 1D array of integers
|
||||
<p>
|
||||
As an example, say we want to build a neural network using supervised learning to predict Body-Mass Index (BMI) from
|
||||
measurements of height (in m)
|
||||
and weight (in kg). If we have measurements of 5 people the feature matrix could be for example:
|
||||
and weight (in kg). If we have measurements of 5 people the design/feature matrix could be for example:
|
||||
|
||||
<p> <br>
|
||||
$$ X = \begin{bmatrix}
|
||||
@@ -1477,7 +1477,7 @@ $$ Y = (23.7, 22.2, 27.1, 17.5, 21.1) $$
|
||||
<p>
|
||||
Since each input image is a 2D matrix, we need to flatten the image
|
||||
(i.e. "unravel" the 2D matrix into a 1D array) to turn the data into a
|
||||
feature matrix. This means we lose all spatial information in the
|
||||
design/feature matrix. This means we lose all spatial information in the
|
||||
image, such as locality and translational invariance. More complicated
|
||||
architectures such as Convolutional Neural Networks can take advantage
|
||||
of such information, and are most commonly applied when analyzing
|
||||
@@ -1944,9 +1944,9 @@ reduces <em>overfitting</em>.
|
||||
We will measure the size of the weights using the so called <em>L2-norm</em>, meaning our cost function becomes:
|
||||
|
||||
<p> <br>
|
||||
$$ \nabla \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
$$ \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
<p> <br>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -203,7 +203,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -1368,7 +1368,7 @@ The scikit-learn dataset we will use consists of a selection of 1797 images of s
|
||||
|
||||
<p>
|
||||
To feed data into a feed-forward neural network we need to represent
|
||||
the inputs as a feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
the inputs as a design/feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
row represents an <em>input</em>, in this case a handwritten digit, and
|
||||
each column represents a <em>feature</em>, in this case a pixel. The
|
||||
correct answers, also known as <em>labels</em> or <em>targets</em> are
|
||||
@@ -1378,7 +1378,7 @@ represented as a 1D array of integers
|
||||
<p>
|
||||
As an example, say we want to build a neural network using supervised learning to predict Body-Mass Index (BMI) from
|
||||
measurements of height (in m)
|
||||
and weight (in kg). If we have measurements of 5 people the feature matrix could be for example:
|
||||
and weight (in kg). If we have measurements of 5 people the design/feature matrix could be for example:
|
||||
|
||||
$$ X = \begin{bmatrix}
|
||||
1.85 & 81\\
|
||||
@@ -1396,7 +1396,7 @@ $$ Y = (23.7, 22.2, 27.1, 17.5, 21.1) $$
|
||||
<p>
|
||||
Since each input image is a 2D matrix, we need to flatten the image
|
||||
(i.e. "unravel" the 2D matrix into a 1D array) to turn the data into a
|
||||
feature matrix. This means we lose all spatial information in the
|
||||
design/feature matrix. This means we lose all spatial information in the
|
||||
image, such as locality and translational invariance. More complicated
|
||||
architectures such as Convolutional Neural Networks can take advantage
|
||||
of such information, and are most commonly applied when analyzing
|
||||
@@ -1813,9 +1813,9 @@ reduces <em>overfitting</em>.
|
||||
<p>
|
||||
We will measure the size of the weights using the so called <em>L2-norm</em>, meaning our cost function becomes:
|
||||
|
||||
$$ \nabla \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
$$ \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
|
||||
<p>
|
||||
i.e. we sum up all the weights squared. The factor \( \lambda \) is known as a regularization parameter.
|
||||
|
||||
@@ -208,7 +208,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -1373,7 +1373,7 @@ The scikit-learn dataset we will use consists of a selection of 1797 images of s
|
||||
|
||||
<p>
|
||||
To feed data into a feed-forward neural network we need to represent
|
||||
the inputs as a feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
the inputs as a design/feature matrix \( X = (n_{inputs}, n_{features}) \). Each
|
||||
row represents an <em>input</em>, in this case a handwritten digit, and
|
||||
each column represents a <em>feature</em>, in this case a pixel. The
|
||||
correct answers, also known as <em>labels</em> or <em>targets</em> are
|
||||
@@ -1383,7 +1383,7 @@ represented as a 1D array of integers
|
||||
<p>
|
||||
As an example, say we want to build a neural network using supervised learning to predict Body-Mass Index (BMI) from
|
||||
measurements of height (in m)
|
||||
and weight (in kg). If we have measurements of 5 people the feature matrix could be for example:
|
||||
and weight (in kg). If we have measurements of 5 people the design/feature matrix could be for example:
|
||||
|
||||
$$ X = \begin{bmatrix}
|
||||
1.85 & 81\\
|
||||
@@ -1401,7 +1401,7 @@ $$ Y = (23.7, 22.2, 27.1, 17.5, 21.1) $$
|
||||
<p>
|
||||
Since each input image is a 2D matrix, we need to flatten the image
|
||||
(i.e. "unravel" the 2D matrix into a 1D array) to turn the data into a
|
||||
feature matrix. This means we lose all spatial information in the
|
||||
design/feature matrix. This means we lose all spatial information in the
|
||||
image, such as locality and translational invariance. More complicated
|
||||
architectures such as Convolutional Neural Networks can take advantage
|
||||
of such information, and are most commonly applied when analyzing
|
||||
@@ -1818,9 +1818,9 @@ reduces <em>overfitting</em>.
|
||||
<p>
|
||||
We will measure the size of the weights using the so called <em>L2-norm</em>, meaning our cost function becomes:
|
||||
|
||||
$$ \nabla \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \nabla \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
$$ \mathcal{C}(\theta) = \frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) \quad \rightarrow \quad
|
||||
\frac{1}{N} \sum_{i=1}^N \mathcal{L}_i(\theta) + \lambda \lvert \lvert \hat{w} \rvert \rvert_2^2
|
||||
= \frac{1}{N} \sum_{i=1}^N \mathcal{L}(\theta) + \lambda \sum_{ij} w_{ij}^2,$$
|
||||
|
||||
<p>
|
||||
i.e. we sum up all the weights squared. The factor \( \lambda \) is known as a regularization parameter.
|
||||
|
||||
@@ -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 3, 2019**\n",
|
||||
"Date: **Oct 4, 2019**\n",
|
||||
"\n",
|
||||
"Copyright 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n",
|
||||
"\n",
|
||||
@@ -1656,7 +1656,7 @@
|
||||
"The scikit-learn dataset we will use consists of a selection of 1797 images of size $8\\times 8$ collected and processed from this database. \n",
|
||||
"\n",
|
||||
"To feed data into a feed-forward neural network we need to represent\n",
|
||||
"the inputs as a feature matrix $X = (n_{inputs}, n_{features})$. Each\n",
|
||||
"the inputs as a design/feature matrix $X = (n_{inputs}, n_{features})$. Each\n",
|
||||
"row represents an *input*, in this case a handwritten digit, and\n",
|
||||
"each column represents a *feature*, in this case a pixel. The\n",
|
||||
"correct answers, also known as *labels* or *targets* are\n",
|
||||
@@ -1665,7 +1665,7 @@
|
||||
"\n",
|
||||
"As an example, say we want to build a neural network using supervised learning to predict Body-Mass Index (BMI) from\n",
|
||||
"measurements of height (in m) \n",
|
||||
"and weight (in kg). If we have measurements of 5 people the feature matrix could be for example: \n",
|
||||
"and weight (in kg). If we have measurements of 5 people the design/feature matrix could be for example: \n",
|
||||
"\n",
|
||||
"$$ X = \\begin{bmatrix}\n",
|
||||
"1.85 & 81\\\\\n",
|
||||
@@ -1681,7 +1681,7 @@
|
||||
"\n",
|
||||
"Since each input image is a 2D matrix, we need to flatten the image\n",
|
||||
"(i.e. \"unravel\" the 2D matrix into a 1D array) to turn the data into a\n",
|
||||
"feature matrix. This means we lose all spatial information in the\n",
|
||||
"design/feature matrix. This means we lose all spatial information in the\n",
|
||||
"image, such as locality and translational invariance. More complicated\n",
|
||||
"architectures such as Convolutional Neural Networks can take advantage\n",
|
||||
"of such information, and are most commonly applied when analyzing\n",
|
||||
@@ -2077,9 +2077,9 @@
|
||||
"\n",
|
||||
"We will measure the size of the weights using the so called *L2-norm*, meaning our cost function becomes: \n",
|
||||
"\n",
|
||||
"$$ \\nabla \\mathcal{C}(\\theta) = \\frac{1}{N} \\sum_{i=1}^N \\nabla \\mathcal{L}_i(\\theta) \\quad \\rightarrow \\quad\n",
|
||||
"\\frac{1}{N} \\sum_{i=1}^N \\nabla \\mathcal{L}_i(\\theta) + \\lambda \\lvert \\lvert \\hat{w} \\rvert \\rvert_2^2 \n",
|
||||
"= \\frac{1}{N} \\sum_{i=1}^N \\nabla \\mathcal{L}(\\theta) + \\lambda \\sum_{ij} w_{ij}^2,$$ \n",
|
||||
"$$ \\mathcal{C}(\\theta) = \\frac{1}{N} \\sum_{i=1}^N \\mathcal{L}_i(\\theta) \\quad \\rightarrow \\quad\n",
|
||||
"\\frac{1}{N} \\sum_{i=1}^N \\mathcal{L}_i(\\theta) + \\lambda \\lvert \\lvert \\hat{w} \\rvert \\rvert_2^2 \n",
|
||||
"= \\frac{1}{N} \\sum_{i=1}^N \\mathcal{L}(\\theta) + \\lambda \\sum_{ij} w_{ij}^2,$$ \n",
|
||||
"\n",
|
||||
"i.e. we sum up all the weights squared. The factor $\\lambda$ is known as a regularization parameter.\n",
|
||||
"\n",
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0000"></a>
|
||||
<!-- ------------------- main content ---------------------- -->
|
||||
|
||||
|
||||
|
||||
<div class="jumbotron">
|
||||
<center><h1>Convolutional Neural Networks</h1></center> <!-- document title -->
|
||||
|
||||
<p>
|
||||
<!-- author(s): Morten Hjorth-Jensen -->
|
||||
|
||||
<center>
|
||||
<b>Morten Hjorth-Jensen</b> [1, 2]
|
||||
</center>
|
||||
|
||||
<p>
|
||||
<!-- institution(s) -->
|
||||
|
||||
<center>[1] <b>Department of Physics, University of Oslo</b></center>
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p>
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
|
||||
<p><a href="._cnn-bs001.html" class="btn btn-primary btn-lg">Read »</a></p>
|
||||
|
||||
|
||||
</div> <!-- end jumbotron -->
|
||||
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li class="active"><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs001.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright --> © 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0001"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec0" class="anchor">Convolutional Neural Networks (recognizing images) </h2>
|
||||
|
||||
<p>
|
||||
Convolutional Neural Networks (CNN) are very similar to ordinary Neural Networks.
|
||||
|
||||
<p>
|
||||
They are made up of neurons that have learnable weights and
|
||||
biases. Each neuron receives some inputs, performs a dot product and
|
||||
optionally follows it with a non-linearity. The whole network still
|
||||
expresses a single differentiable score function: from the raw image
|
||||
pixels on one end to class scores at the other. And they still have a
|
||||
loss function (for example Softmax) on the last (fully-connected) layer
|
||||
and all the tips/tricks we developed for learning regular Neural
|
||||
Networks still apply (back propagation, gradient descent etc etc).
|
||||
|
||||
<p>
|
||||
What is the difference? <b>CNN architectures make the explicit assumption that
|
||||
the inputs are images, which allows us to encode certain properties
|
||||
into the architecture. These then make the forward function more
|
||||
efficient to implement and vastly reduce the amount of parameters in
|
||||
the network.</b>
|
||||
|
||||
<p>
|
||||
Here we provide only a superficial overview, for the more interested, we recommend highly the course
|
||||
<a href="https://www.uio.no/studier/emner/matnat/ifi/IN5400/index-eng.html" target="_self">IN5400 – Machine Learning for Image Analysis</a>
|
||||
and the slides of <a href="http://cs231n.github.io/convolutional-networks/" target="_self">CS231</a>.
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs000.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li class="active"><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs002.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0002"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec1" class="anchor">Regular NNs don’t scale well to full images </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.
|
||||
|
||||
<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.
|
||||
|
||||
<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>
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs001.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li class="active"><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs003.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0003"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec2" class="anchor">3D volumes of neurons </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.
|
||||
|
||||
<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.
|
||||
|
||||
<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">
|
||||
<li><a href="._cnn-bs002.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li class="active"><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs004.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0004"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec3" class="anchor">Layers used to build CNNs </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.
|
||||
|
||||
<p>
|
||||
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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs003.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li class="active"><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs005.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0005"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec4" class="anchor">Transforming images </h2>
|
||||
|
||||
<p>
|
||||
CNNs transform the original image layer by layer from the original
|
||||
pixel values to the final class scores.
|
||||
|
||||
<p>
|
||||
Observe that some layers contain
|
||||
parameters and other don’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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs004.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li class="active"><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs006.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0006"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec5" class="anchor">CNNs in brief </h2>
|
||||
|
||||
<p>
|
||||
In summary:
|
||||
|
||||
<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’t)</li>
|
||||
<li> Each Layer may or may not have additional hyperparameters (e.g. CONV/FC/POOL do, RELU doesn’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 – 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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs005.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li class="active"><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs007.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0007"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec6" class="anchor">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
|
||||
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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs006.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li class="active"><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs008.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0008"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec7" class="anchor">Setting it up </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) .
|
||||
$$
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs007.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li class="active"><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs009.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0009"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec8" class="anchor">The MNIST dataset again </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.
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs008.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="._cnn-bs001.html">2</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li class="active"><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs010.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0010"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec9" class="anchor">Strong correlations </h2>
|
||||
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>
|
||||
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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs009.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs002.html">3</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li class="active"><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs011.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0011"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec10" 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>
|
||||
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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs010.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs003.html">4</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li class="active"><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs012.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0012"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec11" 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.
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs011.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs004.html">5</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li class="active"><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs013.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0013"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec12" 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: #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">'figure.figsize'</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; font-weight: bold">print</span>(<span style="color: #BA2121">"inputs = (n_inputs, pixel_width, pixel_height, depth) = "</span> <span style="color: #666666">+</span> <span style="color: #008000">str</span>(inputs<span style="color: #666666">.</span>shape))
|
||||
<span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">"labels = (n_inputs) = "</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">'off'</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">'nearest'</span>)
|
||||
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">"Label: </span><span style="color: #BB6688; font-weight: bold">%d</span><span style="color: #BA2121">"</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 -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs012.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs005.html">6</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li class="active"><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs014.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0014"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec13" 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">from</span> <span style="color: #0000FF; font-weight: bold">keras.utils</span> <span style="color: #008000; font-weight: bold">import</span> to_categorical
|
||||
<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"># 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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs013.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs006.html">7</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li class="active"><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs015.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0015"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec14" class="anchor">Using TensorFlow backend </h2>
|
||||
|
||||
<p>
|
||||
We need to define model and architecture and choose cost function and optmizer.
|
||||
<p>
|
||||
|
||||
<!-- code=text (!bc pycid) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>import tensorflow as tf
|
||||
|
||||
class ConvolutionalNeuralNetworkTensorflow:
|
||||
def __init__(
|
||||
self,
|
||||
X_train,
|
||||
Y_train,
|
||||
X_test,
|
||||
Y_test,
|
||||
n_filters=10,
|
||||
n_neurons_connected=50,
|
||||
n_categories=10,
|
||||
receptive_field=3,
|
||||
stride=1,
|
||||
padding=1,
|
||||
epochs=10,
|
||||
batch_size=100,
|
||||
eta=0.1,
|
||||
lmbd=0.0):
|
||||
|
||||
self.global_step = tf.Variable(0, dtype=tf.int32, trainable=False, name='global_step')
|
||||
|
||||
self.X_train = X_train
|
||||
self.Y_train = Y_train
|
||||
self.X_test = X_test
|
||||
self.Y_test = Y_test
|
||||
|
||||
self.n_inputs, self.input_width, self.input_height, self.depth = X_train.shape
|
||||
|
||||
self.n_filters = n_filters
|
||||
self.n_downsampled = int(self.input_width*self.input_height*n_filters / 4)
|
||||
self.n_neurons_connected = n_neurons_connected
|
||||
self.n_categories = n_categories
|
||||
|
||||
self.receptive_field = receptive_field
|
||||
self.stride = stride
|
||||
self.strides = [stride, stride, stride, stride]
|
||||
self.padding = padding
|
||||
|
||||
self.epochs = epochs
|
||||
self.batch_size = batch_size
|
||||
self.iterations = self.n_inputs // self.batch_size
|
||||
self.eta = eta
|
||||
self.lmbd = lmbd
|
||||
|
||||
self.create_placeholders()
|
||||
self.create_CNN()
|
||||
self.create_loss()
|
||||
self.create_optimiser()
|
||||
self.create_accuracy()
|
||||
|
||||
def create_placeholders(self):
|
||||
with tf.name_scope('data'):
|
||||
self.X = tf.placeholder(tf.float32, shape=(None, self.input_width, self.input_height, self.depth), name='X_data')
|
||||
self.Y = tf.placeholder(tf.float32, shape=(None, self.n_categories), name='Y_data')
|
||||
|
||||
def create_CNN(self):
|
||||
with tf.name_scope('CNN'):
|
||||
|
||||
# Convolutional layer
|
||||
self.W_conv = self.weight_variable([self.receptive_field, self.receptive_field, self.depth, self.n_filters], name='conv', dtype=tf.float32)
|
||||
b_conv = self.weight_variable([self.n_filters], name='conv', dtype=tf.float32)
|
||||
z_conv = tf.nn.conv2d(self.X, self.W_conv, self.strides, padding='SAME', name='conv') + b_conv
|
||||
a_conv = tf.nn.relu(z_conv)
|
||||
|
||||
# 2x2 max pooling
|
||||
a_pool = tf.nn.max_pool(a_conv, [1, 2, 2, 1], [1, 2, 2, 1], padding='SAME', name='pool')
|
||||
|
||||
# Fully connected layer
|
||||
a_pool_flat = tf.reshape(a_pool, [-1, self.n_downsampled])
|
||||
self.W_fc = self.weight_variable([self.n_downsampled, self.n_neurons_connected], name='fc', dtype=tf.float32)
|
||||
b_fc = self.bias_variable([self.n_neurons_connected], name='fc', dtype=tf.float32)
|
||||
a_fc = tf.nn.relu(tf.matmul(a_pool_flat, self.W_fc) + b_fc)
|
||||
|
||||
# Output layer
|
||||
self.W_out = self.weight_variable([self.n_neurons_connected, self.n_categories], name='out', dtype=tf.float32)
|
||||
b_out = self.bias_variable([self.n_categories], name='out', dtype=tf.float32)
|
||||
self.z_out = tf.matmul(a_fc, self.W_out) + b_out
|
||||
|
||||
def create_loss(self):
|
||||
with tf.name_scope('loss'):
|
||||
softmax_loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=self.Y, logits=self.z_out))
|
||||
|
||||
regularizer_loss_conv = tf.nn.l2_loss(self.W_conv)
|
||||
regularizer_loss_fc = tf.nn.l2_loss(self.W_fc)
|
||||
regularizer_loss_out = tf.nn.l2_loss(self.W_out)
|
||||
regularizer_loss = self.lmbd*(regularizer_loss_conv + regularizer_loss_fc + regularizer_loss_out)
|
||||
|
||||
self.loss = softmax_loss + regularizer_loss
|
||||
|
||||
def create_accuracy(self):
|
||||
with tf.name_scope('accuracy'):
|
||||
probabilities = tf.nn.softmax(self.z_out)
|
||||
predictions = tf.argmax(probabilities, 1)
|
||||
labels = tf.argmax(self.Y, 1)
|
||||
|
||||
correct_predictions = tf.equal(predictions, labels)
|
||||
correct_predictions = tf.cast(correct_predictions, tf.float32)
|
||||
self.accuracy = tf.reduce_mean(correct_predictions)
|
||||
|
||||
def create_optimiser(self):
|
||||
with tf.name_scope('optimizer'):
|
||||
self.optimizer = tf.train.GradientDescentOptimizer(learning_rate=self.eta).minimize(self.loss, global_step=self.global_step)
|
||||
|
||||
def weight_variable(self, shape, name='', dtype=tf.float32):
|
||||
initial = tf.truncated_normal(shape, stddev=0.1)
|
||||
return tf.Variable(initial, name=name, dtype=dtype)
|
||||
|
||||
def bias_variable(self, shape, name='', dtype=tf.float32):
|
||||
initial = tf.constant(0.1, shape=shape)
|
||||
return tf.Variable(initial, name=name, dtype=dtype)
|
||||
|
||||
def fit(self):
|
||||
data_indices = np.arange(self.n_inputs)
|
||||
|
||||
with tf.Session() as sess:
|
||||
sess.run(tf.global_variables_initializer())
|
||||
for i in range(self.epochs):
|
||||
for j in range(self.iterations):
|
||||
chosen_datapoints = np.random.choice(data_indices, size=self.batch_size, replace=False)
|
||||
batch_X, batch_Y = self.X_train[chosen_datapoints], self.Y_train[chosen_datapoints]
|
||||
|
||||
sess.run([CNN.loss, CNN.optimizer],
|
||||
feed_dict={CNN.X: batch_X,
|
||||
CNN.Y: batch_Y})
|
||||
accuracy = sess.run(CNN.accuracy,
|
||||
feed_dict={CNN.X: batch_X,
|
||||
CNN.Y: batch_Y})
|
||||
step = sess.run(CNN.global_step)
|
||||
|
||||
self.train_loss, self.train_accuracy = sess.run([CNN.loss, CNN.accuracy],
|
||||
feed_dict={CNN.X: self.X_train,
|
||||
CNN.Y: self.Y_train})
|
||||
|
||||
self.test_loss, self.test_accuracy = sess.run([CNN.loss, CNN.accuracy],
|
||||
feed_dict={CNN.X: self.X_test,
|
||||
CNN.Y: self.Y_test})
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs014.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs007.html">8</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li class="active"><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs016.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0016"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec15" class="anchor">Train the model </h2>
|
||||
|
||||
<p>
|
||||
We need now to train the model, evaluate it and test its performance on test data, and eventually include hyperparameters.
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></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>
|
||||
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>)
|
||||
CNN_tf <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> ConvolutionalNeuralNetworkTensorflow(X_train, Y_train, X_test, Y_test,
|
||||
n_filters<span style="color: #666666">=</span>n_filters, n_neurons_connected<span style="color: #666666">=</span>n_neurons_connected,
|
||||
n_categories<span style="color: #666666">=</span>n_categories, epochs<span style="color: #666666">=</span>epochs, batch_size<span style="color: #666666">=</span>batch_size,
|
||||
eta<span style="color: #666666">=</span>eta, lmbd<span style="color: #666666">=</span>lmbd)
|
||||
CNN<span style="color: #666666">.</span>fit()
|
||||
|
||||
<span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">"Learning rate = "</span>, eta)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">"Lambda = "</span>, lmbd)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">"Test accuracy: </span><span style="color: #BB6688; font-weight: bold">%.3f</span><span style="color: #BA2121">"</span> <span style="color: #666666">%</span> CNN<span style="color: #666666">.</span>test_accuracy)
|
||||
<span style="color: #008000; font-weight: bold">print</span>()
|
||||
|
||||
CNN_tf[i][j] <span style="color: #666666">=</span> CNN
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs015.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs008.html">9</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li class="active"><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs017.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0017"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec16" class="anchor">Visualizing the results </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_tf[i][j]
|
||||
|
||||
train_accuracy[i][j] <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>train_accuracy
|
||||
test_accuracy[i][j] <span style="color: #666666">=</span> CNN<span style="color: #666666">.</span>test_accuracy
|
||||
|
||||
|
||||
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">True</span>, ax<span style="color: #666666">=</span>ax, cmap<span style="color: #666666">=</span><span style="color: #BA2121">"viridis"</span>)
|
||||
ax<span style="color: #666666">.</span>set_title(<span style="color: #BA2121">"Training Accuracy"</span>)
|
||||
ax<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">"$\eta$"</span>)
|
||||
ax<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">"$\lambda$"</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">True</span>, ax<span style="color: #666666">=</span>ax, cmap<span style="color: #666666">=</span><span style="color: #BA2121">"viridis"</span>)
|
||||
ax<span style="color: #666666">.</span>set_title(<span style="color: #BA2121">"Test Accuracy"</span>)
|
||||
ax<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">"$\eta$"</span>)
|
||||
ax<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">"$\lambda$"</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs016.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs009.html">10</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li class="active"><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs018.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0018"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec17" 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><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.models</span> <span style="color: #008000; font-weight: bold">import</span> Sequential
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.layers.convolutional</span> <span style="color: #008000; font-weight: bold">import</span> Conv2D
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.layers.convolutional</span> <span style="color: #008000; font-weight: bold">import</span> MaxPooling2D
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.layers</span> <span style="color: #008000; font-weight: bold">import</span> Flatten
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.layers</span> <span style="color: #008000; font-weight: bold">import</span> Dense
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.regularizers</span> <span style="color: #008000; font-weight: bold">import</span> l2
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">keras.optimizers</span> <span style="color: #008000; font-weight: bold">import</span> SGD
|
||||
|
||||
<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(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">'same'</span>,
|
||||
activation<span style="color: #666666">=</span><span style="color: #BA2121">'relu'</span>, kernel_regularizer<span style="color: #666666">=</span>l2(lmbd)))
|
||||
model<span style="color: #666666">.</span>add(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(Flatten())
|
||||
model<span style="color: #666666">.</span>add(Dense(n_neurons_connected, activation<span style="color: #666666">=</span><span style="color: #BA2121">'relu'</span>, kernel_regularizer<span style="color: #666666">=</span>l2(lmbd)))
|
||||
model<span style="color: #666666">.</span>add(Dense(n_categories, activation<span style="color: #666666">=</span><span style="color: #BA2121">'softmax'</span>, kernel_regularizer<span style="color: #666666">=</span>l2(lmbd)))
|
||||
|
||||
sgd <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">'categorical_crossentropy'</span>, optimizer<span style="color: #666666">=</span>sgd, metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">'accuracy'</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>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs017.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs010.html">11</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li class="active"><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs019.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0019"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec18" 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>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,
|
||||
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; font-weight: bold">print</span>(<span style="color: #BA2121">"Learning rate = "</span>, eta)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">"Lambda = "</span>, lmbd)
|
||||
<span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">"Test accuracy: </span><span style="color: #BB6688; font-weight: bold">%.3f</span><span style="color: #BA2121">"</span> <span style="color: #666666">%</span> scores[<span style="color: #666666">1</span>])
|
||||
<span style="color: #008000; font-weight: bold">print</span>()
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs018.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs011.html">12</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li class="active"><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs020.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs021.html#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0020"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec19" class="anchor">Final visualization </h2>
|
||||
|
||||
<p>
|
||||
|
||||
<!-- code=text typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span># visual representation of grid search
|
||||
# uses seaborn heatmap, could probably do this in matplotlib
|
||||
import seaborn as sns
|
||||
|
||||
sns.set()
|
||||
|
||||
train_accuracy = np.zeros((len(eta_vals), len(lmbd_vals)))
|
||||
test_accuracy = np.zeros((len(eta_vals), len(lmbd_vals)))
|
||||
|
||||
for i in range(len(eta_vals)):
|
||||
for j in range(len(lmbd_vals)):
|
||||
CNN = CNN_keras[i][j]
|
||||
|
||||
train_accuracy[i][j] = CNN.evaluate(X_train, Y_train)[1]
|
||||
test_accuracy[i][j] = CNN.evaluate(X_test, Y_test)[1]
|
||||
|
||||
|
||||
fig, ax = plt.subplots(figsize = (10, 10))
|
||||
sns.heatmap(train_accuracy, annot=True, ax=ax, cmap="viridis")
|
||||
ax.set_title("Training Accuracy")
|
||||
ax.set_ylabel("$\eta$")
|
||||
ax.set_xlabel("$\lambda$")
|
||||
plt.show()
|
||||
|
||||
fig, ax = plt.subplots(figsize = (10, 10))
|
||||
sns.heatmap(test_accuracy, annot=True, ax=ax, cmap="viridis")
|
||||
ax.set_title("Test Accuracy")
|
||||
ax.set_ylabel("$\eta$")
|
||||
ax.set_xlabel("$\lambda$")
|
||||
plt.show()
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs019.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs012.html">13</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li class="active"><a href="._cnn-bs020.html">21</a></li>
|
||||
<li><a href="._cnn-bs021.html">22</a></li>
|
||||
<li><a href="._cnn-bs021.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Convolutional Neural Networks">
|
||||
|
||||
<title>Convolutional Neural Networks</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Convolutional Neural Networks (recognizing images)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regular NNs don’t scale well to full images',
|
||||
2,
|
||||
None,
|
||||
'___sec1'),
|
||||
('3D volumes of neurons', 2, None, '___sec2'),
|
||||
('Layers used to build CNNs', 2, None, '___sec3'),
|
||||
('Transforming images', 2, None, '___sec4'),
|
||||
('CNNs in brief', 2, None, '___sec5'),
|
||||
('CNNs in more detail, building convolutional neural networks in '
|
||||
'Tensorflow and Keras',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Setting it up', 2, None, '___sec7'),
|
||||
('The MNIST dataset again', 2, None, '___sec8'),
|
||||
('Strong correlations', 2, None, '___sec9'),
|
||||
('Layers of a CNN', 2, None, '___sec10'),
|
||||
('Systematic reduction', 2, None, '___sec11'),
|
||||
('Prerequisites: Collect and pre-process data',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Importing Keras and Tensorflow', 2, None, '___sec13'),
|
||||
('Using TensorFlow backend', 2, None, '___sec14'),
|
||||
('Train the model', 2, None, '___sec15'),
|
||||
('Visualizing the results', 2, None, '___sec16'),
|
||||
('Running with Keras', 2, None, '___sec17'),
|
||||
('Final part', 2, None, '___sec18'),
|
||||
('Final visualization', 2, None, '___sec19'),
|
||||
('Fun links', 2, None, '___sec20')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
equationNumbers: { autoNumber: "none" },
|
||||
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="cnn-bs.html">Convolutional Neural Networks</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs001.html#___sec0" style="font-size: 80%;">Convolutional Neural Networks (recognizing images)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs002.html#___sec1" style="font-size: 80%;">Regular NNs don’t scale well to full images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs003.html#___sec2" style="font-size: 80%;">3D volumes of neurons</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs004.html#___sec3" style="font-size: 80%;">Layers used to build CNNs</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs005.html#___sec4" style="font-size: 80%;">Transforming images</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs006.html#___sec5" style="font-size: 80%;">CNNs in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs007.html#___sec6" style="font-size: 80%;">CNNs in more detail, building convolutional neural networks in Tensorflow and Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs008.html#___sec7" style="font-size: 80%;">Setting it up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs009.html#___sec8" style="font-size: 80%;">The MNIST dataset again</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs010.html#___sec9" style="font-size: 80%;">Strong correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs011.html#___sec10" style="font-size: 80%;">Layers of a CNN</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs012.html#___sec11" style="font-size: 80%;">Systematic reduction</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs013.html#___sec12" style="font-size: 80%;">Prerequisites: Collect and pre-process data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs014.html#___sec13" style="font-size: 80%;">Importing Keras and Tensorflow</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs015.html#___sec14" style="font-size: 80%;">Using TensorFlow backend</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs016.html#___sec15" style="font-size: 80%;">Train the model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs017.html#___sec16" style="font-size: 80%;">Visualizing the results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs018.html#___sec17" style="font-size: 80%;">Running with Keras</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs019.html#___sec18" style="font-size: 80%;">Final part</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._cnn-bs020.html#___sec19" style="font-size: 80%;">Final visualization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec20" style="font-size: 80%;">Fun links</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0021"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec20" class="anchor">Fun links </h2>
|
||||
|
||||
<ol>
|
||||
<li> <a href="https://arxiv.org/abs/1604.07316" target="_self">Self-Driving cars using a convolutional neural network</a></li>
|
||||
<li> <a href="https://deepdreamgenerator.com/" target="_self">Abstract art using convolutional neural networks</a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._cnn-bs020.html">«</a></li>
|
||||
<li><a href="._cnn-bs000.html">1</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._cnn-bs013.html">14</a></li>
|
||||
<li><a href="._cnn-bs014.html">15</a></li>
|
||||
<li><a href="._cnn-bs015.html">16</a></li>
|
||||
<li><a href="._cnn-bs016.html">17</a></li>
|
||||
<li><a href="._cnn-bs017.html">18</a></li>
|
||||
<li><a href="._cnn-bs018.html">19</a></li>
|
||||
<li><a href="._cnn-bs019.html">20</a></li>
|
||||
<li><a href="._cnn-bs020.html">21</a></li>
|
||||
<li class="active"><a href="._cnn-bs021.html">22</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -167,7 +167,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
@@ -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> <br>
|
||||
<center><h4>Oct 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
@@ -110,7 +110,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
@@ -115,7 +115,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 3, 2019</h4></center> <!-- date -->
|
||||
<center><h4>Oct 4, 2019</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,29 @@
|
||||
@mixin vertical-gradient( $top, $bottom ) {
|
||||
background: $top;
|
||||
background: -moz-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,$top), color-stop(100%,$bottom) );
|
||||
background: -webkit-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: -o-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: -ms-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: linear-gradient( top, $top 0%, $bottom 100% );
|
||||
}
|
||||
|
||||
@mixin horizontal-gradient( $top, $bottom ) {
|
||||
background: $top;
|
||||
background: -moz-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: -webkit-gradient( linear, left top, right top, color-stop(0%,$top), color-stop(100%,$bottom) );
|
||||
background: -webkit-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: -o-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: -ms-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: linear-gradient( left, $top 0%, $bottom 100% );
|
||||
}
|
||||
|
||||
@mixin radial-gradient( $outer, $inner, $type: circle ) {
|
||||
background: $outer;
|
||||
background: -moz-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: -webkit-gradient( radial, center center, 0px, center center, 100%, color-stop(0%,$inner), color-stop(100%,$outer) );
|
||||
background: -webkit-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: -o-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: -ms-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Base settings for all themes that can optionally be
|
||||
// overridden by the super-theme
|
||||
|
||||
// Background of the presentation
|
||||
$backgroundColor: #2b2b2b;
|
||||
|
||||
// Primary/body text
|
||||
$mainFont: 'Lato', sans-serif;
|
||||
$mainFontSize: 30px; /* changed (by hpl) from 36px; */
|
||||
$mainColor: #eee;
|
||||
|
||||
// Headings
|
||||
$headingMargin: 0 0 20px 0;
|
||||
$headingFont: 'League Gothic', Impact, sans-serif;
|
||||
$headingColor: #eee;
|
||||
$headingLineHeight: 0.9em;
|
||||
$headingLetterSpacing: 0.02em;
|
||||
$headingTextTransform: none; /* changed (by hpl) from uppercase; */
|
||||
$headingTextShadow: 0px 0px 6px rgba(0,0,0,0.2);
|
||||
$heading1TextShadow: $headingTextShadow;
|
||||
|
||||
// Links and actions
|
||||
$linkColor: #13DAEC;
|
||||
$linkColorHover: lighten( $linkColor, 20% );
|
||||
|
||||
// Text selection
|
||||
$selectionBackgroundColor: #FF5E99;
|
||||
$selectionColor: #fff;
|
||||
|
||||
// Generates the presentation background, can be overridden
|
||||
// to return a background image or gradient
|
||||
@mixin bodyBackground() {
|
||||
background: $backgroundColor;
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
// Base theme template for reveal.js
|
||||
|
||||
/*********************************************
|
||||
* GLOBAL STYLES
|
||||
*********************************************/
|
||||
|
||||
body {
|
||||
@include bodyBackground();
|
||||
background-color: $backgroundColor;
|
||||
}
|
||||
|
||||
.reveal {
|
||||
font-family: $mainFont;
|
||||
font-size: $mainFontSize;
|
||||
font-weight: normal;
|
||||
letter-spacing: -0.02em;
|
||||
color: $mainColor;
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: $selectionColor;
|
||||
background: $selectionBackgroundColor;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
* HEADERS
|
||||
*********************************************/
|
||||
|
||||
.reveal h1,
|
||||
.reveal h2,
|
||||
.reveal h3,
|
||||
.reveal h4,
|
||||
.reveal h5,
|
||||
.reveal h6 {
|
||||
margin: $headingMargin;
|
||||
color: $headingColor;
|
||||
|
||||
font-family: $headingFont;
|
||||
line-height: $headingLineHeight;
|
||||
letter-spacing: $headingLetterSpacing;
|
||||
|
||||
text-transform: $headingTextTransform;
|
||||
text-shadow: $headingTextShadow;
|
||||
}
|
||||
|
||||
.reveal h1 {
|
||||
line-height: 1.2em; /* added by hpl */
|
||||
text-shadow: $heading1TextShadow;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* LINKS
|
||||
*********************************************/
|
||||
|
||||
.reveal a:not(.image) {
|
||||
color: $linkColor;
|
||||
text-decoration: none;
|
||||
|
||||
-webkit-transition: color .15s ease;
|
||||
-moz-transition: color .15s ease;
|
||||
-ms-transition: color .15s ease;
|
||||
-o-transition: color .15s ease;
|
||||
transition: color .15s ease;
|
||||
}
|
||||
.reveal a:not(.image):hover {
|
||||
color: $linkColorHover;
|
||||
|
||||
text-shadow: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.reveal .roll span:after {
|
||||
color: #fff;
|
||||
background: darken( $linkColor, 15% );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* IMAGES
|
||||
*********************************************/
|
||||
|
||||
.reveal section img {
|
||||
margin: 15px 0px;
|
||||
background: rgba(255,255,255,0.12);
|
||||
border: 4px solid $mainColor;
|
||||
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
|
||||
|
||||
-webkit-transition: all .2s linear;
|
||||
-moz-transition: all .2s linear;
|
||||
-ms-transition: all .2s linear;
|
||||
-o-transition: all .2s linear;
|
||||
transition: all .2s linear;
|
||||
}
|
||||
|
||||
.reveal a:hover img {
|
||||
background: rgba(255,255,255,0.2);
|
||||
border-color: $linkColor;
|
||||
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* NAVIGATION CONTROLS
|
||||
*********************************************/
|
||||
|
||||
.reveal .controls div.navigate-left,
|
||||
.reveal .controls div.navigate-left.enabled {
|
||||
border-right-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-right,
|
||||
.reveal .controls div.navigate-right.enabled {
|
||||
border-left-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-up,
|
||||
.reveal .controls div.navigate-up.enabled {
|
||||
border-bottom-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-down,
|
||||
.reveal .controls div.navigate-down.enabled {
|
||||
border-top-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-left.enabled:hover {
|
||||
border-right-color: $linkColorHover;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-right.enabled:hover {
|
||||
border-left-color: $linkColorHover;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-up.enabled:hover {
|
||||
border-bottom-color: $linkColorHover;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-down.enabled:hover {
|
||||
border-top-color: $linkColorHover;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* PROGRESS BAR
|
||||
*********************************************/
|
||||
|
||||
.reveal .progress {
|
||||
background: rgba(0,0,0,0.2);
|
||||
}
|
||||
.reveal .progress span {
|
||||
background: $linkColor;
|
||||
|
||||
-webkit-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
-moz-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
-ms-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
-o-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
* SLIDE NUMBER
|
||||
*********************************************/
|
||||
.reveal .slide-number {
|
||||
color: $linkColor;
|
||||
}
|
||||
|
||||
|
||||