From 551102b9e71b983a0438994f4de766d3df209340 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sat, 26 Jan 2019 17:57:04 +0100 Subject: [PATCH] CNN Intro presentaiton: Add first draft --- presentations/CNN-Intro/CNN-Intro.tex | 119 +++++++ presentations/CNN-Intro/Makefile | 8 + ...eamercolorthememetropolis-highcontrast.sty | 39 +++ .../CNN-Intro/beamercolorthememetropolis.sty | 138 ++++++++ .../CNN-Intro/beamerfontthememetropolis.sty | 325 ++++++++++++++++++ .../CNN-Intro/beamerinnerthememetropolis.sty | 297 ++++++++++++++++ .../CNN-Intro/beamerouterthememetropolis.sty | 137 ++++++++ .../CNN-Intro/beamerthememetropolis.sty | 107 ++++++ .../CNN-Intro/graphics/convolution-layer.tex | 54 +++ .../CNN-Intro/graphics/convolution-linear.tex | 217 ++++++++++++ presentations/CNN-Intro/pgfplotsthemetol.sty | 123 +++++++ 11 files changed, 1564 insertions(+) create mode 100644 presentations/CNN-Intro/CNN-Intro.tex create mode 100644 presentations/CNN-Intro/Makefile create mode 100644 presentations/CNN-Intro/beamercolorthememetropolis-highcontrast.sty create mode 100644 presentations/CNN-Intro/beamercolorthememetropolis.sty create mode 100644 presentations/CNN-Intro/beamerfontthememetropolis.sty create mode 100644 presentations/CNN-Intro/beamerinnerthememetropolis.sty create mode 100644 presentations/CNN-Intro/beamerouterthememetropolis.sty create mode 100644 presentations/CNN-Intro/beamerthememetropolis.sty create mode 100644 presentations/CNN-Intro/graphics/convolution-layer.tex create mode 100644 presentations/CNN-Intro/graphics/convolution-linear.tex create mode 100644 presentations/CNN-Intro/pgfplotsthemetol.sty diff --git a/presentations/CNN-Intro/CNN-Intro.tex b/presentations/CNN-Intro/CNN-Intro.tex new file mode 100644 index 0000000..9cb1b48 --- /dev/null +++ b/presentations/CNN-Intro/CNN-Intro.tex @@ -0,0 +1,119 @@ +\documentclass{beamer} +\usetheme{metropolis} +\usepackage{hyperref} +\usepackage[utf8]{inputenc} % this is needed for german umlauts +\usepackage[english]{babel} % this is needed for german umlauts +\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf +\usepackage{tikz} +\usetikzlibrary{arrows.meta} +\usetikzlibrary{decorations.pathreplacing} +\usetikzlibrary{positioning} +\usetikzlibrary{decorations.text} +\usetikzlibrary{decorations.pathmorphing} +\usetikzlibrary{shapes.multipart, calc} + +\begin{document} + +\title{Convolutional Neural Networks (CNNs)} +\subtitle{Theory and Applications} +\author{Martin Thoma} +\date{22. February 2019} +\subject{Machine Learning, AI, Neural Networks, Convolutional Neural Networks} + +\frame{\titlepage} + +% \section{Neural Network Basics} +% \subsection{} +\begin{frame}{Artificial Neuron (Perceptron)} + $$f: \mathbb{R}^n \rightarrow \mathbb{R}$$ + \begin{figure}[ht] + \centering + \includegraphics[width=0.8\paperwidth, height=0.7\paperheight, keepaspectratio]{graphics/artificial-neuron.pdf} + \end{figure} + % $$f(x) = ax^2 + bx + c \text{ with } f(0) = 3, f(1) = 2, f(-1) = 6$$ + % \begin{align*} + % \onslide<2->{f(0) &= a \cdot 0^2 + b \cdot 0 + c = 3} &\onslide<3->{\Rightarrow c &= 3\\} + % \onslide<4->{f(1) &= a \cdot 1^2 + b \cdot 1 + 3 = 2} &\onslide<5->{\Rightarrow a &= -1-b\\} + % \onslide<6->{f(-1) &= a \cdot {(-1)}^2 - b + 3 = 6\\} + % \onslide<7->{\Leftrightarrow 3&=a - b\\} + % \onslide<8->{\Leftrightarrow 3&= (-1-b) - b\\} + % \onslide<9->{\Leftrightarrow b&= -2\\} + % \onslide<10>{\Rightarrow \quad f(x) &= x^2 -2 x + 3\\} + % \end{align*} +% \only<1>{$$f: \mathbb{R}^n \rightarrow \mathbb{R}^m$$} +% \only<2>{$$f: \mathbb{R}^2 \rightarrow \mathbb{R}$$ +% # 2x - 1 +% # (x-1)^2 + 1 +% Examples: +% \begin{itemize} +% \item $1 \rightarrow 1$: $f(x) = x$ +% \item $2 \rightarrow 3$: $f(x) = $ +% % \item $3 \rightarrow 3$ +% \end{itemize} +% } +\end{frame} + +\begin{frame}{Multi-Layer Perceptron (MLP)} + $$f: \mathbb{R}^n \rightarrow \mathbb{R}^m$$ + \begin{figure}[ht] + \centering + \includegraphics[width=0.8\paperwidth, height=0.7\paperheight, keepaspectratio]{graphics/perceptron-notation.pdf} + \end{figure} +\end{frame} + +\begin{frame}{} + \begin{itemize}[<+->] + \item Predict housing prices: (bed rooms, size, age) $\rightarrow$ Price + \item Product categorization: (weight, volume, price) $\rightarrow$ \{shoe, handbag, shirt\} + \item Image classification: List of pixel colors $\rightarrow$ \{cat, dog\} + \end{itemize} +\end{frame} + +\begin{frame}{} + \begin{center} + \Huge Data + \end{center} +\end{frame} + +\begin{frame}{Necessary Data} + \begin{itemize} + \item $f(x) = w_0$ + \item $f(x) = w_1 \cdot x + w_0$ + \item $f(x) = w_2^2 \cdot x^2 + w_1^2 \cdot x + w_0$ + \item sin, cos, tan, \dots + \end{itemize} +\end{frame} + +\begin{frame}{Convolution} +\begin{figure}[ht] + \centering + \includegraphics[width=0.8\paperwidth]{graphics/convolution-linear.pdf} +\end{figure} +\end{frame} + +\begin{frame}{Convolutional Layer} +\begin{figure}[ht] + \centering + \input{graphics/convolution-layer} +\end{figure} +\end{frame} + +\begin{frame}{Max Pooling} +\begin{figure}[ht] + \centering + \includegraphics[width=0.8\paperwidth]{graphics/max-pooling.pdf} +\end{figure} +\end{frame} + +\section{Applications} +\begin{frame}{Symbol recognizer} + \begin{center} + \href{http://write-math.com}{write-math.com} + \end{center} +\end{frame} + +\begin{frame}{Symbol recognizer} +GANs +\end{frame} + +\end{document} diff --git a/presentations/CNN-Intro/Makefile b/presentations/CNN-Intro/Makefile new file mode 100644 index 0000000..052284c --- /dev/null +++ b/presentations/CNN-Intro/Makefile @@ -0,0 +1,8 @@ +SOURCE = CNN-Intro + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.out *.glo *.glg *.gls *.ist *.xdy *.1 *.toc *.snm *.nav *.vrb *.fls *.fdb_latexmk *.pyg diff --git a/presentations/CNN-Intro/beamercolorthememetropolis-highcontrast.sty b/presentations/CNN-Intro/beamercolorthememetropolis-highcontrast.sty new file mode 100644 index 0000000..85665dc --- /dev/null +++ b/presentations/CNN-Intro/beamercolorthememetropolis-highcontrast.sty @@ -0,0 +1,39 @@ +%% +%% This is file `beamercolorthememetropolis-highcontrast.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% beamercolorthememetropolis-highcontrast.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{beamercolorthememetropolis-highcontrast}[2017/01/23 Metropolis color theme] +\usecolortheme{metropolis} + +\definecolor{mAlert}{HTML}{AD003D} +\definecolor{mExample}{HTML}{005580} + +\setbeamercolor{normal text}{% + fg=black, + bg=white +} +\setbeamercolor{alerted text}{% + fg=mAlert, +} +\setbeamercolor{example text}{% + fg=mExample, +} +\mode +\endinput +%% +%% End of file `beamercolorthememetropolis-highcontrast.sty'. diff --git a/presentations/CNN-Intro/beamercolorthememetropolis.sty b/presentations/CNN-Intro/beamercolorthememetropolis.sty new file mode 100644 index 0000000..0645845 --- /dev/null +++ b/presentations/CNN-Intro/beamercolorthememetropolis.sty @@ -0,0 +1,138 @@ +%% +%% This is file `beamercolorthememetropolis.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% beamercolorthememetropolis.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{beamercolorthememetropolis}[2017/01/23 Metropolis color theme] +\RequirePackage{pgfopts} +\pgfkeys{ + /metropolis/color/block/.cd, + .is choice, + transparent/.code=\metropolis@block@transparent, + fill/.code=\metropolis@block@fill, +} +\pgfkeys{ + /metropolis/color/background/.cd, + .is choice, + dark/.code=\metropolis@colors@dark, + light/.code=\metropolis@colors@light, +} +\newcommand{\metropolis@color@setdefaults}{ + \pgfkeys{/metropolis/color/.cd, + background=light, + block=transparent, + } +} +\definecolor{mDarkBrown}{HTML}{604c38} +\definecolor{mDarkTeal}{HTML}{2C3F6B} +\definecolor{mLightBrown}{HTML}{7473BD} +\definecolor{mLightGreen}{HTML}{14B03D} +\newcommand{\metropolis@colors@dark}{ + \setbeamercolor{normal text}{% + fg=black!2, + bg=mDarkTeal + } + \usebeamercolor[fg]{normal text} +} +\newcommand{\metropolis@colors@light}{ + \setbeamercolor{normal text}{% + fg=mDarkTeal, + bg=black!2 + } +} +\setbeamercolor{alerted text}{% + fg=mLightBrown +} +\setbeamercolor{example text}{% + fg=mLightGreen +} +\setbeamercolor{titlelike}{use=normal text, parent=normal text} +\setbeamercolor{author}{use=normal text, parent=normal text} +\setbeamercolor{date}{use=normal text, parent=normal text} +\setbeamercolor{institute}{use=normal text, parent=normal text} +\setbeamercolor{structure}{use=normal text, fg=normal text.fg} +\setbeamercolor{palette primary}{% + use=normal text, + fg=normal text.bg, + bg=normal text.fg +} +\setbeamercolor{frametitle}{% + use=palette primary, + parent=palette primary +} +\setbeamercolor{progress bar}{% + use=alerted text, + fg=alerted text.fg, + bg=alerted text.fg!50!black!30 +} +\setbeamercolor{title separator}{ + use=progress bar, + parent=progress bar +} +\setbeamercolor{progress bar in head/foot}{% + use=progress bar, + parent=progress bar +} +\setbeamercolor{progress bar in section page}{ + use=progress bar, + parent=progress bar +} +\newcommand{\metropolis@block@transparent}{ + \setbeamercolor{block title}{% + use=normal text, + fg=normal text.fg, + bg= + } + \setbeamercolor{block body}{ + bg= + } +} +\newcommand{\metropolis@block@fill}{ + \setbeamercolor{block title}{% + use=normal text, + fg=normal text.fg, + bg=normal text.bg!80!fg + } + \setbeamercolor{block body}{ + use={block title, normal text}, + bg=block title.bg!50!normal text.bg + } +} +\setbeamercolor{block title alerted}{% + use={block title, alerted text}, + bg=block title.bg, + fg=alerted text.fg +} +\setbeamercolor{block title example}{% + use={block title, example text}, + bg=block title.bg, + fg=example text.fg +} +\setbeamercolor{block body alerted}{use=block body, parent=block body} +\setbeamercolor{block body example}{use=block body, parent=block body} +\setbeamercolor{footnote}{fg=normal text.fg!90} +\setbeamercolor{footnote mark}{fg=.} +\setbeamercolor{bibliography entry author}{fg=, bg=} +\setbeamercolor{bibliography entry title}{fg=, bg=} +\setbeamercolor{bibliography entry location}{fg=, bg=} +\setbeamercolor{bibliography entry note}{fg=, bg=} +\metropolis@color@setdefaults +\ProcessPgfPackageOptions{/metropolis/color} +\mode +\endinput +%% +%% End of file `beamercolorthememetropolis.sty'. diff --git a/presentations/CNN-Intro/beamerfontthememetropolis.sty b/presentations/CNN-Intro/beamerfontthememetropolis.sty new file mode 100644 index 0000000..15cced3 --- /dev/null +++ b/presentations/CNN-Intro/beamerfontthememetropolis.sty @@ -0,0 +1,325 @@ +%% +%% This is file `beamerfontthememetropolis.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% beamerfontthememetropolis.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{beamerfontthememetropolis}[2017/01/23 Metropolis font theme] +\RequirePackage{etoolbox} +\RequirePackage{ifxetex} +\RequirePackage{ifluatex} +\RequirePackage{pgfopts} +\ifboolexpr{bool {xetex} or bool {luatex}}{ + \@ifpackageloaded{fontspec}{ + \PassOptionsToPackage{no-math}{fontspec} + }{ + \RequirePackage[no-math]{fontspec} + } + \newcounter{fontsnotfound} + \newcommand{\checkfont}[1]{% + \suppressfontnotfounderror=1% + \font\x = "#1" at 10pt + \selectfont + \ifx\x\nullfont% + \stepcounter{fontsnotfound}% + \fi% + \suppressfontnotfounderror=0% + } + + \newcommand{\iffontsavailable}[3]{% + \setcounter{fontsnotfound}{0}% + \expandafter\forcsvlist\expandafter% + \checkfont\expandafter{#1}% + \ifnum\value{fontsnotfound}=0% + #2% + \else% + #3% + \fi% + } + \iffontsavailable{Fira Sans Light,% + Fira Sans Light Italic,% + Fira Sans,% + Fira Sans Italic}% + {% + \setsansfont[ItalicFont={Fira Sans Light Italic},% + BoldFont={Fira Sans},% + BoldItalicFont={Fira Sans Italic}]% + {Fira Sans Light}% + }{% + \iffontsavailable{Fira Sans Light OT,% + Fira Sans Light Italic OT,% + Fira Sans OT,% + Fira Sans Italic OT}% + {% + \setsansfont[ItalicFont={Fira Sans Light Italic OT},% + BoldFont={Fira Sans OT},% + BoldItalicFont={Fira Sans Italic OT}]% + {Fira Sans Light OT}% + }{% + \PackageWarning{beamerthememetropolis}{% + Could not find Fira Sans fonts% + } + } + } + \iffontsavailable{Fira Mono, Fira Mono Bold}{% + \setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}% + }{% + \iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{% + \setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}% + }{% + \PackageWarning{beamerthememetropolis}{% + Could not find Fira Mono fonts% + } + } + } + \AtBeginEnvironment{tabular}{% + \addfontfeature{Numbers={Monospaced}}% + } +}{% + \PackageWarning{beamerthememetropolis}{% + You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts% + } +} +\setbeamerfont{title}{size=\Large,% + series=\bfseries} +\setbeamerfont{author}{size=\small} +\setbeamerfont{date}{size=\small} +\setbeamerfont{section title}{size=\Large,% + series=\bfseries} +\setbeamerfont{block title}{size=\normalsize,% + series=\bfseries} +\setbeamerfont{block title alerted}{size=\normalsize,% + series=\bfseries} +\setbeamerfont*{subtitle}{size=\large} +\setbeamerfont{frametitle}{size=\large,% + series=\bfseries} +\setbeamerfont{caption}{size=\small} +\setbeamerfont{caption name}{series=\bfseries} +\setbeamerfont{description item}{series=\bfseries} +\setbeamerfont{page number in head/foot}{size=\scriptsize} +\setbeamerfont{bibliography entry author}{size=\normalsize,% + series=\normalfont} +\setbeamerfont{bibliography entry title}{size=\normalsize,% + series=\bfseries} +\setbeamerfont{bibliography entry location}{size=\normalsize,% + series=\normalfont} +\setbeamerfont{bibliography entry note}{size=\small,% + series=\normalfont} +\setbeamerfont{standout}{size=\Large,% + series=\bfseries} +\pgfkeys{ + /metropolis/font/titleformat title/.cd, + .is choice, + regular/.code={% + \let\metropolis@titleformat\@empty% + \setbeamerfont{title}{shape=\normalfont}% + }, + smallcaps/.code={% + \let\metropolis@titleformat\@empty% + \setbeamerfont{title}{shape=\scshape}% + }, + allsmallcaps/.code={% + \let\metropolis@titleformat\lowercase% + \setbeamerfont{title}{shape=\scshape}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat title=allsmallcaps can lead to problems% + } + }, + allcaps/.code={% + \let\metropolis@titleformat\uppercase% + \setbeamerfont{title}{shape=\normalfont} + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat title=allcaps can lead to problems% + } + }, +} +\pgfkeys{ + /metropolis/font/titleformat subtitle/.cd, + .is choice, + regular/.code={% + \let\metropolis@subtitleformat\@empty% + \setbeamerfont{subtitle}{shape=\normalfont}% + }, + smallcaps/.code={% + \let\metropolis@subtitleformat\@empty% + \setbeamerfont{subtitle}{shape=\scshape}% + }, + allsmallcaps/.code={% + \let\metropolis@subtitleformat\lowercase% + \setbeamerfont{subtitle}{shape=\scshape}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat subtitle=allsmallcaps can lead to problems% + } + }, + allcaps/.code={% + \let\metropolis@subtitleformat\uppercase% + \setbeamerfont{subtitle}{shape=\normalfont}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat subtitle=allcaps can lead to problems% + } + }, +} +\pgfkeys{ + /metropolis/font/titleformat section/.cd, + .is choice, + regular/.code={% + \let\metropolis@sectiontitleformat\@empty% + \setbeamerfont{section title}{shape=\normalfont}% + }, + smallcaps/.code={% + \let\metropolis@sectiontitleformat\@empty% + \setbeamerfont{section title}{shape=\scshape}% + }, + allsmallcaps/.code={% + \let\metropolis@sectiontitleformat\MakeLowercase% + \setbeamerfont{section title}{shape=\scshape}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat section=allsmallcaps can lead to problems% + } + }, + allcaps/.code={% + \let\metropolis@sectiontitleformat\MakeUppercase% + \setbeamerfont{section title}{shape=\normalfont}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat section=allcaps can lead to problems% + } + }, +} +\pgfkeys{ + /metropolis/font/titleformat frame/.cd, + .is choice, + regular/.code={% + \let\metropolis@frametitleformat\@empty% + \setbeamerfont{frametitle}{shape=\normalfont}% + }, + smallcaps/.code={% + \let\metropolis@frametitleformat\@empty% + \setbeamerfont{frametitle}{shape=\scshape}% + }, + allsmallcaps/.code={% + \let\metropolis@frametitleformat\MakeLowercase% + \setbeamerfont{frametitle}{shape=\scshape}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat frame=allsmallcaps can lead to problems% + } + }, + allcaps/.code={% + \let\metropolis@frametitleformat\MakeUppercase% + \setbeamerfont{frametitle}{shape=\normalfont} + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat frame=allcaps can lead to problems% + } + }, +} +\pgfkeys{ + /metropolis/font/.cd, + titleformattitle/.code=\pgfkeysalso{titleformat title=#1}, + titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1}, + titleformatsection/.code=\pgfkeysalso{titleformat section=#1}, + titleformatframe/.code=\pgfkeysalso{titleformat frame=#1}, +} +\newcommand{\metropolis@font@setdefaults}{ + \pgfkeys{/metropolis/font/.cd, + titleformat title=regular, + titleformat subtitle=regular, + titleformat section=regular, + titleformat frame=regular, + } +} +\def\metropolis@titleformat#1{#1} +\def\metropolis@subtitleformat#1{#1} +\def\metropolis@sectiontitleformat#1{#1} +\def\metropolis@frametitleformat#1{#1} +\patchcmd{\beamer@title}% + {\def\inserttitle{#2}}% + {\def\inserttitle{\metropolis@titleformat{#2}}}% + {}% + {\PackageError{beamerfontthememetropolis}{Patching title failed}\@ehc} +\patchcmd{\beamer@subtitle}% + {\def\insertsubtitle{#2}}% + {\def\insertsubtitle{\metropolis@subtitleformat{#2}}}% + {}% + {\PackageError{beamerfontthememetropolis}{Patching subtitle failed}\@ehc} +\patchcmd{\sectionentry} + {\def\insertsectionhead{#2}} + {\def\insertsectionhead{\metropolis@sectiontitleformat{#2}}} + {} + {\PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc} +\@tempswafalse +\patchcmd{\beamer@section} + {\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}} + {\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{% + \noexpand\metropolis@sectiontitleformat{\unexpanded{#1}}}}} + {\@tempswatrue} + {} +\patchcmd{\beamer@section} + {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}} + {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{% + \metropolis@sectiontitleformat{#1}}}} + {\@tempswatrue} + {} +\patchcmd{\beamer@section} + {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}} + {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{% + \noexpand\metropolis@sectiontitleformat{#1}}}} + {\@tempswatrue} + {} +\if@tempswa\else + \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc +\fi +\@tempswafalse +\patchcmd{\beamer@subsection} + {\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}} + {\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{% + \noexpand\metropolis@sectiontitleformat{\unexpanded{#1}}}}} + {\@tempswatrue} + {} +\patchcmd{\beamer@subsection} + {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}} + {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{% + \metropolis@sectiontitleformat{#1}}}} + {\@tempswatrue} + {} +\patchcmd{\beamer@subsection} + {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}} + {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{% + \noexpand\metropolis@sectiontitleformat{#1}}}} + {\@tempswatrue} + {} +\if@tempswa\else + \PackageError{beamerfontthememetropolis}{Patching section title failed}\@ehc +\fi +\patchcmd{\beamer@@frametitle} + {{% + \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space% + \usebeamertemplate*{frametitle continuation}\fi}}% + \gdef\beamer@frametitle{#2}% + \gdef\beamer@shortframetitle{#1}% + }} + {{% + \gdef\insertframetitle{{\metropolis@frametitleformat{#2}\ifnum% + \beamer@autobreakcount>0\relax{}\space% + \usebeamertemplate*{frametitle continuation}\fi}}% + \gdef\beamer@frametitle{#2}% + \gdef\beamer@shortframetitle{#1}% + }} + {} + {\PackageError{beamerfontthememetropolis}{Patching frame title failed}\@ehc} +\metropolis@font@setdefaults +\ProcessPgfPackageOptions{/metropolis/font} +\endinput +%% +%% End of file `beamerfontthememetropolis.sty'. diff --git a/presentations/CNN-Intro/beamerinnerthememetropolis.sty b/presentations/CNN-Intro/beamerinnerthememetropolis.sty new file mode 100644 index 0000000..415b46f --- /dev/null +++ b/presentations/CNN-Intro/beamerinnerthememetropolis.sty @@ -0,0 +1,297 @@ +%% +%% This is file `beamerinnerthememetropolis.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% beamerinnerthememetropolis.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{beamerinnerthememetropolis}[2017/01/23 Metropolis inner theme] +\RequirePackage{etoolbox} +\RequirePackage{keyval} +\RequirePackage{calc} +\RequirePackage{pgfopts} +\RequirePackage{tikz} +\pgfkeys{ + /metropolis/inner/sectionpage/.cd, + .is choice, + none/.code=\metropolis@disablesectionpage, + simple/.code={\metropolis@enablesectionpage + \setbeamertemplate{section page}[simple]}, + progressbar/.code={\metropolis@enablesectionpage + \setbeamertemplate{section page}[progressbar]}, +} +\pgfkeys{ + /metropolis/inner/subsectionpage/.cd, + .is choice, + none/.code=\metropolis@disablesubsectionpage, + simple/.code={\metropolis@enablesubsectionpage + \setbeamertemplate{section page}[simple]}, + progressbar/.code={\metropolis@enablesubsectionpage + \setbeamertemplate{section page}[progressbar]}, +} +\newcommand{\metropolis@inner@setdefaults}{ + \pgfkeys{/metropolis/inner/.cd, + sectionpage=progressbar, + subsectionpage=none + } +} +\setbeamertemplate{title page}{ + \begin{minipage}[b][\paperheight]{\textwidth} + \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi + \vfill% + \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi + \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi + \usebeamertemplate*{title separator} + \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi + \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi + \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi + \vfill + \vspace*{1mm} + \end{minipage} +} +\def\maketitle{% + \ifbeamer@inframe + \titlepage + \else + \frame[plain,noframenumbering]{\titlepage} + \fi +} +\def\titlepage{% + \usebeamertemplate{title page} +} +\setbeamertemplate{title graphic}{ + \vbox to 0pt { + \vspace*{2em} + \inserttitlegraphic% + }% + \nointerlineskip% +} +\setbeamertemplate{title}{ + \raggedright% + \linespread{1.0}% + \inserttitle% + \par% + \vspace*{0.5em} +} +\setbeamertemplate{subtitle}{ + \raggedright% + \insertsubtitle% + \par% + \vspace*{0.5em} +} +\newlength{\metropolis@titleseparator@linewidth} +\setlength{\metropolis@titleseparator@linewidth}{0.4pt} +\setbeamertemplate{title separator}{ + \tikzexternaldisable% + \begin{tikzpicture} + \fill[fg] (0,0) rectangle (\textwidth, \metropolis@titleseparator@linewidth); + \end{tikzpicture}% + \tikzexternalenable% + \par% +} +\setbeamertemplate{author}{ + \vspace*{2em} + \insertauthor% + \par% + \vspace*{0.25em} +} +\setbeamertemplate{date}{ + \insertdate% + \par% +} +\setbeamertemplate{institute}{ + \vspace*{3mm} + \insertinstitute% + \par% +} +\defbeamertemplate{section page}{simple}{ + \begin{center} + \usebeamercolor[fg]{section title} + \usebeamerfont{section title} + \insertsectionhead\par + \ifx\insertsubsectionhead\@empty\else + \usebeamercolor[fg]{subsection title} + \usebeamerfont{subsection title} + \insertsubsectionhead + \fi + \end{center} +} +\defbeamertemplate{section page}{progressbar}{ + \centering + \begin{minipage}{22em} + \raggedright + \usebeamercolor[fg]{section title} + \usebeamerfont{section title} + \insertsectionhead\\[-1ex] + \usebeamertemplate*{progress bar in section page} + \par + \ifx\insertsubsectionhead\@empty\else% + \usebeamercolor[fg]{subsection title}% + \usebeamerfont{subsection title}% + \insertsubsectionhead + \fi + \end{minipage} + \par + \vspace{\baselineskip} +} +\newcommand{\metropolis@disablesectionpage}{ + \AtBeginSection{ + % intentionally empty + } +} +\newcommand{\metropolis@enablesectionpage}{ + \AtBeginSection{ + \ifbeamer@inframe + \sectionpage + \else + \frame[plain,c,noframenumbering]{\sectionpage} + \fi + } +} +\setbeamertemplate{subsection page}{% + \usebeamertemplate*{section page} +} +\newcommand{\metropolis@disablesubsectionpage}{ + \AtBeginSubsection{ + % intentionally empty + } +} +\newcommand{\metropolis@enablesubsectionpage}{ + \AtBeginSubsection{ + \ifbeamer@inframe + \subsectionpage + \else + \frame[plain,c,noframenumbering]{\subsectionpage} + \fi + } +} +\newlength{\metropolis@progressonsectionpage} +\newlength{\metropolis@progressonsectionpage@linewidth} +\setlength{\metropolis@progressonsectionpage@linewidth}{0.4pt} +\setbeamertemplate{progress bar in section page}{ + \setlength{\metropolis@progressonsectionpage}{% + \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% + }% + \tikzexternaldisable% + \begin{tikzpicture} + \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth); + \fill[fg] (0,0) rectangle (\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth); + \end{tikzpicture}% + \tikzexternalenable% +} +\def\inserttotalframenumber{100} +\newlength{\metropolis@blocksep} +\newlength{\metropolis@blockadjust} +\setlength{\metropolis@blocksep}{0.75ex} +\setlength{\metropolis@blockadjust}{0.25ex} +\providecommand{\metropolis@strut}{% + \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}% +} +\newcommand{\metropolis@block}[1]{ + \par\vskip\medskipamount% + \setlength{\parskip}{0pt} + \ifbeamercolorempty[bg]{block title#1}{% + \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}}{% + \ifbeamercolorempty[bg]{block title}{% + \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}% + }% + {% + \begin{beamercolorbox}[ + sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax, + leftskip=\metropolis@blockadjust, + rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax + ]{block title#1}% + }}% + \usebeamerfont*{block title#1}% + \metropolis@strut% + \insertblocktitle% + \metropolis@strut% + \end{beamercolorbox}% + \nointerlineskip% + \ifbeamercolorempty[bg]{block body#1}{% + \begin{beamercolorbox}[vmode]{block body#1}}{ + \ifbeamercolorempty[bg]{block body}{% + \begin{beamercolorbox}[vmode]{block body#1}% + }{% + \begin{beamercolorbox}[sep=\metropolis@blocksep, vmode]{block body#1}% + \vspace{-\metropolis@parskip} + }}% + \usebeamerfont{block body#1}% + \setlength{\parskip}{\metropolis@parskip}% +} +\setbeamertemplate{block begin}{\metropolis@block{}} +\setbeamertemplate{block alerted begin}{\metropolis@block{ alerted}} +\setbeamertemplate{block example begin}{\metropolis@block{ example}} +\setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}} +\setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}} +\setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}} +\setbeamertemplate{itemize items}{\textbullet} +\setbeamertemplate{caption label separator}{: } +\setbeamertemplate{caption}[numbered] +\setbeamertemplate{footnote}{% + \parindent 0em\noindent% + \raggedright + \usebeamercolor{footnote}\hbox to 0.8em{\hfil\insertfootnotemark}\insertfootnotetext\par% +} +\newlength{\metropolis@parskip} +\setlength{\metropolis@parskip}{0.5em} +\setlength{\parskip}{\metropolis@parskip} +\linespread{1.15} +\define@key{beamerframe}{c}[true]{% centered + \beamer@frametopskip=0pt plus 1fill\relax% + \beamer@framebottomskip=0pt plus 1fill\relax% + \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax% + \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax% + \def\beamer@initfirstlineunskip{}% +} +\providebool{metropolis@standout} +\define@key{beamerframe}{standout}[true]{% + \booltrue{metropolis@standout} + \begingroup + \setkeys{beamerframe}{c} + \setkeys{beamerframe}{noframenumbering} + \ifbeamercolorempty[bg]{palette primary}{ + \setbeamercolor{background canvas}{ + use=palette primary, + bg=-palette primary.fg + } + }{ + \setbeamercolor{background canvas}{ + use=palette primary, + bg=palette primary.bg + } + } + \setbeamercolor{local structure}{ + fg=palette primary.fg + } + \usebeamercolor[fg]{palette primary} +} + \pretocmd{\beamer@reseteecodes}{% + \ifbool{metropolis@standout}{ + \endgroup + \boolfalse{metropolis@standout} + }{} + }{}{} + \AtBeginEnvironment{beamer@frameslide}{ + \ifbool{metropolis@standout}{ + \centering + \usebeamerfont{standout} + }{} + } +\metropolis@inner@setdefaults +\ProcessPgfPackageOptions{/metropolis/inner} +\endinput +%% +%% End of file `beamerinnerthememetropolis.sty'. diff --git a/presentations/CNN-Intro/beamerouterthememetropolis.sty b/presentations/CNN-Intro/beamerouterthememetropolis.sty new file mode 100644 index 0000000..928a122 --- /dev/null +++ b/presentations/CNN-Intro/beamerouterthememetropolis.sty @@ -0,0 +1,137 @@ +%% +%% This is file `beamerouterthememetropolis.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% beamerouterthememetropolis.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{beamerouterthememetropolis}[2017/01/23 Metropolis outer theme] +\RequirePackage{etoolbox} +\RequirePackage{calc} +\RequirePackage{pgfopts} +\pgfkeys{ + /metropolis/outer/numbering/.cd, + .is choice, + none/.code=\setbeamertemplate{frame numbering}[none], + counter/.code=\setbeamertemplate{frame numbering}[counter], + fraction/.code=\setbeamertemplate{frame numbering}[fraction], +} +\pgfkeys{ + /metropolis/outer/progressbar/.cd, + .is choice, + none/.code={% + \setbeamertemplate{headline}[plain] + \setbeamertemplate{frametitle}[plain] + \setbeamertemplate{footline}[plain] + }, + head/.code={\pgfkeys{/metropolis/outer/progressbar=none} + \addtobeamertemplate{headline}{}{% + \usebeamertemplate*{progress bar in head/foot} + } + }, + frametitle/.code={\pgfkeys{/metropolis/outer/progressbar=none} + \addtobeamertemplate{frametitle}{}{% + \usebeamertemplate*{progress bar in head/foot} + } + }, + foot/.code={\pgfkeys{/metropolis/outer/progressbar=none} + \addtobeamertemplate{footline}{}{% + \usebeamertemplate*{progress bar in head/foot}% + } + }, +} +\newcommand{\metropolis@outer@setdefaults}{ + \pgfkeys{/metropolis/outer/.cd, + numbering=counter, + progressbar=none, + } +} +\setbeamertemplate{navigation symbols}{} +\defbeamertemplate{frame footer}{none}{} +\defbeamertemplate{frame footer}{custom}[1]{ #1 } +\defbeamertemplate{frame numbering}{none}{} +\defbeamertemplate{frame numbering}{counter}{\insertframenumber} +\defbeamertemplate{frame numbering}{fraction}{ + \insertframenumber/\inserttotalframenumber +} +\defbeamertemplate{headline}{plain}{} +\defbeamertemplate{footline}{plain}{% + \begin{beamercolorbox}[wd=\textwidth, sep=3ex]{footline}% + \usebeamerfont{page number in head/foot}% + \usebeamertemplate*{frame footer} + \hfill% + \usebeamertemplate*{frame numbering} + \end{beamercolorbox}% +} +\newlength{\metropolis@frametitle@padding} +\setlength{\metropolis@frametitle@padding}{2.2ex} +\newcommand{\metropolis@frametitlestrut@start}{ + \rule{0pt}{\metropolis@frametitle@padding +% + \totalheightof{% + \ifcsdef{metropolis@frametitleformat}{\metropolis@frametitleformat X}{X}% + }% + }% +} +\newcommand{\metropolis@frametitlestrut@end}{ + \rule[-\metropolis@frametitle@padding]{0pt}{\metropolis@frametitle@padding} +} +\defbeamertemplate{frametitle}{plain}{% + \nointerlineskip% + \begin{beamercolorbox}[% + wd=\paperwidth,% + sep=0pt,% + leftskip=\metropolis@frametitle@padding,% + rightskip=\metropolis@frametitle@padding,% + ]{frametitle}% + \metropolis@frametitlestrut@start% + \insertframetitle% + \nolinebreak% + \metropolis@frametitlestrut@end% + \end{beamercolorbox}% +} +\setbeamertemplate{frametitle continuation}{% + \usebeamerfont{frametitle} + \romannumeral \insertcontinuationcount +} +\newlength{\metropolis@progressinheadfoot} +\newlength{\metropolis@progressinheadfoot@linewidth} +\setlength{\metropolis@progressinheadfoot@linewidth}{0.4pt} +\setbeamertemplate{progress bar in head/foot}{ + \nointerlineskip + \setlength{\metropolis@progressinheadfoot}{% + \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% + }% + \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot} + \tikzexternaldisable% + \begin{tikzpicture} + \fill[bg] (0,0) rectangle (\paperwidth, \metropolis@progressinheadfoot@linewidth); + \fill[fg] (0,0) rectangle (\metropolis@progressinheadfoot, \metropolis@progressinheadfoot@linewidth); + \end{tikzpicture}% + \tikzexternalenable% + \end{beamercolorbox} +} +\AtBeginDocument{% + \apptocmd{\appendix}{% + \pgfkeys{% + /metropolis/outer/.cd, + numbering=none, + progressbar=none} + }{}{} +} +\metropolis@outer@setdefaults +\ProcessPgfPackageOptions{/metropolis/outer} +\endinput +%% +%% End of file `beamerouterthememetropolis.sty'. diff --git a/presentations/CNN-Intro/beamerthememetropolis.sty b/presentations/CNN-Intro/beamerthememetropolis.sty new file mode 100644 index 0000000..9fbe86e --- /dev/null +++ b/presentations/CNN-Intro/beamerthememetropolis.sty @@ -0,0 +1,107 @@ +%% +%% This is file `beamerthememetropolis.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% beamerthememetropolis.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{beamerthememetropolis} + [2017/01/23 v1.2 Metropolis Beamer theme] +\RequirePackage{etoolbox} +\RequirePackage{pgfopts} +\pgfkeys{/metropolis/.cd, + .search also={ + /metropolis/inner, + /metropolis/outer, + /metropolis/color, + /metropolis/font, + } +} +\pgfkeys{ + /metropolis/titleformat plain/.cd, + .is choice, + regular/.code={% + \let\metropolis@plaintitleformat\@empty% + \setbeamerfont{standout}{shape=\normalfont}% + }, + smallcaps/.code={% + \let\metropolis@plaintitleformat\@empty% + \setbeamerfont{standout}{shape=\scshape}% + }, + allsmallcaps/.code={% + \let\metropolis@plaintitleformat\MakeLowercase% + \setbeamerfont{standout}{shape=\scshape}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat plain=allsmallcaps can lead to problems% + } + }, + allcaps/.code={% + \let\metropolis@plaintitleformat\MakeUppercase% + \setbeamerfont{standout}{shape=\normalfont}% + \PackageWarning{beamerthememetropolis}{% + Be aware that titleformat plain=allcaps can lead to problems% + } + }, +} +\pgfkeys{ + /metropolis/titleformat/.code=\pgfkeysalso{ + font/titleformat title=#1, + font/titleformat subtitle=#1, + font/titleformat section=#1, + font/titleformat frame=#1, + titleformat plain=#1, + } +} +\pgfkeys{/metropolis/.cd, + usetitleprogressbar/.code=\pgfkeysalso{outer/progressbar=frametitle}, + noslidenumbers/.code=\pgfkeysalso{outer/numbering=none}, + usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction}, + nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none}, + darkcolors/.code=\pgfkeysalso{color/background=dark}, + blockbg/.code=\pgfkeysalso{color/block=fill, inner/block=fill}, +} +\newcommand{\metropolis@setdefaults}{ + \pgfkeys{/metropolis/.cd, + titleformat plain=regular, + } +} +\providecommand{\tikzexternalenable}{} +\providecommand{\tikzexternaldisable}{} +\useinnertheme{metropolis} +\useoutertheme{metropolis} +\usecolortheme{metropolis} +\usefonttheme{metropolis} +\AtEndPreamble{% + \@ifpackageloaded{pgfplots}{% + \RequirePackage{pgfplotsthemetol} + }{} +} +\newcommand{\metroset}[1]{\pgfkeys{/metropolis/.cd,#1}} +\def\metropolis@plaintitleformat#1{#1} +\newcommand{\plain}[2][]{% + \PackageWarning{beamerthememetropolis}{% + The syntax `\plain' may be deprecated in a future version of Metropolis. + Please use a frame with [standout] instead. + } + \begin{frame}[standout]{#1} + \metropolis@plaintitleformat{#2} + \end{frame} +} +\newcommand{\mreducelistspacing}{\vspace{-\topsep}} +\metropolis@setdefaults +\ProcessPgfOptions{/metropolis} +\endinput +%% +%% End of file `beamerthememetropolis.sty'. diff --git a/presentations/CNN-Intro/graphics/convolution-layer.tex b/presentations/CNN-Intro/graphics/convolution-layer.tex new file mode 100644 index 0000000..cfe6029 --- /dev/null +++ b/presentations/CNN-Intro/graphics/convolution-layer.tex @@ -0,0 +1,54 @@ +\newcommand{\distance}{6} +\newcommand{\xup}{3.5} +\newcommand{\yup}{6} +\newcommand{\upsizex}{1} +\newcommand{\upsizey}{2} +\newcommand{\upshift}{3/4*\upsizey} +\newcommand{\distancedots}{1} + +\begin{tikzpicture}[scale=0.6] + % Print input feature maps + \foreach \i in {0, 0.2, ..., 0.6} { + \draw[fill=white] (0+\i, 0) -- (2+\i, 3) -- (2+\i, 7) -- (\i, 4) -- (\i, 0); + } + + % Print filters + \foreach \i in {0, 0.2, ..., 0.6, 1.3} { + \draw[fill=white] (\xup+\i, \yup) -- (\xup+\upsizex+\i, \yup+\upshift) -- (\xup+\upsizex+\i, \yup+\upsizey+\upshift) -- (\xup+\i, \yup+\upsizey) -- (\xup+\i, \yup); + \draw[fill=white] (\xup+\i, \yup) -- (\xup+\i+0.1, \yup) -- (\xup+\i+0.1, \yup+\upsizey) -- (\xup+\i, \yup+\upsizey) -- (\xup+\i, \yup); + \draw[fill=white] (\xup+\i+0.1, \yup) -- (\xup+\upsizex+\i+0.1, \yup+\upshift) -- (\xup+\upsizex+\i+0.1, \yup+\upsizey+\upshift) -- (\xup+\i+0.1, \yup+\upsizey) -- (\xup+\i+0.1, \yup); + \draw[fill=white] (\xup+\i, \yup+\upsizey) -- (\xup+\i+0.1, \yup+\upsizey) -- (\xup+\upsizex+\i+0.1, \yup+\upsizey+\upshift) -- (\xup+\upsizex+\i, \yup+\upsizey+\upshift) -- (\xup+\i, \yup+\upsizey); + } + + \foreach \i in {0, 0.2, ..., 0.6, 1.2} { + \draw[fill=white] (\distance+\i, 0) -- (\distance+2+\i, 3) -- (\distance+2+\i, 7) -- (\distance+\i, 4) -- (\distance+\i, 0); + } + + \draw [decorate,decoration={brace,amplitude=+4pt,mirror},xshift=0pt,yshift=-2pt] +(-0.1,0) -- (0.7,0) node [black,midway,yshift=-0.6cm, align=center] {\footnotesize$3$ feature maps\\\footnotesize(e.g. RGB)}; + \draw [decorate,decoration={brace,amplitude=+4pt,mirror},xshift=0pt,yshift=-2pt] +(\distance-0.1,0) -- (\distance+1.3,0) node [black,midway,yshift=-0.6cm, align=center] {\footnotesize$n$ feature maps}; + \draw [decorate,decoration={brace,amplitude=+4pt},xshift=0pt,yshift=+2pt] +(\xup-0.1+\upsizex,\yup+\upsizey+\upshift) -- (\xup+1.5+\upsizex,\yup+\upsizey+\upshift) node [black,midway,yshift=+0.6cm, align=center] {\footnotesize $n$ filters of\\\footnotesize size $k \times k \times 3$}; + \draw[very thick, ->,>=latex] (3, 4.5) [out=70, in=110] to (\distance-0.5, 4.5); + \draw [color=white,decorate,decoration={brace,amplitude=+4pt, mirror},xshift=0pt,yshift=+2pt] +(1.1, 0) -- (3.1, 3) node [sloped,black,midway,yshift=+0.6cm, align=center] {width $w$}; + \draw [color=white,decorate,decoration={brace,amplitude=+4pt, mirror},xshift=0pt,yshift=+2pt] +(\distance+1.7, 0) -- (\distance+3.7, 3) node [sloped,black,midway,yshift=+0.6cm, align=center] {width $w$}; + \draw [decorate,decoration={brace,amplitude=+4pt},xshift=-2pt,yshift=0pt] +(0, 0) -- (0, 4) node [sloped,black,midway,yshift=+0.6cm, align=center] {height $h$}; + \draw [decorate,decoration={brace,amplitude=+4pt},xshift=-2pt,yshift=0pt] +(\distance, 0) -- (\distance, 4) node [sloped,black,midway,yshift=+0.6cm, align=center] {height $h$}; + \node at (-2.5,7.5) {\Large neural}; + \node at (-2.5,7) {\Large network}; + \node at (-2.5,2) {\Large data}; + + \node at (+4.3,5.5) {apply}; + \node at (\distance+0.95,3.9) {\dots}; + \node at (\distance+0.95,2) {\dots}; + \node at (\distance+0.95,0.1) {\dots}; + + \node at (\xup+1.05,\yup+1.9) {\dots}; + \node at (\xup+1.05,\yup+1.0) {\dots}; + \node at (\xup+1.05,\yup+0.1) {\dots}; +\end{tikzpicture} diff --git a/presentations/CNN-Intro/graphics/convolution-linear.tex b/presentations/CNN-Intro/graphics/convolution-linear.tex new file mode 100644 index 0000000..0ce13ac --- /dev/null +++ b/presentations/CNN-Intro/graphics/convolution-linear.tex @@ -0,0 +1,217 @@ + +\newcommand{\filtersize}{3} +\newcommand{\filterx}{8} +\newcommand{\filtery}{2.2} +\newcommand{\filteroffset}{1} + +\newcommand{\filterxres}{12} + +\newcommand{\imagesize}{7} +\newcommand{\imagex}{0} +\newcommand{\imagey}{0} +\newcommand{\imageoffset}{2} + +\newcommand{\outx}{16} +\newcommand{\outy}{0} +\newcommand{\outoffset}{2} + +\newcommand{\percx}{1} +\newcommand{\percy}{2} +\begin{tikzpicture}[scale=0.6] + \tikzstyle{point}=[draw=none,inner sep=0pt] + + + % draw perceptive field + \node (p1)[point] at (\imagex+\percx, + \imagey+\percy+\percx*\imageoffset/\imagesize) {}; + \node (p2)[point] at (\imagex+\percx+\filtersize, + \imagey+\percy+\percx*\imageoffset/\imagesize+\filtersize*\imageoffset/\imagesize) {}; + \node (p3)[point,blue] at (\imagex+\percx+\filtersize, + \imagey+\percy+\filtersize+\percx*\imageoffset/\imagesize+\filtersize*\imageoffset/\imagesize) {}; + \node (p4)[point] at (\imagex+\percx, + \imagey+\percy+\filtersize+\percx*\imageoffset/\imagesize) {}; + \draw[fill=gray] (p1.center) -- (p2.center) -- (p3.center) -- (p4.center) -- (p1.center); + + % draw output point + \node (o1)[point] at (\outx+\percx+1, + \outy+\percy+\percx*\outoffset/\imagesize+1+1*\outoffset/\imagesize) {}; + \node (o2)[point] at (\outx+\percx+2, + \outy+\percy+\percx*\outoffset/\imagesize+1*\outoffset/\imagesize+1+1*\outoffset/\imagesize) {}; + \node (o3)[point,blue] at (\outx+\percx+2, + \outy+\percy+1+\percx*\outoffset/\imagesize+1*\outoffset/\imagesize+1+1*\outoffset/\imagesize) {}; + \node (o4)[point] at (\outx+\percx+1, + \outy+\percy+2+\percx*\outoffset/\imagesize+1*\outoffset/\imagesize) {}; + \draw[fill=gray] (o1.center) -- (o2.center) -- (o3.center) -- (o4.center) -- (o1.center); + + % draw image + \foreach \x in {0,...,\imagesize} + { + \draw (\imagex+\x, \imagey+\x*\imageoffset/\imagesize) -- (\imagex+\x, \imagey+\imagesize+\x*\imageoffset/\imagesize); + \draw (\imagex, \imagey+\x) -- (\imagex+\imagesize, \imagey+\x+\imageoffset); + } + + % draw filter + \foreach \x in {0,...,\filtersize} + { + \draw (\filterx+\x, \filtery+\x*\filteroffset/\filtersize) -- (\filterx+\x, \filtery+\filtersize+\x*\filteroffset/\filtersize); + \draw (\filterx, \filtery+\x) -- (\filterx+\filtersize, \filtery+\x+\filteroffset); + } + + % draw filter result + \foreach \x in {0,...,\filtersize} + { + \draw (\filterxres+\x, \filtery+\x*\filteroffset/\filtersize) -- (\filterxres+\x, \filtery+\filtersize+\x*\filteroffset/\filtersize); + \draw (\filterxres, \filtery+\x) -- (\filterxres+\filtersize, \filtery+\x+\filteroffset); + } + + % draw out + \foreach \x in {0,...,\imagesize} + { + \draw (\outx+\x, \outy+\x*\outoffset/\imagesize) -- (\outx+\x, \outy+\imagesize+\x*\outoffset/\imagesize); + \draw (\outx, \outy+\x) -- (\outx+\imagesize, \outy+\x+\outoffset); + } + + \node at (\imagex + \imagesize/2,\imagey + \imagesize + 2) {\Huge $I \in \mathbb{R}^{\imagesize \times \imagesize}$}; + \node[text width=4cm, align=center] at (\filterx + \filtersize/2,\filtery + \filtersize - 4) {\large Filter kernel\\$F \in \mathbb{R}^{\filtersize \times \filtersize}$}; + \node[text width=4cm, align=center] at (\filterx + 4 + \filtersize/2,\filtery + \filtersize - 4) {\large Result of point-wise multiplication}; + \node at (\outx + \imagesize/2,\outy + \imagesize + 2) {\Huge $I' \in \mathbb{R}^{\imagesize \times \imagesize}$}; + + % Start image (left to right, top to bottom) + \node[draw=none] at (0.5, 6.6) {\large 104}; + \node[draw=none] at (1.5, 6.9) {\large 116}; + \node[draw=none] at (2.5, 7.2) {\large 116}; + \node[draw=none] at (3.5, 7.5) {\large 112}; + \node[draw=none] at (4.5, 7.8) {\large 58}; + \node[draw=none] at (5.5, 8.1) {\large 47}; + \node[draw=none] at (6.5, 8.4) {\large 47};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \node[draw=none] at (0.5, 5.6) {\large 109}; + \node[draw=none] at (1.5, 5.9) {\large 97}; + \node[draw=none] at (2.5, 6.2) {\large 114}; + \node[draw=none] at (3.5, 6.5) {\large 116}; + \node[draw=none] at (4.5, 6.8) {\large 105}; + \node[draw=none] at (5.5, 7.1) {\large 110}; + \node[draw=none] at (6.5, 7.4) {\large 45};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \node[draw=none] at (0.5, 4.6) {\large 116}; + \node[draw=none] at (1.5, 4.9) {\large 104}; + \node[draw=none] at (2.5, 5.2) {\large 111}; + \node[draw=none] at (3.5, 5.5) {\large 109}; + \node[draw=none] at (4.5, 5.8) {\large 97}; + \node[draw=none] at (5.5, 6.1) {\large 46}; + \node[draw=none] at (6.5, 6.4) {\large 100};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \node[draw=none] at (0.5, 3.6) {\large 101}; + \node[draw=none] at (1.5, 3.9) {\large 47}; + \node[draw=none] at (2.5, 4.2) {\large 109}; + \node[draw=none] at (3.5, 4.5) {\large 97}; + \node[draw=none] at (4.5, 4.8) {\large 115}; + \node[draw=none] at (5.5, 5.1) {\large 116}; + \node[draw=none] at (6.5, 5.4) {\large 101};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \node[draw=none] at (0.5, 2.6) {\large 114}; + \node[draw=none] at (1.5, 2.9) {\large 47}; + \node[draw=none] at (2.5, 3.2) {\large 99}; + \node[draw=none] at (3.5, 3.5) {\large 97}; + \node[draw=none] at (4.5, 3.8) {\large 116}; + \node[draw=none] at (5.5, 4.1) {\large 99}; + \node[draw=none] at (6.5, 4.4) {\large 97};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \node[draw=none] at (0.5, 1.6) {\large 116}; + \node[draw=none] at (1.5, 1.9) {\large 99}; + \node[draw=none] at (2.5, 2.2) {\large 97}; + \node[draw=none] at (3.5, 2.5) {\large 116}; + \node[draw=none] at (4.5, 2.8) {\large 46}; + \node[draw=none] at (5.5, 3.1) {\large 112}; + \node[draw=none] at (6.5, 3.4) {\large 104};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \node[draw=none] at (0.5, 0.6) {\large 112}; + \node[draw=none] at (1.5, 0.9) {\large 63}; + \node[draw=none] at (2.5, 1.2) {\large 118}; + \node[draw=none] at (3.5, 1.5) {\large 61}; + \node[draw=none] at (4.5, 1.8) {\large 49}; + \node[draw=none] at (5.5, 2.1) {\large 46}; + \node[draw=none] at (6.5, 2.4) {\large 48};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + % Filter + \node[draw=none] at ( 8.5, 4.8) {\large 9}; + \node[draw=none] at ( 9.5, 5.1) {\large -3}; + \node[draw=none] at (10.5, 5.4) {\large -1};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \node[draw=none] at ( 8.5, 3.8) {\large -6}; + \node[draw=none] at ( 9.5, 4.1) {\large 5}; + \node[draw=none] at (10.5, 4.4) {\large 3};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \node[draw=none] at ( 8.5, 2.8) {\large 2}; + \node[draw=none] at ( 9.5, 3.1) {\large -8}; + \node[draw=none] at (10.5, 3.4) {\large 0};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + % Result + \node[draw=none] at (12.5, 4.8) {\large 936}; + \node[draw=none] at (13.5, 5.1) {\large -333}; + \node[draw=none] at (14.5, 5.4) {\large -109};%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \node[draw=none] at (12.5, 3.8) {\large -282}; + \node[draw=none] at (13.5, 4.1) {\large 545}; + \node[draw=none] at (14.5, 4.4) {\large 291};%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \node[draw=none] at (12.5, 2.8) {\large 94}; + \node[draw=none] at (13.5, 3.1) {\large -792}; + \node[draw=none] at (14.5, 3.4) {\large 0};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % Result image (left to right, top to bottom) + % [[ -4 -254 -498 -662 -849 -642 -187] + \node[draw=none] at (16.5, 6.6) {\large -4}; + \node[draw=none] at (17.5, 6.9) {\large -254}; + \node[draw=none] at (18.5, 7.2) {\large -498}; + \node[draw=none] at (19.5, 7.5) {\large -662}; + \node[draw=none] at (20.5, 7.8) {\large -849}; + \node[draw=none] at (21.5, 8.1) {\large -642}; + \node[draw=none] at (22.5, 8.4) {\large 187};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % [-520 45 240 211 388 215 -861] + \node[draw=none] at (16.5, 5.6) {\large-520}; + \node[draw=none] at (17.5, 5.9) {\large 45}; + \node[draw=none] at (18.5, 6.2) {\large 240}; + \node[draw=none] at (19.5, 6.5) {\large 211}; + \node[draw=none] at (20.5, 6.8) {\large 388}; + \node[draw=none] at (21.5, 7.1) {\large 215}; + \node[draw=none] at (22.5, 7.4) {\large-861};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % [-340 559 -105 185 -138 -180 503] + \node[draw=none] at (16.5, 4.6) {\large -340}; + \node[draw=none] at (17.5, 4.9) {\large 559}; + \node[draw=none] at (18.5, 5.2) {\large -105}; + \node[draw=none] at (19.5, 5.5) {\large 185}; + \node[draw=none] at (20.5, 5.8) {\large -138}; + \node[draw=none] at (21.5, 6.1) {\large -180}; + \node[draw=none] at (22.5, 6.4) {\large 503};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % [-718 429 350 173 251 268 -655] + \node[draw=none] at (16.5, 3.6) {\large -718}; + \node[draw=none] at (17.5, 3.9) {\large 429}; + \node[draw=none] at (18.5, 4.2) {\large 350}; + \node[draw=none] at (19.5, 4.5) {\large 173}; + \node[draw=none] at (20.5, 4.8) {\large 251}; + \node[draw=none] at (21.5, 5.1) {\large 268}; + \node[draw=none] at (22.5, 5.4) {\large -655};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % [-567 -53 -75 80 571 -128 24] + \node[draw=none] at (16.5, 2.6) {\large -567}; + \node[draw=none] at (17.5, 2.9) {\large -53}; + \node[draw=none] at (18.5, 3.2) {\large -75}; + \node[draw=none] at (19.5, 3.5) {\large 80}; + \node[draw=none] at (20.5, 3.8) {\large 571}; + \node[draw=none] at (21.5, 4.1) {\large -128}; + \node[draw=none] at (22.5, 4.4) {\large 24};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % [-408 596 -550 368 26 976 156] + \node[draw=none] at (16.5, 1.6) {\large -408}; + \node[draw=none] at (17.5, 1.9) {\large 596}; + \node[draw=none] at (18.5, 2.2) {\large -550}; + \node[draw=none] at (19.5, 2.5) {\large 368}; + \node[draw=none] at (20.5, 2.8) {\large 26}; + \node[draw=none] at (21.5, 3.1) {\large 976}; + \node[draw=none] at (22.5, 3.4) {\large 156};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % [ 302 647 879 223 811 54 660]] + \node[draw=none] at (16.5, 0.6) {\large 302}; + \node[draw=none] at (17.5, 0.9) {\large 647}; + \node[draw=none] at (18.5, 1.2) {\large 879}; + \node[draw=none] at (19.5, 1.5) {\large 223}; + \node[draw=none] at (20.5, 1.8) {\large 811}; + \node[draw=none] at (21.5, 2.1) {\large 54}; + \node[draw=none] at (22.5, 2.4) {\large 660};%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\end{tikzpicture} diff --git a/presentations/CNN-Intro/pgfplotsthemetol.sty b/presentations/CNN-Intro/pgfplotsthemetol.sty new file mode 100644 index 0000000..7f07743 --- /dev/null +++ b/presentations/CNN-Intro/pgfplotsthemetol.sty @@ -0,0 +1,123 @@ +%% +%% This is file `pgfplotsthemetol.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% pgfplotsthemetol.dtx (with options: `package') +%% --------------------------------------------------------------------------- +%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of +%% contributors can be found at +%% +%% https://github.com/matze/mtheme/graphs/contributors +%% +%% and the original template was based on the HSRM theme by Benjamin Weiss. +%% +%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 +%% International License (https://creativecommons.org/licenses/by-sa/4.0/). +%% --------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pgfplotsthemetol} + [2017/01/23 PGFplots colors based on Paul Tol's SRON technical note] +\definecolor{TolDarkPurple}{HTML}{332288} +\definecolor{TolDarkBlue}{HTML}{6699CC} +\definecolor{TolLightBlue}{HTML}{88CCEE} +\definecolor{TolLightGreen}{HTML}{44AA99} +\definecolor{TolDarkGreen}{HTML}{117733} +\definecolor{TolDarkBrown}{HTML}{999933} +\definecolor{TolLightBrown}{HTML}{DDCC77} +\definecolor{TolDarkRed}{HTML}{661100} +\definecolor{TolLightRed}{HTML}{CC6677} +\definecolor{TolLightPink}{HTML}{AA4466} +\definecolor{TolDarkPink}{HTML}{882255} +\definecolor{TolLightPurple}{HTML}{AA4499} +\pgfplotscreateplotcyclelist{mbarplot cycle}{% + {draw=TolDarkBlue, fill=TolDarkBlue!70}, + {draw=TolLightBrown, fill=TolLightBrown!70}, + {draw=TolLightGreen, fill=TolLightGreen!70}, + {draw=TolDarkPink, fill=TolDarkPink!70}, + {draw=TolDarkPurple, fill=TolDarkPurple!70}, + {draw=TolDarkRed, fill=TolDarkRed!70}, + {draw=TolDarkBrown, fill=TolDarkBrown!70}, + {draw=TolLightRed, fill=TolLightRed!70}, + {draw=TolLightPink, fill=TolLightPink!70}, + {draw=TolLightPurple, fill=TolLightPurple!70}, + {draw=TolLightBlue, fill=TolLightBlue!70}, + {draw=TolDarkGreen, fill=TolDarkGreen!70}, +} +\pgfplotscreateplotcyclelist{mlineplot cycle}{% + {TolDarkBlue, mark=*, mark size=1.5pt}, + {TolLightBrown, mark=square*, mark size=1.3pt}, + {TolLightGreen, mark=triangle*, mark size=1.5pt}, + {TolDarkBrown, mark=diamond*, mark size=1.5pt}, +} +\pgfplotsset{ + compat=1.9, + mlineplot/.style={ + mbaseplot, + xmajorgrids=true, + ymajorgrids=true, + major grid style={dotted}, + axis x line=bottom, + axis y line=left, + legend style={ + cells={anchor=west}, + draw=none + }, + cycle list name=mlineplot cycle, + }, + mbarplot base/.style={ + mbaseplot, + bar width=6pt, + axis y line*=none, + }, + mbarplot/.style={ + mbarplot base, + ybar, + xmajorgrids=false, + ymajorgrids=true, + area legend, + legend image code/.code={% + \draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm); + }, + cycle list name=mbarplot cycle, + }, + horizontal mbarplot/.style={ + mbarplot base, + xmajorgrids=true, + ymajorgrids=false, + xbar stacked, + area legend, + legend image code/.code={% + \draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm); + }, + cycle list name=mbarplot cycle, + }, + mbaseplot/.style={ + legend style={ + draw=none, + fill=none, + cells={anchor=west}, + }, + x tick label style={ + font=\footnotesize + }, + y tick label style={ + font=\footnotesize + }, + legend style={ + font=\footnotesize + }, + major grid style={ + dotted, + }, + axis x line*=bottom, + }, + disable thousands separator/.style={ + /pgf/number format/.cd, + 1000 sep={} + }, +} +\endinput +%% +%% End of file `pgfplotsthemetol.sty'.