{'fraction_non_alphanumeric': 0.02854230377166157, 'fraction_numerical': 0.012056662800098423, 'mean_word_length': 4.918452257125026, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Viewpoint Adaptation for Rigid Object Detection

An object detector performs suboptimally when applied to image data taken from a viewpoint different from the one with which it was trained. In this paper, we present a viewpoint adaptation algorithm that allows a trained single-view object detector to be adapted to a new, distinct viewpoint. We first illustrate how a feature space transformation can be inferred from a known homography between the source and target viewpoints. Second, we show that a variety of trained classifiers can be modified to behave as if that transformation were applied to each testing instance. The proposed algorithm is evaluated on a person detection task using images from the PETS 2007 and CAVIAR datasets, as well as from a new synthetic multi-view person detection dataset. It yields substantial performance improvements when adapting single-view person detectors to new viewpoints, and simultaneously reduces computational complexity. This work has the potential to improve detection performance for cameras viewing objects from arbitrary viewpoints, while simplifying data collection and feature extraction.


Introduction
The automated detection of objects in images is an important task in a wide variety of applications: autonomous driving, robotics, surveillance, image annotation, and others. While the problem to be solved in each of these scenarios is fundamentally the same, each scenario has different implicit expectations for the position and orientation of the camera with respect to objects in the scene. Recent work, for example, has developed and refined algorithms for pedestrian detection, i.e. the detection of persons from a camera mounted on the hood of a car [1,2]. With this common camera pose, these detectors typically view persons only one way: horizontally at about waist level. This viewpoint is reflected in the popular datasets used to evaluate pedestrian detection algorithms [3,4]. Pedestrian detectors will not perform optimally if applied to, for example, a mall security camera, which may see persons from a wide variety of arXiv:1702.07451v1 [cs.CV] 24 Feb 2017 relative viewpoints (see Figure 1). One goal of this work is to leverage camera pose information along with the existing body of work in pedestrian detection to develop fast and accurate person detectors for cameras with arbitrary (known) poses.
More generally, it is desirable to be able to adapt any rigid object detector trained for one viewpoint to another distinct viewpoint. This is an instance of the "domain adaptation" problem, in which the conditions under which a detector is to be applied do not match the those under which the training data were collected [6]. "Domain" can generally refer to a variety of factors like viewpoint, lighting, and resolution.
Unlike other common domain factors, however, viewpoint effects cannot easily be normalized through feature extraction. We will show that, instead, information about the object and camera geometry can be used to decouple the effects of viewpoint from other domain factors and to learn a feature space transformation between the source and target viewpoints. The feature transformation can then be used to adapt a trained object detector to the target viewpoint. This novel adaptation procedure enables improved detection across different viewpoints while requiring very little additional run-time computation. Furthermore, our approach does not require training data from the target viewpoint, in contrast with existing domain adaptation algorithms.

Related Work
Many domain adaptation algorithms explicitly learn a feature space transformation using data from the source and target viewpoints [7]. Others attempt to select or re-weight training examples from one or more source viewpoints so that they approximately reflect the distribution of instances from the target viewpoint [8,9]. These existing domain adaptation algorithms universally require training images from both the source and target viewpoints and they often also require the corresponding labels from one or both domains. For many applications, however, it is impractical to manually collect new data and retrain the detector for every viewpoint that might be encountered during operation. For moving cameras or those with wide-angle lenses capturing a continuous range of relative perspectives, traditional domain adaptation will be impossible.
Some object detectors instead extract features designed to be invariant to small geometric transformations of various types. For example, scale-invariant feature transforms (SIFT) [10] are partially invariant to changes in objects' scale. Histograms of oriented gradients (HOG) [3] are invariant to small local rotations. Such viewpoint-invariant local features are important to help normalize pose differences in deformable objects. They cannot, however, capture large-scale shape changes, like those illustrated in Figure 1.
For situations like this, many existing methods rely on machine learning algorithms to handle viewpoint differences. These require training data from all viewpoints of interest, and use robust classifiers to distinguish between the (very diverse) class of target instances and the class of background instances. The classification problem resulting from such "multi-view" approaches may be much more complex than detecting persons from only a single viewpoint. Furthermore, it is usually difficult to collect training data sets containing a comprehensive range of perspectives.
Some approaches attempt to avoid these issues by using a 3D model along with images from a small number of "canonical" views to detect objects with arbitrary relative poses [11,12,13]. These do not take advantage of any known camera pose information, and can suffer from high runtime computational requirements.
For ease of computation, the assumption of a planar model is common in optical character recognition [14,15] and has also been used in face recognition [16] and in some general object detection approaches [17]. Li et al. [18] apply this planar assumption to person detection, allowing them to warp candidate detection windows to match the trained classifier's viewpoint ( Figure 2). They show that significant performance improvements may be obtained with this method compared to using a single-view classifier without compensatory warping. However, image warping involves (at run-time) extracting features from each candidate detection window independently, which is impractical for real-time applications.
In contrast, we approach the problem by modifying the trained detector itself to fit the viewpoint in which it will be used. The only other work in computer vision that transforms detection models focuses exclusively on scale [2,19].

Viewpoint Adaptation
Perspective mapping approaches can be used for object detection scenarios in which information is available about the relative geometry of camera and object. This is the case for most person detection applications because camera geometry is typically parameterized with respect to some point on the ground plane, and persons can usually be found adjacent and normal to the ground plane. Many other objects follow similar geometric rules, includings cars, furniture, and many animals.
In contrast with the typical approach in which a projective warping is applied to each testing window before computing features (as in [18], Algorithm 1), we approximate this process by instead applying an appropriate linear transformation to the features themselves (Algorithm 2). For some classes of detectors, we can further improve computational efficiency by observing that this feature transformation is equivalent to a suitable transformation of the trained classifier parameters.
The classifier can thus be adapted to the target viewpoint, requiring nothing but a trained single-view classifier and a homography relating the source and target viewpoints through the presumed object plane. This approach has the benefit of needing only training data from a single viewpoint, so that extensive effort need not be spent acquiring diverse training images. In particular, no data is required from the specific viewpoint in which the classifier will be applied; it is sufficient to have knowledge of the target camera's pose.

Camera Homography
The object is assumed to be planar and perpendicular to the projection of the line segment CP onto the ground plane, where C is the camera's position and P is the object's position. This plane is illustrated by the dotted line in Figure 2. A point on this object plane is described using homogeneous coordinates by where H i is a 3-by-3 homography matrix. The relationship between points in images from two cameras with different viewpoints is then given by

Local Feature Re-mapping
Many object detection algorithms can be defined in terms of a set of local image feature descriptors that are computed for each frame, and a sliding window classifier that uses a small set of those features to make a detection decision [2,3,20,21]. Feature re-mapping can be applied with most detectors of this type, given the homography (H 12 , previously) between source-and target-domain windows. We will demonstrate this viewpoint adaptation for two general classes of local features, which we will call Haar-like and HOG-like. Haar-like and HOGlike features cover a wide variety of the feature types used in modern object detectors [2,3,20,22]. The term "Haar-like feature" is used here to describe any local image feature computed as the sum of pixel intensities over a rectangular image region (a "cell"). It also applies to sums of any pixel-wise function of the image intensity (e.g. sums of squared pixel intensities). These cells are frequently computed original θ = 0 θ = π /8 θ = π /4 warped Fig. 2. Left, the person is assumed to be planar, lying on the plane indicated by the dotted line. Three viewpoints are considered, from cameras at elevations of 0, π /8, and π /4 radians. Right, images from each elevation are warped to approximate 0 elevation (no transformation is necessary for the 0 → 0 case). The approximation degrades as elevation increases due to inaccuracies in the planar human model.
in a grid covering the image, as in Figure 3 (left). Each cell has an "extent" NW defined by the coordinates of its corners. To compute the Haar-like feature from a cell in the target viewpoint given the Haar-like features computed from the source (trained) viewpoint, the target-cell extent is transformed via d k = H st d k using the appropriate source-target homography H st . This extent is then overlaid on the computed (source-view) cell grid, and the result is the sum of the values of the overlapped cells, weighted by the degree to which they overlap the projected extent. Thus the contribution from source-view cell l to target-view cell k is given by This is illustrated in Figure 3 (left). HOG-like features present a slightly greater challenge. They are constructed by computing the gradient (magnitude and angle) across the image, and computing a magnitude-weighted angle histogram within each cell. HOG features for a simple image are shown in Figure 4b. HOG gradient angle bins are restricted to a 180 • arc, so that parallel edges with opposite directions are considered to have the same gradient angle and all gradient magnitudes are positive.
HOG feature re-mapping proceeds in two steps: 1) re-mapping the cell locations like for Haar-like features, and 2) re-mapping the angle histogram bins. The second step requires that we infer an angle transformation from the homography H st , and perform a linear resampling over the angle histogram bins similar to what we did for Haar-like features.  Given a homography matrix of the form the gradient angle at a point [x , y ] in the target viewpoint is given by where θ is the corresponding gradient angle in the source viewpoint. This expression is used to map each angle histogram bin edge into the target domain. Then the contribution of computed bin j to desired bin i is given by This is illustrated in Figure 3 (right).
Combining cell resampling and histogram resampling, a HOG feature vector x can be warped into a new viewpoint domain according to where S performs the spatial resampling of the HOG cells and A performs the resampling of the angle histogram bins. ⊗ denotes the Kronecker product. The two-step HOG feature re-mapping process is illustrated in Figure 4a-4e. We can see that the proposed feature-remapping algorithm approximates the result of applying an inverse perspective mapping to the image before feature computation ( Figure 4g).

Classifier Adaptation
The generic approach to applying the proposed viewpoint adaptation with a trained classifier is to independently re-map each of the computed features for each candidate detection window prior to applying the classifier (see Algorithm 2).
Given an image I; for window w in I do apply image warping w → w ; compute features f (w ); compute decision statistic; end Algorithm 1: Viewpoint adaptation by image warping [18] Given an image I; compute features f (I); for window w in I do apply feature re-mapping f (w) → f (w) ≈ f (w ); compute decision statistic; end Algorithm 2: Viewpoint adaptation by feature re-mapping Linear classifiers are an interesting special case for geometric viewpoint adaptation, because they allow the feature re-mapping to be rolled into the classifier weights themselves, removing even the small run-time computational burden incurred while using nonlinear classifiers.
The learned classifier weights w and the class label y are defined such that Thus we see that identical results can be obtained by either transforming the testing data to match the source viewpoint or by transforming the classifier weights to match the target viewpoint. This novel result allows the application of a feature space transformation off-line, incurring no run-time computational burden. This viewpoint adaptation method for both linear and nonlinear classifiers with Haar-like and HOG-like features has been evaluated for person detection under varying viewpoints using both real and synthetic imagery.

Experiments
We focus here on two specific detectors whose modes of operation represent distinct, important classes of detectors: the classic HOG/SVM pedestrian detector of [20] is a linear classifier using HOG-like features; and the aggregate channel features detector of [2] is a nonlinear classifier using both Haar-like and HOG-like features. Both detectors were applied to real data from two established video surveillance datasets. Most existing person image datasets are not suitable for this task, lacking viewpoint diversity and/or camera information. The CAVIAR [23] and PETS 2007 [5] datasets on which our methods were evaluated, however, include camera information and contain a modest range of relative viewpoints. What they lack, as we will see later, is diversity of persons and backgrounds, for many of the relative viewpoints.
Despite their shortcomings, real-data experiments provide evidence for the efficacy of the proposed methods, and elucidate some of the problems and benefits encountered when using them. Among the latter is the ability to define candidate detection windows in terms of the 3D world space rather than the 2D image space.

Detection window selection
Human detection by searching 3D space was first discussed in [18], and the same principles apply in this work. Building a set of candidate world positions amounts to defining a minimum distance between detections (the detector "stride") and applying the camera projection. The image-space detector stride, measured in pixels, is replaced by a real-world stride, measured in meters. This is illustrated well in Figure 3 of [18]. We can compute the desired real-world stride by analogy with the pixel-space stride. Specifically, ACF assumes that for any given image scale, persons are 96 pixels tall. If persons average 1.75 meters in the real world, then we assume 1.75 /96 ≈ 0.018 meters per pixel. For a desired pixel stride of 8, we then have a real-world stride of 8 × 1.75 /96 = 0.146 meters. Using a fixed real-world stride would yield an infinite number of candidate detection windows in scenes containing the horizon, so we further restrict the detection windows to be no closer than 1 pixel apart in the image space.
It should be noted that each position in the image corresponds to a unique relative viewpoint and associated feature mapping. Thus the detection system must, in general, apply different detection parameters for each image position. These can be computed off-line, however, and simply looked up at run-time.

Real data results
The PETS 2007 dataset [5] (camera 3) contains camera calibration information, but ground truth was estimated manually using the vbb labeling software [4]. The CAVIAR dataset [23] (Meet_Split_3rdGuy) comes with ground truth, but the camera was calibrated ahead-of-time using the provided pixel correspondences. The results presented in Figure 5 compare our viewpoint adaptation method for HOG/SVM and ACF to the original, unadapted detectors and to the corresponding image-warping methods [18]. All detectors were trained with the INRIA training data [3].
For the CAVIAR dataset [23], which has some extreme perspective warping effects, all perspective compensation methods improve substantially over the näive detectors. The sharp decrease in miss rate for some detectors around 1 false positive per image can be attributed to a shelf unit visible in the scene. This specific false alarm can also be seen to cause problems in Figure 9 of [18]. The large impact of a single persistent false alarm highlights an issue with using stationary cameras for evaluation of viewpoint adaptation algorithms: we are essentially given a single source of potential false alarms, whose impact is multiplied by the number of frames in the video. Unfortunately, this issue is unavoidable using existing person detection datasets.
For the PETS 2007 dataset [5], which has much more mild perspective effects, both viewpoint adaptation methods yield smaller improvements, even weakening performance for some false positive rates compared to the unadapted detector. This behavior is expected for scenes with insignificant viewpoint changes and is reasonable in this case, given the strong sources of noise described in the previous paragraph. For both datasets, the adapted ACF detector performs worse than the adapted HOG detector, contrary to our expectations. This unintuitive result requires some explanation. The standard ACF detector achieves excellent detection performance on most pedestrian detection datasets by training a relatively precise detector and applying it at a large number of positions and scales. Contrast this with the HOG detector, which typically uses a larger cell size to achieve a detector more robust to small changes in the position and scale of detection windows. When these two detectors are applied to the same set of manually extracted detection windows in the image warping scenario, HOG is more robust to sources of error including mis-estimation of the camera pose and persons of different-than-average height. These sources of error outweigh the benefits from inverse perspective warping in the PETS 2007 dataset, so we see image warping potentially hurt ACF performance. In the CAVIAR dataset, on the other hand, the perspective effects are severe enough that image warping significantly improves the performance of both detectors.
These real-data experiments begin to demonstrate the capabilities of the proposed methods, but due to the aforementioned dataset issues, are not entirely well-suited to rigorously evaluating viewpoint adaptation methods. To provide an additional, more thorough, evaluation, the HOG/SVM detector was applied to a new synthetic multi-view person detection dataset generated using 3D modelling software.

Multi-view dataset
The SketchUp 3D modelling software [24] provides fine control of position and orientation while allowing production of realistic images with a variety of persons and scenes. A number of synthetic 3D person models and 3D scenes were obtained from the SketchUp 3D Warehouse [25]. Persons were placed randomly in scenes, rotated about the vertical axis, and exposed to various lighting conditions. Figure 6 shows a subset of the diverse persons and scenes, with random lighting and rotation. The camera was positioned so that it pointed at the person, but at elevations of 0, π /8, and π /4 radians, as illustrated in Figure 2.
The dataset consists of 3 instances × 68 persons × 13 scenes × 3 camera elevations = 7956 images. These images were cropped and scaled to 64x128, to be consistent with the INRIA Person Dataset [3]. Background (person-less) images were obtained from 3D scene models without persons present.

Synthetic data results
A separate linear SVM was trained on HOG features from each of the viewpoints, and each trained classifier was tested on the π /4 viewpoint. Then each classifier was adapted to the π /4 viewpoint according to Algorithm 2, and re-tested. Note that the transformation from the π /4 training data to the π /4 viewpoint is the identity, so no comparison is necessary. We also reproduced the results of [18] using these data (Algorithm 1). We used a modified nine-fold cross-validation scheme ensuring that neither scenes nor persons were shared between the training and testing sets. Figure 7 illustrates the performance of each of these detectors. The similarity between the image warping method of [18] and our analogous classifier adaptation is evidence that the feature re-mapping method described above accurately 0 → π /4 0 → π /4, im. warp. 0 → π /4, class. adapt. π /8 → π /4 π /8 → π /4, im. warp. π /8 → π /4, class. adapt. π /4 → π /4 Fig. 7. Performance is shown for a single-view person detector trained on images from three elevations (0, π /8, and π /4) and tested on images from π /4 elevation (indicated by solid, dashed, and dotted red curves, respectively). Our viewpoint adaptation method is illustrated by the purple curves for each of the mismatched detectors, while the image warping method of [18] is represented by blue curves. The achievable frame rates of these methods, where our approach has the clear advantage, is discussed in Section 5.5.
approximates the more computationally expensive image warping. Furthermore, each viewpoint-adapted classifier performs at least as well as the corresponding original classifier, with greater performance gains for source viewpoints farther from the target viewpoint. The main benefit of the proposed approach over that of [18] is in the vastly improved computation time, as we will see in Section 5.5. One potential failing of the proposed viewpoint adaptation algorithm is its reliance on camera pose information. Such information can be acquired by calibration with a known physical target or utilizing some known scene structure [26]. These methods will lead to varying degrees of inaccuracy in the estimated camera pose. We sought, therefore, to explore the robustness of our algorithm with respect to mis-estimation of the camera's elevation.
We used a trained 0-elevation classifier and attempted to apply it to images from an elevation of π /4 radians. To model our uncertainty in that testing elevation, we adapted the classifier to a range of elevations from 0 to π /2, applying each to the π /4 data. The results are illustrated in Figure 8.
The best performance, measured by the miss rate at 10 −2 false positives per window (fppw), is achieved when the estimated and true target elevation are approximately equal. Performance decays as the estimated elevation decreases toward 0 (the source elevation). As the estimated elevation increases beyond π /4, performance decays rapidly, falling below the performance of the original, unadapted detector around 1.1 radians. This means that, for this scenario, classifier 1 estimated target elevation miss rate @ fppw=10 −2 performance of unadaptated detector true target elevation Fig. 8. A trained 0-elevation detector was adapted to a range of elevations from 0 to π /2 radians. It was then evaluated on data from an elevation of π /4. The miss rate at 10 −2 false positives per window is plotted as a function of the elevation to which the detector was adapted. Our approach uniformly improves performance until the estimated target elevation is more than 0.31 radians greater than the true elevation.

Method
Frame adaptation is advantageous for errors of up to 0.31 radians (≈ 18 • ) from the true target elevation. This is much greater than the orientation estimation errors of modern camera calibration approaches, which are on the order of 0.2 − 0.25 • [27,26].

Runtime analysis
In analysing the runtime of perspective warping methods, it is important to understand that runtime does not depend only on the frame size (as in most such analyses, e.g. [2]), but also on the perspective of the scene. This is because the number of potential detection windows (computed as described in Section 5.1) depends on the camera perspective. Thus our analysis looks specifically at the CAVIAR dataset and its associated camera perspective. Table 1 shows the frame rates (using a single Intel Core i7 CPU) for each method when applied to images from the CAVIAR dataset. The most important observation to make here is that image warping methods operate at more than 15 seconds per frame, while the classifier adaptation methods are even faster than the unmodified detectors. Image warping methods are very slow because they must compute features for each detection window independently (see Algorithm 1). For the CAVIAR dataset, we considered 31603 detection windows, each of which is 128 × 64 pixels, so features must be computed over a total of 2.59 × 10 8 pixels. For comparison, the unmodified ACF detector, applied to the same image, computes features over only 2.36 × 10 6 pixels. Indeed, we see about 2 orders of magnitude difference in the resulting frame rates.
A few other observations can be made about these timing results. First, since the computation time for the viewpoint-informed methods is driven by the feature computation time per pixel (without scaling), the adapted HOG detectors are slightly faster than the corresponding adapted ACF detectors, defying the trend in their unadapted counterparts. Second, to ensure a fair comparison to the adapted detectors, the unadapted detectors upsampled the original 384×288 images by a factor of 4. This enabled them to detect small-scale persons but also resulted in frame rates somewhat lower than those advertised in the literature for 640 × 480 images [2].
The viewpoint-adapted detectors achieve higher frame rates than the unadapted detectors by implicitly using camera pose information to limit the scalepositions at which persons may be detected. The choice of candidate detection windows is discussed in detail in Section 5.1. This speedup is conceptually similar to that achieved by [19] by using a stereo camera.

Conclusion
This work is the first to offer a viewpoint adaptation framework limiting the detection search space and handling perspective warping, while retaining frame rates suitable for real-time applications. Our results demonstrate that viewpointadapted detectors can outperform even state-of-the-art detectors that lack perspective correction. Our novel detector adaptation method was demonstrated for linear classifiers, using HOG/SVM as a canonical example, and for the more sophisticated ACF detector [2]. Similar derivations may enable viewpoint adaptation of even more diverse object detection schemes like deformable-parts models [22] and convolutional neural networks [21]. Such implementations are left as future work.
Our viewpoint adaptation algorithm improves detection performance using no training data from the target viewpoint, requiring only information about the pose of the camera with respect to the ground plane. Furthermore, the detector adaptation algorithm is fairly robust with respect to mis-estimation of the target viewpoint, providing performance improvements even for relatively large errors in the estimated viewpoint. These methods may be extended to explicitly handle uncertainty in the camera pose estimate, as well as to detect objects with more complex 3D models.