diff --git a/mini_proj/report/references.bib b/mini_proj/report/references.bib index 795a143..05c27c3 100644 --- a/mini_proj/report/references.bib +++ b/mini_proj/report/references.bib @@ -107,15 +107,22 @@ year = {2012}, publisher = {Curran Associates, Inc.}, url = {http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf} } -@ARTICLE{726791, -author={Y. Lecun and L. Bottou and Y. Bengio and P. Haffner}, -journal={Proceedings of the IEEE}, -title={Gradient-based learning applied to document recognition}, -year={1998}, -volume={86}, -number={11}, -pages={2278-2324}, -keywords={backpropagation;convolution;multilayer perceptrons;optical character recognition;2D shape variability;GTN;back-propagation;cheque reading;complex decision surface synthesis;convolutional neural network character recognizers;document recognition;document recognition systems;field extraction;gradient based learning technique;gradient-based learning;graph transformer networks;handwritten character recognition;handwritten digit recognition task;high-dimensional patterns;language modeling;multilayer neural networks;multimodule systems;performance measure minimization;segmentation recognition;Character recognition;Feature extraction;Hidden Markov models;Machine learning;Multi-layer neural network;Neural networks;Optical character recognition software;Optical computing;Pattern recognition;Principal component analysis}, -doi={10.1109/5.726791}, -ISSN={0018-9219}, +@ARTICLE{726791, +author={Y. Lecun and L. Bottou and Y. Bengio and P. Haffner}, +journal={Proceedings of the IEEE}, +title={Gradient-based learning applied to document recognition}, +year={1998}, +volume={86}, +number={11}, +pages={2278-2324}, +keywords={backpropagation;convolution;multilayer perceptrons;optical character recognition;2D shape variability;GTN;back-propagation;cheque reading;complex decision surface synthesis;convolutional neural network character recognizers;document recognition;document recognition systems;field extraction;gradient based learning technique;gradient-based learning;graph transformer networks;handwritten character recognition;handwritten digit recognition task;high-dimensional patterns;language modeling;multilayer neural networks;multimodule systems;performance measure minimization;segmentation recognition;Character recognition;Feature extraction;Hidden Markov models;Machine learning;Multi-layer neural network;Neural networks;Optical character recognition software;Optical computing;Pattern recognition;Principal component analysis}, +doi={10.1109/5.726791}, +ISSN={0018-9219}, month={Nov},} +@book{numpy, + title={A guide to NumPy}, + author={Oliphant, Travis E}, + volume={1}, + year={2006}, + publisher={Trelgol Publishing USA} +} diff --git a/mini_proj/report/waldo.tex b/mini_proj/report/waldo.tex index c0d960a..502f94d 100644 --- a/mini_proj/report/waldo.tex +++ b/mini_proj/report/waldo.tex @@ -162,59 +162,58 @@ trees is used which avoids this problem. \subsection{Neural Network Architectures} - \tab There are many well established architectures for Neural Networks depending on the task being performed. - In this paper, the focus is placed on convolution neural networks, which have been proven to effectively classify images \cite{NIPS2012_4824}. - One of the pioneering works in the field, the LeNet \cite{726791}architecture, will be implemented to compare against two rudimentary networks with more depth. - These networks have been constructed to improve on the LeNet architecture by extracting more features, condensing image information, and allowing for more parameters in the network. - The difference between the two network use of convolutional and dense layers. - The convolutional neural network contains dense layers in the final stages of the network. - The Fully Convolutional Network (FCN) contains only one dense layer for the final binary classification step. + \tab There are many well established architectures for Neural Networks depending on the task being performed. + In this paper, the focus is placed on convolution neural networks, which have been proven to effectively classify images \cite{NIPS2012_4824}. + One of the pioneering works in the field, the LeNet \cite{726791}architecture, will be implemented to compare against two rudimentary networks with more depth. + These networks have been constructed to improve on the LeNet architecture by extracting more features, condensing image information, and allowing for more parameters in the network. + The difference between the two network use of convolutional and dense layers. + The convolutional neural network contains dense layers in the final stages of the network. + The Fully Convolutional Network (FCN) contains only one dense layer for the final binary classification step. The FCN instead consists of an extra convolutional layer, resulting in an increased ability for the network to abstract the input data relative to the other two configurations. \\ \textbf{Insert image of LeNet from slides} \section{Method} \label{sec:method} \tab - In order to effectively utilize the aforementioned modelling and classification techniques, a key consideration is the data they are acting on. - A dataset containing Waldo and non-Waldo images was obtained from an Open Database\footnote{``The Open Database License (ODbL) is a license agreement intended to allow users to freely share, modify, and use [a] Database while maintaining [the] same freedom for others"\cite{openData}}hosted on the predictive modelling and analytics competition framework, Kaggle. - The distinction between images containing Waldo, and those that do not, was providied by the separation of the images in different sub-directories. + In order to effectively utilize the aforementioned modelling and classification techniques, a key consideration is the data they are acting on. + A dataset containing Waldo and non-Waldo images was obtained from an Open Database\footnote{``The Open Database License (ODbL) is a license agreement intended to allow users to freely share, modify, and use [a] Database while maintaining [the] same freedom for others"\cite{openData}}hosted on the predictive modelling and analytics competition framework, Kaggle. + The distinction between images containing Waldo, and those that do not, was providied by the separation of the images in different sub-directories. It was therefore necessary to preprocess these images before they could be utilised by the proposed machine learning algorithms. - + \subsection{Image Processing} \label{imageProcessing} \tab - The Waldo image database consists of images of size 64$\times$64, 128$\times$128, and 256$\times$256 pixels obtained by dividing complete Where's Waldo? puzzles. - Within each set of images, those containing Waldo are located in a folder called `waldo', and those not containing Waldo, in a folder called `not\_waldo'. - Since Where's Waldo? puzzles are usually densely populated and contain fine details, the 64$\times$64 pixel set of images were selected to train and evaluate the machine learning models. + The Waldo image database consists of images of size 64$\times$64, 128$\times$128, and 256$\times$256 pixels obtained by dividing complete Where's Waldo? puzzles. + Within each set of images, those containing Waldo are located in a folder called `waldo', and those not containing Waldo, in a folder called `not\_waldo'. + Since Where's Waldo? puzzles are usually densely populated and contain fine details, the 64$\times$64 pixel set of images were selected to train and evaluate the machine learning models. These images provide the added benefit of containing the most individual images of the three size groups. \\ \par - Each of the 64$\times$64 pixel images were inserted into a Numpy - \footnote{Numpy is a popular Python programming library for scientific computing} - array of images, and a binary value was inserted into a seperate list at the same index. - These binary values form the labels for each image (waldo or not waldo). + Each of the 64$\times$64 pixel images were inserted into a Numpy~\cite{numpy} + array of images, and a binary value was inserted into a seperate list at the same index. + These binary values form the labels for each image (waldo or not waldo). Colour normalisation was performed on each so that artefacts in an image's colour profile correspond to meaningful features of the image (rather than photographic method). \\ \par - Each original puzzle is broken down into many images, and only contains one Waldo. Although Waldo might span multiple 64$\times$64 pixel squares, this means that the non-Waldo data far outnumbers the Waldo data. - To combat the bias introduced by the skewed data, all Waldo images were artificially augmented by performing random rotations, reflections, and introducing random noise in the image to produce news images. - In this way, each original Waldo image was used to produce an additional 10 variations of the image, inserted into the image array. + Each original puzzle is broken down into many images, and only contains one Waldo. Although Waldo might span multiple 64$\times$64 pixel squares, this means that the non-Waldo data far outnumbers the Waldo data. + To combat the bias introduced by the skewed data, all Waldo images were artificially augmented by performing random rotations, reflections, and introducing random noise in the image to produce news images. + In this way, each original Waldo image was used to produce an additional 10 variations of the image, inserted into the image array. This provided more variation in the true positives of the data set and assists in the development of more robust methods by exposing each technique to variations of the image during the training phase. \\ \par - Despite the additional data, there were still over ten times as many non-Waldo images than Waldo images. + Despite the additional data, there were still over ten times as many non-Waldo images than Waldo images. Therefore, it was necessary to cull the no-Waldo data, so that there was an even split of Waldo and non-Waldo images, improving the representation of true positives in the image data set. Following preprocessing, the images (and associated labels) were divided into a training and a test set with a 3:1 split. \\ \subsection{Neural Network Training}\label{nnTraining} \tab The neural networks used to classify the images were supervised learning models; requiring training on a dataset of typical images. - Each network was trained using the preprocessed training dataset and labels, for 25 epochs (one forward and backward pass of all data) in batches of 150. - The number of epochs was chosen to maximise training time and prevent overfitting\footnote{Overfitting occurs when a model learns from the data too specifically, and loses its ability to generalise its predictions for new data (resulting in loss of prediction accuracy)} of the training data, given current model parameters. - The batch size is the number of images sent through each pass of the network. Using the entire dataset would train the network quickly, but decrease the network's ability to learn unique features from the data. - Passing one image at a time may allow the model to learn more about each image, however it would also increase the training time and risk of overfitting the data. + Each network was trained using the preprocessed training dataset and labels, for 25 epochs (one forward and backward pass of all data) in batches of 150. + The number of epochs was chosen to maximise training time and prevent overfitting\footnote{Overfitting occurs when a model learns from the data too specifically, and loses its ability to generalise its predictions for new data (resulting in loss of prediction accuracy)} of the training data, given current model parameters. + The batch size is the number of images sent through each pass of the network. Using the entire dataset would train the network quickly, but decrease the network's ability to learn unique features from the data. + Passing one image at a time may allow the model to learn more about each image, however it would also increase the training time and risk of overfitting the data. Therefore the batch size was chosen to maintain training accuracy while minimising training time. \subsection{Neural Network Testing}\label{nnTesting} - \tab After training each network, a separate test set of images (and labels) was used to evaluate the models. - The result of this testing was expressed primarily in the form of an accuracy (percentage). + \tab After training each network, a separate test set of images (and labels) was used to evaluate the models. + The result of this testing was expressed primarily in the form of an accuracy (percentage). These results as well as the other methods presented in this paper are given in Figure \textbf{[insert ref to results here]} of the Results section. \textbf{***********} % Kelvin Start