attain the best performance. The pipeline required to build a whole image classifier is presented here, as well as the pros and cons of different training strategies.

Methods
=======

Converting a classifier from recognizing patches to whole images
----------------------------------------------------------------

To perform classification or segmentation on large complex images, a common strategy involves the use of a classifier in sliding window fashion to recognize local patches on an image to generate a grid of probabilistic outputs. This is followed by another process to summarize the patch classifier’s outputs to give the final classification or segmentation result. Such methods have been used to detect metastatic breast cancer using whole slide images of sentinel lymph node biopsies [@wang_deep_2016] and to segment neuronal membranes in microscopic images [@ciresan_deep_2012]. However, this strategy requires two steps that each needs to be optimized separately. Here, we propose a method to combine the two steps into a single step for training on the whole images (Fig. \[fig:patch2image\]). Assume we have an input patch $X\in \rm I\!R^{p\times q}$ and a patch classifier which is a function $f$ so that $f(X)\in \rm I\!R^{c}$, where $c$ is the number of categories that the patch classifier recognizes; the function’s output satisfies $f(X)_{i} 