{'fraction_non_alphanumeric': 0.03458785172584875, 'fraction_numerical': 0.012545183925154156, 'mean_word_length': 4.5978972426105935, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Deformable Part Models are Convolutional Neural Networks

Deformable part models (DPMs) and convolutional neural networks (CNNs) are two widely used tools for visual recognition. They are typically viewed as distinct approaches: DPMs are graphical models (Markov random fields), while CNNs are"black-box"non-linear classifiers. In this paper, we show that a DPM can be formulated as a CNN, thus providing a novel synthesis of the two ideas. Our construction involves unrolling the DPM inference algorithm and mapping each step to an equivalent (and at times novel) CNN layer. From this perspective, it becomes natural to replace the standard image features used in DPM with a learned feature extractor. We call the resulting model DeepPyramid DPM and experimentally validate it on PASCAL VOC. DeepPyramid DPM significantly outperforms DPMs based on histograms of oriented gradients features (HOG) and slightly outperforms a comparable version of the recently introduced R-CNN detection system, while running an order of magnitude faster.


Introduction
Part-based representations are widely used for visual recognition tasks. In particular, deformable part models (DPMs) [7] have been especially useful for generic object category detection. DPMs update pictorial structure models [8,11] (which date back to the 1970s) with modern image features and machine learning algorithms. Convolutional neural networks (CNNs) [12,23,27] are another influential class of models for visual recognition. CNNs also have a long history, and have come back into popular use in the last two years due to good performance on image classification [5,22] and object detection [14,28] tasks.
These two models, DPMs and CNNs, are typically viewed as distinct approaches to visual recognition. DPMs are graphical models (Markov random fields), while CNNs are "black-box" non-linear classifiers. In this paper we describe how a DPM can be formulated as an equivalent CNN, providing a novel synthesis of these ideas. This formulation (DPM-CNN) relies on a new CNN layer, distance transform pooling, that generalizes max pooling. Another innovation of our approach is that rather than using histograms of oriented gradients (HOG) features [4], we apply DPM-CNN to a feature pyramid that is computed by another CNN. Since the end-to-end system is the function composition of two networks, it is equivalent to a single, unified CNN. We call this end-to-end model DeepPyramid DPM.
We also show that DeepPyramid DPM works well in practice. In terms of object detection mean average precision, DeepPyramid DPM slightly outperforms a comparable version of the recently proposed R-CNN [14] (specifically, R-CNN on the same conv 5 features, without finetuning), while running about 20x faster. This experimental investigation also provides a greater understanding of the relative merits of region-based detection methods, such as R-CNN, and sliding-window methods like DPM. We find that regions and sliding windows are complementary methods that will likely benefit each other if used in an ensemble.
HOG-based detectors are currently used in a wide range of models and applications, especially those where regionbased methods are ill-suited (poselets [1] being a prime example). Our results show that sliding-window detectors on deep feature pyramids significantly outperform equivalent models on HOG. Therefore, we believe that the model presented in this paper will be of great practical interest to the visual recognition community. An open-source implementation will be made available, which will allow researchers to easily build on our work.

DeepPyramid DPM
In this section we describe the DeepPyramid DPM architecture. DeepPyramid DPM is a convolutional neural network that takes as input an image pyramid and produces as output a pyramid of object detection scores. Although the model is a single CNN, for pedagogical reasons we describe it in terms of two smaller networks whose function composition yields the full network. A schematic diagram of the model is presented in Figure 1.

Feature pyramid front-end
Objects appear at all scales in images. A standard technique for coping with this fact is to run a detector at multiple scales using an image pyramid. In the context of CNNs, this method dates back to (at least) early work on face detection in [31], and has been used in contemporary work including OverFeat [28], DetectorNet [3], and DenseNet [19]. We follow this approach and use as our first CNN a network that maps an image pyramid to a feature pyramid. We use a standard single-scale architecture (Krizhevsky et al. [22]) and tie the network weights across all scales. Implementation details are given in Section 3.

DPM-CNN: Constructing an equivalent CNN from a DPM
In the DPM formalism, an object class is modeled as a mixture of "components", each being responsible for modeling the appearance of an object sub-category (e.g., side views of cars, people doing handstands, bi-wing propeller planes). Each component, in turn, uses a low-resolution global appearance model of the sub-type (called a "root filter"), together with a small number (e.g., 8) of higher resolution "part filters" that capture the appearance of local regions of the sub-type. At test time, a DPM is run as a sliding-window detector over a feature pyramid, which is traditionally built using HOG features (alternatives have recently been explored in [24,26]). DPM assigns a score to each sliding-window location by optimizing a score function that trades off part deformation costs with image match scores. A global maximum of the score function is computed efficiently at all locations by sharing computation between neighboring positions using a dynamic programming algorithm. This algorithm is illustrated with all of the steps "unrolled" in Figure 4 of [7]. The key observation in this section is that for any given DPM, its unrolled detection algorithm yields a specific network architecture with a fixed depth.
In order to realize DPM as a convolutional network, we first introduce the idea of distance transform (DT) pooling, which generalizes the familiar max-pooling operation used in CNNs. Given DT-pooling, a single-component DPM is constructed by composing part-filter convolution layers and DT-pooling layers with an "object geometry" layer that encodes the relative offsets of DPM parts. We call this architecture DPM-CNN; its construction is explained in Figure 2. To simplify the presentation, we consider the case where the DPM parts operate at the same resolution as the root filter. Multi-resolution models can be implemented by taking two scales as input and inserting a subsampling layer after each DT-pooling layer.

Distance transform pooling
Here we show that distance transforms of sampled functions [9] generalize max pooling.
First, we define max pooling. Consider a function f : G → R defined on a regular grid G. The max pooling operation on f , with a window half-length of k, is also a function M f : G → R that is defined by M f (p) = max ∆p∈{−k,...,k} f (p + ∆p).
Following [9], the distance transform of f is a function D f : G → R defined by D f (p) = max q∈G (f (q) − d(p − q)). In the case of DPM, d(r) is as a convex quadratic function d(r) = ar 2 + br, where a > 0 and b are learnable parameters for each part. Intuitively, these parameters define the shape of the distance transform's pooling region.
Max pooling can be equivalently expressed as . . , k} and ∞ otherwise. Expressing max pooling as the maximization of a function subject to a distance penalty d max makes the connection between distance transforms and max pooling clear. The distance transform generalizes max pooling and can introduce learnable parameters, as is the case in DPM. Note that unlike max pooling, the distance transform of f at p is taken over the entire domain G. Therefore, rather than specifying a fixed pooling window a priori, the shape of the pooling region can be learned from the data.
In the construction of DPM-CNN, DT-pooling layers are inserted after each part filter convolution.

Object geometry filters
The score of a DPM component c at each root filter location s is given by adding the root filter score at s to the distance transformed part scores at "anchor" locations offset from s. Each part p has its own anchor offset that is specified by a 2D vector v p = (v px , v py ).
Computing component scores at all root locations can be rephrased as a convolution. The idea is to stack the root filter score map together with the P distance transformed part score maps to form a feature map with P + 1 channels, and then convolve that feature map with a specially constructed filter that we call an "object geometry" filter. This name comes from the fact that the filter combines a spatial configuration of parts into a whole. The coefficients in the object geometry filter are all zero, except for a single coefficient set to one in each of the filter's P + 1 channels. The first channel corresponds to the root filter, and has a one in its upper-left corner (the root's anchor is defined as v 0 = (0, 0)). Filter channel p (counting from zero), has a one at index v p (using matrix-style indexing, where indices grow down and to the right). To clarify this description, an example object geometry filter for a DPM component with one root and one part is shown in the Figure 2 sidebar.  (1) An image pyramid is built from a color input image. (2) Each pyramid level is forward propagated through a truncated SuperVision CNN [22] that ends at convolutional layer 5 (conv5). (3) The result is a pyramid of conv5 feature maps, each at 1/16th the spatial resolution of its corresponding image pyramid level. (4) Each conv5 level is then input into a DPM-CNN, which produces a pyramid of DPM detection scores (5). Since the whole system is simply the composition of two CNNs, it can be viewed as a single, unified CNN that takes a color image pyramid as input and outputs a DPM score pyramid.  1) The pyramid level is convolved with the root filter and P part filters, yielding P + 1 convolution maps. (2) The part convolution maps are then processed with a distance transform, which we show is a generalization of max pooling. (3) The root convolution map and the DT transformed part convolution maps are stacked into a single feature map with P + 1 channels and then convolved with a sparse object geometry filter (see sidebar diagram and Section 2.2.2). The output is a single-channel score map for the DPM component.
DPM is usually thought of as a flat model, but making the object geometry filter explicit reveals that DPM actually has a second, implicit convolutional layer. This insight shows that in principle one could train this filter discriminatively, rather than heuristically setting it to a sparse binary pattern. We revisit this idea when discussing our experiments in Section 4.1.

Combining mixture components with maxout
Each single-component DPM-CNN produces a score map for each pyramid level. Let z sc be the score for component c at location s in a pyramid level. In the DPM formalism, components compete with each other at each location. This competition is modeled as a max over component scores: z s = max c z sc , where the overall DPM score at s is given by z s . In DPM-CNN, z sc = w c · x s + b c , where w c is component c's object geometry filter (vectorized), x s is the sub-array of root and part scores at s (vectorized), and b c is the component's scalar bias. Figure 3 shows the full multicomponent DPM-CNN including the max non-linearity that combines component scores.
It is interesting to note that the max non-linearity used in DPM is mathematically equivalent to the "maxout" unit recently described by Goodfellow et al. [17]. In the case of DPM, the maxout unit has a direct interpretation as a switch over the choice of model components.  Figure 2) and a maxout [17] layer that takes a max over component DPM-CNN outputs at each location.

Generalizations
For clarity, we constructed a DPM-CNN for the case of mixtures of star models. However, the construction is general and naturally extends to a variety of models such as object detection grammars [16] and recent DPM variants, such as [34].
The CNN construction for these more complex models is analogous to the DPM-CNN construction: take the exact inference algorithm used for detection and explicitly unroll it (this can be done given a fixed model instance); express the resulting network in terms of convolutional layers (for appearance and geometry filters), distance transform pooling layers, subsampling layers, and maxout layers.
We also note that our construction is limited to models for which exact inference is possible with a non-iterative algorithm. Models with loopy graphical structures, such as Wang et al.'s hierarchical poselets model [33], require iterative, approximate inference algorithms that cannot be converted to equivalent fixed-depth CNNs.

Related work
Our work is most closely related to the deep pedestrian detection model of Ouyang and Wang [25]. Their CNN is structured like a DPM and includes a "deformation layer" that takes a distance penalized global max within a detection window. Their work reveals some connections between single-component DPMs and CNNs, however since that is not the focus of their paper a clear mapping of generic DPMs to CNNs is not given. We extend their work by: developing object geometry filters, showing that multicomponent models are implemented with maxout, describing how DPM inference over a whole image is efficiently computed in a CNN by distance transform pooling, and using a more powerful CNN front-end to generate the feature pyramid. Our DT-pooling layer differs from the "deformation layer" described in [25] since it efficiently computes a distance transform over the entire input, rather than an independent global max for each window.
The idea of unrolling (or "time unfolding") an inference algorithm in order to construct a fixed-depth network was explored by Gregor and LeCun in application to sparse cod-ing [18]. In sparse coding, inference algorithms are iterative and converge to a fixed point. Gregor and LeCun proposed to unroll an inference algorithm for a fixed number of iterations in order to define an approximator network. In the case of DPM (and similar low tree-width models), the inference algorithm is exact and non-iterative, making it possible to unroll it into a fixed-depth network without any approximations.
Boureau et al. [2] study average and max pooling from theoretical and experimental perspectives. They discuss variants of pooling that parametrically transition from average to max. Distance transform pooling, unlike the pooling functions in [2], is interesting because it has a learnable pooling region. Jia et al. [21] also address the problem of learning pooling regions by formulating it as a feature selection problem.
Our work is also related to several recent approaches to object detection using CNNs. OverFeat [28] performs coarse sliding-window detection using a CNN. At each rough location, OverFeat uses a regressor to predict the bounding box of a nearby object. Another recent CNNbased object detector called DetectorNet [3] also performs detection on a coarse set of sliding-window locations. At each location, DetectorNet predicts masks for the left, right, top, bottom, and whole object. These predicted masks are then clustered into object hypotheses. Currently, the most accurate object detection method for both ImageNet detection as well as PASCAL VOC is the Region-based CNN framework (R-CNN) [13,14]. Unlike DetectorNet and OverFeat, R-CNN does not perform sliding-window detection; instead R-CNN begins by extracting a set of region proposals [30] and classifies them with a linear SVM applied to CNN features.

Implementation details
We implemented our experiments by modifying the DPM voc-release5 code [15] and using Caffe [20] for CNN computation. We describe the most important implementation details in this section. Source code for the complete system will be available.

Feature pyramid construction
Our DeepPyramid DPM implementation starts by processing an input image with a truncated variant of the Su-perVision CNN [22]. We use the publicly available network weights that are distributed with R-CNN [14], which allows for a direct comparison. These weights were trained on the ILSVRC 2012 classification training dataset using Caffe (we do not use the detection fine-tuned weights).
Starting from this network, we made two structural modifications. The first was to remove the last max pooling layer (pool 5 ) and all of the fully-connected layers (fc 6 , fc 7 , fc 8 , and softmax). The network's output is, therefore, the feature map computed by the fifth convolutional layer (conv 5 ), which has 256 feature channels. The second modification is that before each convolutional or max pooling layer, with kernel size k, we zero-pad the layer's input with k/2 zeros on all sides (top, bottom, left, and right). This padding implements "same" convolution (or pooling), where the input and output maps have the same spatial extent. With this padding, the mapping between image coordinates and CNN output coordinates is straightforward. A "pixel" (or cell) at zero-based index (x, y) in the CNN's conv 5 feature map has a receptive field centered on pixel (16x, 16y) in the input image. The conv 5 features, therefore, have a stride of 16 pixels in the input image with highly overlapping receptive fields of size 163 × 163 pixels. Our experimental results show that even though the receptive fields are very large, the features are localized well enough for sliding-window detectors to precisely localize objects without regression (as in OverFeat and DetectorNet).
For simplicity, we process the image pyramid with a naive implementation in which each image pyramid level is embedded in the upper-left corner of a large (1713 × 1713 pixel) image. For the first image pyramid level, the original image is resized such that its largest dimension is 1713 pixels. For PASCAL VOC images, this results in up-sampling images by a factor of 3.4 on average. The first conv 5 pyramid level has 108 cells on its longest side. We use a pyramid with 7 levels, where the scale factor between levels is 2 −1/2 (the pyramid spans three octaves). The entire conv 5 pyramid has roughly 25k output cells (sliding-window locations). For comparison, this is considerably more than the roughly 1,500 sliding-window locations used in OverFeat, but many fewer than the 250k commonly used in HOG feature pyramids. Computing the conv 5 feature pyramid as described above is fast, taking only 0.5 seconds on an NVIDIA Tesla K20c.

Parameter learning
DeepPyramid DPM is a single CNN that takes an image pyramid as input and outputs a pyramid of DPM detection scores. In principle, the entire network can be trained endto-end using backpropagation by defining a loss function on the score pyramid. In this work we opt for a simpler approach in which DeepPyramid DPM is trained stage-wise, in two stages. The first stage trains the truncated Super-Vision CNN. For this we simply use the publicly available model distributed with R-CNN. This model was trained for image classification on ILSVRC 2012 and was not finetuned for detection. In the second stage, we keep the Su-perVision CNN parameters fixed and train a DPM on top of conv 5 feature pyramids using the standard latent SVM training algorithm used for training DPMs on HOG features. In the future, we plan to experiment with training the entire system with backpropagation.

DPM training and testing details
Compared to training DPM with HOG features, we found it necessary to make some changes to the standard DPM training procedure. First, we don't use left/right mirrored pairs of mixture components. These components are easy to implement with HOG because model parameters can be explicitly "flipped" allowing them to be tied between mirrored components. Second, R-CNN and DPM use different non-maximum suppression functions and we found that the one used in R-CNN, which is based on intersectionover-union (IoU) overlap, performs slightly better with conv 5 features (it is worse for the baseline HOG-DPM). Lastly, we found that it's very important to use poorly localized detections of ground-truth objects as negative examples. As in R-CNN, we define negative examples as all detections that have a max IoU overlap with a ground-truth object of less than 0.3. Using poorly localized positives as negative examples leads to substantially better results (Section 4.1.2) than just using negatives from negative images, which is the standard practice when training HOG-DPM.

Results on PASCAL VOC 2007
Deformable part models have been tuned for use with HOG features over several years. A priori, it's unclear if the same structural choices that work well with HOG (e.g., the number of mixture components, number of parts, multiresolution modeling, etc.) will also work well with very different features. We conducted several preliminary experiments on the PASCAL VOC 2007 dataset [6] in order to find a DPM structure suited to conv 5 features.
In Table 1, rows 1-3, we show the effect of adding parts to a three component DPM (three was selected through cross-validation). As in HOG-based DPMs, the dimensions of root filters vary across categories and components, influenced by the aspect ratio distribution for each class. Our root filter sizes typically range from 4 × 12 to 12 × 4 feature cells. We start with a "root-only" model (i.e., no parts) and then show results after adding 4 or 8 parts (of size 3 × 3) to each component. With 4 parts, mAP increases by 0.9 percentage points, with an improvement in 16 out of 20 classes. The effect size is small, but appears to be statistically significant (p = 0.016) as judged by a paired-sample permutation test, a standard analysis tool used in the information retrieval community [29].
One significant difference between HOG and conv 5 features is that HOG describes scale-invariant local image statistics (intensity gradients), while conv 5 features describe large (163 × 163 pixel) image patches. The top two rows of Figure 4 illustrate this point. Each row shows a feature pyramid for an image of a face. The first is HOG and the second is the "face channel" of conv 5 . In the HOG representation, the person's face appears at all scales and one can imagine that for each level in the pyramid, it would be possible to define an appropriately sized template that would fire on the face. The conv 5 face channel is quite different. It only shows strong activity when the face is observed in a narrow range of scales. In the first several levels of the pyramid, the face feature responses are nearly all zero (black). The feature peaks in level 6 when the face is at the optimal scale.
Based on the previous experiments with parts and the feature visualizations, we decided to explore another hypothesis: that the convolution filters in conv 5 already act as a set of shared "parts" on top of the conv 4 features. This perspective suggests that one can spread the conv 5 features to introduce some local deformation invariance and then learn a root-only DPM to selectively combine them. This hypothesis is also supported by the features visualized in Figure 4. The heat maps are characteristic of part responses (cat head, person face, upper-left quarter of a circle) in that they select specific visual structures.
We implemented this idea by applying a 3 × 3 max filter to conv 5 and then training a root-only DPM with three components. The max filter is run with a stride of one to prevent subsampling the feature map, which would increase the sliding-window stride to a multiple of 16. We refer to the max-filtered conv 5 features as "max 5 ". Note that this model does not have any explicit DPM parts and that the root filters can be thought of as a learned object geometry filters that combine the conv 5 "parts". This approach (Table 1 row 4) outperforms the DPM variants that operate directly on conv 5 in terms of mAP as well as training and testing speed (since each model only has three filters).

Comparison with other methods
We compare our approach to several other methods on the VOC 2007 dataset. The first notable comparison is to DPM on HOG features. We report results using the standard 6 component, 8 part configuration, which achieves a mAP of 33.7%. We also computed another HOG-DPM baseline using 6 components, but without parts. Removing parts de-creases HOG-DPM performance to 25.2%. The max 5 variant of DeepPyramid DP, which uses conv 5 implicitly as a set of shared parts, has a mAP of 45.2%.
We also compare our method to the recently proposed R-CNN [14]. The directly comparable version of R-CNN uses pool 5 features and no fine-tuning (pool 5 is the same as max 5 , but with a stride of two instead of one). This comparison isolates differences to the use of a sliding-window method versus classifying warped selective search [30] windows. We can see that for some classes where we expect segmentation to succeed, such as aeroplane and cat, R-CNN strongly outperforms DeepPyramid DPM. For classes where we expect segmentation might fail, such as bottle, chair, and person, DeepPyramid DPM strongly outperforms R-CNN. Performance is similar for most of the other categories, with DeepPyramid DPM edging out R-CNN pool 5 in terms of mAP. Of course, this represents the weakest variant of R-CNN, with significant improvements coming from fine-tuning for detection and incorporating a bounding-box (BB) regression stage.
We have shown that DeepPyramid DPM is competitive with R-CNN pool 5 without fine-tuning. The R-CNN results suggest that most of the gains from fine-tuning come in through the non-linear classifier (implemented via layers fc 6 and fc 7 ) applied to pool 5 features. This suggests that it might be possible to achieve similar levels of performance with DeepPyramid DPM through the use of a more powerful non-linear classifier.

Ablation study
To understand the effects of some of our design choices, we report mAP performance on VOC 2007 test using a few ablations of the DP-DPM max 5 model. First, we look at mAP versus the number of mixture components. Mean AP with {1, 2, 3} components is {39.9%, 45.1%, 45.2%}. For most classes, performance improves when going from 1 to 2 or 1 to 3 components because the variety of templates allows for more recall. We also looked at the effect of training with negative examples that come only from negative images (i.e., not using mislocalized positives as negative examples). Using negatives only from negative images decreases mAP by 6.3 percentage points to 38.8%. Using standard DPM non-maximum suppression decreases mAP by 1.3 percentage points.

Results on PASCAL VOC 2010-2012
We used the VOC 2007 dataset for model and hyperparameter selection, and now we report results on VOC 2010-2012 obtained using the official evaluation server. formance against HOG-DPM is especially strong. When comparing to R-CNN FT fc 7 , without bounding-box regression (BB), DeepPyramid DPM manages better performance in two classes: bottle and person. This likely speaks to the weakness in the region proposals for those classes. The VOC 2011 and 2012 sets are the same and performance is similar to 2010, with a mAP of 41.6%.

Conclusion
We have presented a novel synthesis of deformable part models and convolutional neural networks. In particular, we demonstrated that any DPM can be expressed as an equivalent CNN by using distance transform pooling layers and maxout units. Distance transform pooling generalizes max pooling and relates the idea of deformable parts to max pooling. We also showed that a DPM-CNN can run on top a feature pyramid constructed by another CNN. The resulting model-which we call DeepPyramid DPM-is a single CNN that performs multi-scale object detection by mapping an image pyramid to a detection score pyramid.
Our theoretical and experimental contributions bring new life to DPM and show the potential for replacing HOG templates in a wide range of visual recognition systems.