\PassOptionsToClass{}{beamer}
\documentclass[serif,aspectratio=169,dvipsnames]{beamer}
\usepackage[utf8]{inputenc}

%\StartShownPreambleCommands
\usepackage{amsmath,esint}
\usepackage{amssymb}
\usepackage[british]{babel}
\usepackage{multicol}
\usetheme{Warsaw}
\usecolortheme{rose}
\usepackage[normalem]{ulem}
%\usetheme{metropolis}
%\usepackage{appendixnumberbeamer}

%\StopShownPreambleCommands
\usepackage{pgfplots}

\usepackage{ mathrsfs }
\usepackage{hyperref}

\usepackage{gensymb}
\usepackage{color}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{tkz-fct}  
\usetikzlibrary{calc}
\usepackage{ragged2e}
\usepackage[ruled]{algorithm2e}
\usepackage{tikz}
\usepackage{animate}
\usepackage{adjustbox}
\usepackage[labelformat=empty]{caption}
\usepackage{blindtext}

\usepackage{xcolor}

\usepackage{utils/dtklogos}
\usepackage{utils/style}

%\usepackage{unicode-math}
%\setmathfont{XITS Math}
%\setmathfont[version=setB,StylisticSet=1]{XITS Math}

\makeatletter

\DeclareMathOperator*{\minimize}{minimize}



\addtobeamertemplate{navigation symbols}{}{%
    \usebeamerfont{footline}%
    \usebeamercolor[fg]{footline}%
    \hspace{1em}%
    \insertframenumber/\inserttotalframenumber
}


\titlegraphicii{}
\setbeamertemplate{title page}
{
  \vspace{0.3in}
  \vbox{}
   %{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\hfill\inserttitlegraphicii\par}
  \begin{centering}
    \begin{beamercolorbox}[sep=8pt,center]{title}
      \usebeamerfont{title}\inserttitle\par%
      \ifx\insertsubtitle\@empty%
      \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
      \fi%     
    \end{beamercolorbox}%
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center]{date}
      \usebeamerfont{date}\insertdate
    \end{beamercolorbox}%\vskip0.5em
    \begin{beamercolorbox}[sep=8pt,center]{author}
      \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{institute}
      \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
  \end{centering}
  %\vfill
}
\makeatother

\author{Mitesh M. Khapra}
\title{CS7015 (Deep Learning) : Lecture 12}
\subtitle{Object Detection: R-CNN, Fast R-CNN, Faster R-CNN, You Only Look Once (YOLO)}
\institute{Department of Computer Science and Engineering\\ Indian Institute of Technology Madras}
\date{}
\titlegraphic{\includegraphics[height=1cm,width=2cm]{images/iitm_logo.png}}


\begin{document}
		
\maketitle
\centering

\newcommand{\tikzmark}[1]{\tikz[baseline,remember picture] \coordinate (#1) {};}
\def\cuboid#1#2#3#4#5{
	\begin{scope}
		\edef\mycolor{#2}
		\edef\depth{#3}
		\edef\height{#4}
		\edef\width{#5}
		\draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) -- ++(0,0,\width) -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
	\end{scope}
}
\def\cuboidlabelmine#1#2#3#4#5#6#7#8{
	\begin{scope}
		\edef\mycolor{#2}
		\edef\depth{#3}
		\edef\height{#4}
		\edef\width{#5}
		\edef\depthlabel{#6}
		\edef\heightlabel{#7}
		\edef\widthlabel{#8}
		\draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) node[pos=0.5,below] {\tiny \depthlabel} -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) node[pos=0.5,right,outer sep=-3pt] {\tiny \heightlabel} -- ++(0,0,\width)  node[pos=0.5,below] {\tiny \widthlabel} -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
	\end{scope}
}
\def\lenetparamnew#1#2#3#4#5#6#7#8{
	\begin{scope}
		\edef\mycolor{#2}
		\edef\depth{#3}
		\edef\height{#4}
		\edef\width{#5}
		\edef\depthlabel{#8}
		\edef\heightlabel{#7}
		\edef\sep{#6}
		\draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) node[pos=0.9,above,outer sep=-13 pt] {\tiny \heightlabel} node[pos=0.9,above,outer sep=-20 pt] {\tiny \depthlabel} -- ++(0,0,\width)  -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
	\end{scope}
}
\def\lenetparam#1#2#3#4#5#6#7#8{
	\begin{scope}
		\edef\mycolor{#2}
		\edef\depth{#3}
		\edef\height{#4}
		\edef\width{#5}
		\edef\depthlabel{#6}
		\edef\heightlabel{#7}
		\edef\widthlabel{#8}
		\draw[black] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) node[pos=0.5,above,outer sep=-28pt] {\tiny \depthlabel} node[pos=0.6,above,outer sep=-35pt] {\tiny \heightlabel} node[pos=0.5,above,outer sep=-42] {\tiny \widthlabel}  -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0)  -- ++(0,0,\width) -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
	\end{scope}
}

\def\kernel#1#2#3#4#5#6{
	\begin{scope}
		\edef\mycolor{#2}
		\edef\depth{#3}
		\edef\height{#4}
		\edef\width{#5}
		\draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) -- ++(0,0,\width) -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
		\draw[dashed] #1 -- #6 #1++(0,0,-\width) -- #6 #1++(0,-\height,0) -- #6 #1++(0,-\height,-\width) -- #6;
	\end{scope}
}
\def\kernellabel#1#2#3#4#5#6#7#8#9{
	%#6 is target pixel
	\begin{scope}
		\edef\mycolor{#2}
		\edef\depth{#3}
		\edef\height{#4}
		\edef\width{#5}
		\edef\depthlabel{#7}
		\edef\heightlabel{#8}
		\edef\widthlabel{#9}
		\draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) node[pos=0.5,below] {\tiny \depthlabel} -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) node[pos=0.5,right] {\tiny \heightlabel} -- ++(0,0,\width)  node[pos=0.5,below] {\tiny \widthlabel} -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
		\draw[dashed] #1 -- #6 #1++(0,0,-\width) -- #6 #1++(0,-\height,0) -- #6 #1++(0,-\height,-\width) -- #6;
	\end{scope}
}

\newcommand{\borderColor}{white}
\newcommand{\forefillColor}{blue!20!black!30!green}
\newcommand{\toprsidefillcolor}{green!40}

\newcommand{\parallelogram}[5]{

\pgfmathsetmacro{\width}{#1}
\pgfmathsetmacro{\height}{#2}
\pgfmathsetmacro{\ti}{#3}
\pgfmathsetmacro{\x}{#4}
\pgfmathsetmacro{\y}{#5}


\pgfmathsetmacro{\yfactor}{0.9}
\pgfmathsetmacro{\xfactor}{0.6}


\draw  [draw=black] (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height) -- (\x,\y-\height) --cycle ;

%\filldraw[fill=red](\x,\y) circle (7pt);
%\filldraw[fill=yellow](\x+\xfactor*\ti,\y+\yfactor*\ti) circle (7pt);
%\filldraw[fill=blue](\x+\xfactor*\ti,\y+\yfactor*\ti-\height) circle (7pt);
%\filldraw[fill=green](\x,\y-\height) circle (7pt);
          
}


\newcommand{\parallelogramWithGrid}[5]{

	\pgfmathsetmacro{\width}{#1}
	\pgfmathsetmacro{\height}{#2}
	\pgfmathsetmacro{\ti}{#3}
	\pgfmathsetmacro{\x}{#4}
	\pgfmathsetmacro{\y}{#5}
	
	
	\pgfmathsetmacro{\yfactor}{0.9}
	\pgfmathsetmacro{\xfactor}{0.6}
	
	
	\draw  [draw=black] (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height) -- (\x,\y-\height) --cycle ;
	
	%\edef\ybak{\y}
	          
	\foreach \iter in {1,2,...,9}{
	     \edef\yShift{0.5}
	     \pgfmathparse{\y-\yShift*\iter}
	     \edef\y{\pgfmathresult}
	     \draw  [draw=red!50] (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti);
	}
	
	
	
	\foreach \iter in {1,2,...,3}{
	\edef\xShift{0.3}
	\pgfmathparse{\x-\xShift*\iter}
	\edef\x{\pgfmathresult}
	
	\edef\yShift{0.5}
	\pgfmathparse{\y-\yShift*\iter}
	\edef\y{\pgfmathresult}
	
	\draw  [draw=red!50] (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height);
	
	}


}


\newcommand{\handmadecube}[5]{
	\pgfmathsetmacro{\width}{#1}
	\pgfmathsetmacro{\height}{#2}
	\pgfmathsetmacro{\ti}{#3}
	\pgfmathsetmacro{\x}{#4}
	\pgfmathsetmacro{\y}{#5}
	
	
	
	       \pgfmathsetmacro{\yfactor}{0.9}
	            \pgfmathsetmacro{\xfactor}{0.6}
	
	
	% % square
	\draw [-,draw=\borderColor] (\x-\width,\y) -- (\x,\y); % % x cahnge ->
	\draw [-,draw=\borderColor] (\x,\y) -- (\x,\y-\height); % % y change   |
	\draw [-,draw=\borderColor] (\x,\y-\height) -- (\x-\width,\y-\height); % % x change <-
	\draw [-,draw=\borderColor] (\x-\width,\y-\height) -- (\x-\width,\y); % % y change  |
	
	\draw  [draw=\borderColor,fill=\forefillColor] (\x-\width,\y)--(\x,\y) -- (\x,\y-\height) -- (\x-\width,\y-\height) --cycle ;
	
	\draw  [draw=\borderColor,fill=\toprsidefillcolor] (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height) -- (\x,\y-\height) --cycle ;
	
	\draw  [draw=\borderColor,fill=\toprsidefillcolor] (\x-\width,\y)--(\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti-\width,\y+\yfactor*\ti) --cycle ;
	
	\draw [-,draw=\borderColor]   (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti);
	
	\draw [-,draw=\borderColor] (\x-\width,\y) -- (\x-\width+\xfactor*\ti,\y+\yfactor*\ti);
	
	\draw [-,draw=\borderColor] (\x-\width+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti);
	
	\draw [-,draw=\borderColor] (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height);
	
	\draw [-,draw=\borderColor] (\x,\y-\height) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height);

}

\setbeamertemplate{caption}{\raggedright\insertcaption\par}


\input{utils/acknowledgement}
