\chapter{A Framework for Building Solutions to Vision Problems (DRAFT)}
\label{ch:vision-system}
The majority of publications in Genetic Programming/Computer Vision community have concentrated on particular techniques or approaches to a particular domain which do not make a fully working vision application - REF. For the purposes of this thesis, a ``fully working'' vision system shall be defined as one into which you plug raw images, and out from which you receive high level information. For a pasta recognition system, this high level information might be ``this image contains three pieces of pasta; two are farfalle and one is rigatoni''.

While the majority of GP vision researchers have leaned toward evolving several programs that each perform \emph{the entire task}, this work takes a rather different approach. Here, the feature extraction and classification stages are separated and evolved independently. Although this is fairly conventional for vision system architectures, it does not appear to have been attempted previously by GP.

This Chapter explores the construction of complete vision systems using genetic programming and demonstrates an architecture which permits a variety of different problems from different domains to be solved.

Although it is not currently possible to develop a complete vision system in a single pass using any automated learning procedure, it is possible to define an architecture consisting both of hand-coded, generic and domain specific components. The domain-specific parts can then be learned automatically, given sufficient training data. This presents two challenges: the first is to define a generic architecture, and the second is to create a unified interface by which the user can provide training data to the system.

\section{Architecture}
We decided upon a standard computer vision architecture which should appear familiar to anyone working in the field of computer vision or general signal processing. A high level diagram of the architecture is presented in Fig. \ref{fig:vision-system} below:

\begin{figure}
\includegraphics[width=0.75\textwidth]{images/vision-system-diagram.eps}
\caption{A basic vision system architecture which can solve a number of different tasks}
\label{fig:vision-system}
\end{figure}

The architecture consists of two components learned by Genetic Programming, the first detection phase is required for the detection of objects in the scene, and the second aims to classify each object into a particular class. This simple setup is capable of solving a variety of different problems.

\subsection{PreProcessing}
%TODO: Explain why we don't bother with preprocessing.
An advantage of GP is that it places no requirement upon the quality of the input image to begin with, so in some regards, these procedures are unnecessary for our vision system if it is learned by GP.

\subsection{Segmentation}
Segmentation may be defined as the classification of each pixel in an image into a particular class. Once every pixel has been classified, and providing the classification process is not inherently random the image should be divided into a number of contiguous regions which may relate to separate objects. The usual goal of segmentation is to make a distinction between pixels in the foreground and those in the background. Although colour information may be gleaned from inspecting only the pixel itself, information about the texture at that point in the image can only be discovered by looking at the pixels surrounding that central point. 

The decision may be made by colour, texture or a mixture of both, depending -- as always -- upon the nature of the problem. A requirement of the architecture is that the learning system can indeed produce segmenters capable of solving a variety of problems. 

-- Images of segmentation results here --

\subsection{Classification}

The initial steps of image pre-processing appear quite clear. There is certainly a desire to reduce noise as much as possible, or to find the edges and corners within a picture. What to do with a processed image thereafter seems to be less obvious.

With the job of object localisation taken care of by the segmentation component, it is then necessary to identify the located objects and, where necessary, to discard any spurious object classifications.

\subsection{Extensions}
While the architecture in its original form has proven to be successful at solving various tasks, there remain classes of problems that cannot be solved due to its segmentation stage. Segmentation is only appropriate for problems where the objects are well defined and distinct from their background. Shape Classification is only useful if the object tends to have little variance. 

\subsection{Window Classification}
Segmentation consists of the classification of each pixel in order to create contiguous regions. However, some problems are defined in terms of the regions themselves, such as face detection, where the training data consists of the sub-images containing faces. 

\subsection{Beyond Shape}
While shape statistics permit classifiers to distinguish basic objects and are certainly capable of distinguishing among letters for the purposes of OCR, the statistics themselves are limited by an inherent and substantial loss of information regarding the relationships between different components of a shape. Shape information is also sensitive to intra-class variations and is limited to two dimensions. Perhaps a better scheme is to model the relationship between basic shapes.

The problem of course is that segmentation may not be able to help us in finding the boundaries between the basic shapes which produce a complex object: it can only be used to validate whether they are part of the same object, although this again is not guaranteed.

\section{Training Data}
In order to train the feature extraction stage, the developer identifies regions of `feature' and `non-feature' using a graphical user interface. A program is then evolved to do this automatically.
The output of this program yields the regions of interest within a given image which are to be classified. The developer marks each region with the expected class to produce a second training set. After identifying these training data and choosing a set of measures that the classification stage may use, the work of tailoring the classifier is left to the software.

\begin{figure}
\begin{centering}
\includegraphics[width=0.5\textwidth]{images/jasmine}
\par\end{centering}
\caption{Jasmine GUI}
\label{fig:jasmine}
\end{figure}

\subsection{Representing Training Data}

\subsection{Producing Good Training Data}

\subsubsection{Software Tools}

\subsubsection{Supervised Learning}