Putting Objects in Perspective

Image understanding requires not only individually estimating elements of the visual world but also capturing the interplay among them. In this paper, we provide a framework for placing local object detection in the context of the overall 3D scene by modeling the interdependence of objects, surface orientations, and camera viewpoint. Most object detection methods consider all scales and locations in the image as equally likely. We show that with probabilistic estimates of 3D geometry, both in terms of surfaces and world coordinates, we can put objects into perspective and model the scale and location variance in the image. Our approach reflects the cyclical nature of the problem by allowing probabilistic object hypotheses to refine geometry and vice-versa. Our framework allows painless substitution of almost any object detector and is easily extended to include other aspects of image understanding. Our results confirm the benefits of our integrated approach.


Introduction
Consider the street scene depicted on Figure 1. Most people will have little trouble seeing that the green box in the middle contains a car. This is despite the fact that, shown in isolation, these same pixels can just as easily be interpreted as a person's shoulder, a mouse, a stack of books, a balcony, or a million other things! Yet, when we look at the entire scene, all ambiguity is resolved -the car is unmistakably a car. How do we do this?
There is strong psychophysical evidence (e.g. [3,25]) that context plays a crucial role in scene understanding. In our example, the car-like blob is recognized as a car because: 1) it's sitting on the road, and 2) it's the "right" size, relative to other objects in the scene (cars, buildings, pedestrians, etc). Of course, the trouble is that everything is tightly interconnected -a visual object that uses others as its context will, in turn, be used as context by these other objects. We recognize a car because it's on the road. But how do we recognize a road? -because there are cars! How does one attack this chicken-and-egg problem? What is the right framework for connecting all these pieces of the recognition puzzle in a coherent and tractable manner?
In this paper we will propose a unified approach for modeling the contextual symbiosis between three crucial ele- Figure 1. General object recognition cannot be solved locally, but requires the interpretation of the entire image. In the above image, it's virtually impossible to recognize the car, the person and the road in isolation, but taken together they form a coherent visual story. Our paper tells this story. ments required for scene understanding: low-level object detectors, rough 3D scene geometry, and approximate camera position/orientation. Our main insight is to model the contextual relationships between the visual elements, not in the 2D image plane where they have been projected by the camera, but within the 3D world where they actually reside. Perspective projection obscures the relationships that are present in the actual scene: a nearby car will appear much bigger than a car far away, even though in reality they are the same height. We "undo" the perspective projection and analyze the objects in the space of the 3D scene.

Background
In its early days, computer vision had but a single grand goal: to provide a complete semantic interpretation of an input image by reasoning about the 3D scene that generated it. Indeed, by the late 1970s there were several image understanding systems being developed, including such 2.2<y c <2.8 (a) input image (c) surface orientation estimate (e) P(viewpoint | objects) (b) P(person) = uniform (d) P(person | geometry) (f) P(person | viewpoint) (g) P(person|viewpoint,geometry) Figure 2. Watch for pedestrians! In (b,d,f,g), we show 100 boxes sampled according to the available information. Given an input image (a), a local object detector will expect to find a pedestrian at any location/scale (b). However, given an estimate of rough surface orientations (c), we can better predict where a pedestrian is likely to be (d). We can estimate the camera viewpoint (e) from a few known objects in the image. Conversely, knowing the camera viewpoint can help in predict the likely scale of a pedestrian (f). The combined evidence from surface geometry and camera viewpoint provides a powerful predictor of where a pedestrian might be (g), before we even run a pedestrian detector! Red, green, and blue channels of (c) indicate confidence in vertical, ground, and sky, respectively. Best viewed in color.
pioneering work as Brooks' ACRONYM [4], Hanson and Riseman's VISIONS [9], Ohta and Kanade's outdoor scene understanding system [19], Barrow and Tenenbaum's intrinsic images [2], etc. For example, VISIONS was an extremely ambitious system that analyzed a scene on many interrelated levels including segments, 3D surfaces and volumes, objects, and scene categories. However, because of the heavy use of heuristics, none of these early systems were particularly successful, which led people to doubt the very goal of complete image understanding.
We believe that the vision pioneers were simply ahead of their time. They had no choice but to rely on heuristics because they lacked the computational resources to learn the relationships governing the structure of our visual world. The advancement of learning methods in the last decade brings renewed hope for a complete image understanding solution. However, the currently popular learning approaches are based on looking at small image windows at all locations and scales to find specific objects. This works wonderfully for face detection [23,29] (since the inside of a face is much more important than the boundary) but is quite unreliable for other types of objects, such as cars and pedestrians, especially at the smaller scales.
As a result, several researchers have recently begun to consider the use of contextual information for object detection. The main focus has been on modeling direct relationships between objects and other objects [15,18], regions [10,16,28] or scene categories [18,24], all within the 2D image. Going beyond the 2D image plane, Hoiem et al. [11] propose a mechanism for estimating rough 3D scene geometry from a single image and use this information as additional features to improve object detection. From lowlevel image cues, Torralba and Oliva [26] get a sense of the viewpoint and mean scene depth, which provides a useful prior for object detection [27]. Forsyth et al. [7] describe a method for geometric consistency of object hypotheses in simple scenes using hard algebraic constraints. Others have also modeled the relationship between the camera parameters and objects, requiring either a well-calibrated camera (e.g. [12]), a stationary surveillance camera (e.g. [14]), or both [8].
In this work, we draw on several of the previous techniques: local object detection (based on Murphy et al. [18]), 3D scene geometry estimation [11], and camera viewpoint estimation. Our contribution is a statistical framework that allows simultaneous inference of object identities, surface orientations, and camera viewpoint using a single image taken from an uncalibrated camera.

Overview
To evaluate our approach, we have chosen a very challenging dataset of outdoor images [22] that contain cars and people, often partly occluded, over an extremely wide range of scales and in accidental poses (unlike, for example, the framed photographs in Corel or CalTech datasets). Our goal is to demonstrate that substantial improvement over standard low-level detectors can be obtained by reasoning about the underlying 3D scene structure.
One way to think about what we are trying to achieve is to consider the likely places in an image where an ob- ject (e.g. a pedestrian) could be found ( Figure 2). Without considering the 3D structure of the scene, all image positions and scales are equally likely ( Figure 2b) -this is what most object detectors assume. But if we can estimate the rough surface geometry in the scene, this information can be used to adjust the probability of finding a pedestrian at a given image location ( Figure 2d). Likewise, having an estimate of the camera viewpoint (height and horizon position) supplies the likely scale of an object in the image (Figure 2f). Combining these two geometric cues together gives us a rather tight prior likelihood for the location and scale of a pedestrian, as in Figure 2g. This example is particularly interesting because this is still only a prior -we have not applied a pedestrian detector yet. Notice, as well, that the pattern of expected pedestrian detections is very reminiscent of typical human eye-tracking experiments, where subjects are asked to search for a person in an image.
Of course, just as scene and camera geometry can influence object detection, so can the detected objects alter the geometry estimation. For example, if we know the locations/scales of some of the objects in the image, we can use this to better estimate the camera viewpoint parameters (see the 90% confidence bounds in Figure 2e). In general, our aim is to combine all these pieces of evidence into a single coherent image interpretation framework.
The rest of the paper will be devoted to exploring our two primary conjectures: 1) 3D reasoning improves object detection, even when using a single image from an uncalibrated camera, and 2) the more fully the scene is modeled (more properties, more objects), the better the estimates will be. We will first describe the mathematics of projective geometry as it relates to our problem (Section 2). We will then define the probabilistic model used for describing the relationships within the 3D scene (Section 3) and how it can be learned (Section 4). Finally, we present quantitative and qualitative results demonstrating the performance of our system on a difficult dataset (Section 5).

Scene Projection
Under a zero-skew, unit aspect ratio perspective camera model, we can compute a grounded object's height in the scene, given only the camera height and horizon line (see Figure 3). First, let's rotate and translate our image coordinates (u, v) to the coordinates (û,v) so thatv = 0 for every point on the horizon andv > 0 for every point below the horizon. The world height y of a point can be recovered fromv = (y c − y) f z where y c is the camera height, z is the depth, and f is the camera focal length. Without loss of generality, we define the object to rest on the plane y = 0. The object's height can be recovered fromv 1 v1−v2 = yc y , wherev 1 is the bottom andv 2 is the top of the object. To getv from pixel coordinates, we simply compute the distance of the horizon line to the point. In this paper, since photographs typically have little roll, we define the horizon line by the image row v 0 . Letting v i and h i denote the bottom position and height of an object in the image, we have the following relationship: From equation 1, we can compute the image height h i of an object given its image position v i , 3D height y i , and the viewpoint (v 0 , y c ). Of course, for an uncalibrated camera, we do not know the viewpoint or the object's true height a priori. However, since people do not take photos in a completely random manner and since objects have a small range of possible 3D sizes, we can estimate an informative distribution of viewpoint and object size and, from it, derive a distribution for h i given v i .
In our paper, we assume that all objects of interest rest on the ground plane. While this assumption may seem restrictive (cannot find people on the rooftops), humans seem to make the same assumption (we don't notice the security standing on the rooftops at political rallies unless we specifically look for them). If the ground is sloped, as in Figure 2, the coordinates and parameters are computed with respect to that slope, and the relationship between viewpoint and objects in the image still holds.

Modeling the Scene
We want to determine the viewpoint, object identities, and surface geometry of the scene from an image. We could estimate each independently, but our estimates will be much more accurate if we take advantage of the interactions between the scene elements. We consider the objects (e.g., cars, pedestrians, background) and geometric surfaces to each produce image evidence. The viewpoint, defined by the horizon position in the image and the camera height, directly affects the position and size of the objects in the image. In turn, the objects directly affect nearby geometric surfaces. We assume that local geometric surfaces are independent given their corresponding object identities and that the object identities are independent given the viewpoint. In Figure 4, we represent these conditional independence assumptions in a graphical model, denoting objects as o, surface geometries as g, object evidence as e o , geometry evidence as e g , and the viewpoint as θ.
Our model implies the following decomposition: The proportionality Equation 2 is with respect to terms of the observed evidence (e = {e o , e g }) that are constant within an image. Our approach allows other researchers to easily integrate their own detectors into our framework. When interactions among elements of the scene are defined, each addition to the framework adds evidence that can be used to improve estimation of the other elements.

Viewpoint
The viewpoint θ involves two variables: the horizon position in the image v 0 and the camera height (in meters) y c . We consider camera height and horizon position to be independent a priori so that P (θ) = P (v 0 )P (y c ). We investigated using image statistics, including vanishing points [13] and surface geometry [11], as evidence for the horizon position but found that a simple Gaussian prior performed just as well. Similarly, for the camera height y c , we estimate a prior distribution using kernel density estimation over the y c values (computed based on objects of known height in the scene) in a set of training images. Figure 5 displays the viewpoint prior (e) and an example of the revised likelihood (f) when object and surface geometry evidences are considered. A priori, the most likely camera height is 1.67m, which happens to be eye level for a typical adult male, and the most likely horizon position is 0.50. While the viewpoint prior does have high variance, it is much more informative than the uniform distribution that is implicitly assumed when scale is considered irrelevant.

Objects
An object candidate o i consists of a type t i ∈ {object, background} (e.g. "pedestrian") and a bounding box bbox i = {u i , v i , w i , h i } (lower-left coordinate, width, and height, respectively). The object term of our scene model is composed as follows: Our window-based object detector outputs the classconditional log-likelihood ratio at each position and scale (with discrete steps) in the image. From these ratios and a prior P (o i ), we can compute the probability of an object occurring at a particular location/scale: where c i is the log-likelihood ratio estimated by the detector, based on local image information I i at the i th bounding box. Typically, researchers perform non-maxima suppression, assuming that high detection responses at neighboring positions could be due to an object at either of those positions (but not both). Making the same assumption, we also apply non-maxima suppression, but we form a point distribution out of the non-maxima, rather than discarding them. An object candidate is formed out of a group of closely overlapping bounding boxes. 1 The candidate's likelihood P (t i = obj|e o ) is equal to the likelihood of the highestconfidence bounding box, and the likelihoods of the locations given the object identity P (bbox i |t i = obj, e o ) are directly proportional to P (t i = obj, bbox i |I). After thresholding to remove detections with very low confidences from consideration, a typical image will contain several dozen object candidates (determining n), each of which has tens to hundreds of possible position/shapes. An object's height depends on its position when given the viewpoint. Formally, P (o i |θ) ∝ p(h i |t i , v i , θ) (the proportionality is due to the uniformity of P (t i , v i , w i |θ)).

Surface Geometry
Most objects of interest can be considered as vertical surfaces supported by the ground plane. Estimates of the local , and a prior (e) on the viewpoint. Using our model, we improve our estimates of the viewpoint (f) and objects (i,j). In the viewpoint plots, the left axis is camera height (meters), and the right axis is horizon position (measured from the image bottom). The viewpoint peak likelihood increases from 0.0037 a priori to 0.0503 after inference. At roughly the same false positive (cars:cyan, peds:yellow) rate, the true detection (cars:green, peds:red) rate doubles when the scene is coherently modeled.
surface geometry could, therefore, provide additional evidence for objects. To obtain the rough 3D surface orientations in the image, we apply the method of [11] (we use the publicly available executable), which produces confidence maps for three main classes: "ground", "vertical", and "sky", and five subclasses of "vertical": planar, facing "left", "center", and "right", and non-planar "solid" and "porous". Figure 5(b,c,d) displays the confidence maps for the three main surface labels. We define g i to have three values corresponding to whether the object surface is visible in the detection window and, if so, whether the ground is visible just below the detection window. For example, we consider a car's geometric surface to be planar or non-planar solid and a pedestrian's surface to be non-planar solid. We can compute P (g i |o i ) and P (g i ) by counting occurrences of each value of g i in a training set. If o i is background, we consider P (g i |o i ) ≈ P (g i ). We estimate P (g i |e g ) based on the confidence maps of the geometric surfaces. In experiments, we found that the average geometric confidence in a window is a well-calibrated probability for the geometric value.

Inference
Inference is well-understood for tree-structured graphs like our model (Figure 4). We use Pearl's belief propagation 2 algorithm [20] from the Bayes Net Toolbox [17]. Once the model is defined and its parameters estimated, as described above, it can answer queries, such as "What is the expected height of this object?" or "What are the marginal probabilities for cars?" or "What is the most probable explanation of the scene?". In this paper, we report results based on marginal probabilities from the sum-product algorithm. Figure 5 shows how local detections (g,h) improve when viewpoint and surface geometry are considered (i,j).

Training
Viewpoint. To estimate the priors for θ, we manually labeled the horizon in 60 outdoor images from the LabelMe database [22]. In each image, we labeled cars (including vans and trucks) and pedestrians (defined as an upright person) and computed the maximum likelihood estimate of the camera height based on the labeled horizon and the height distributions of cars and people in the world. We then estimated the prior for camera height using kernel density estimation (ksdensity in Matlab).
Objects. Our baseline car and pedestrian detector uses a method similar to the local detector of Murphy, Torralba, and Freeman [18]. We used the same local patch template features but added six color features that encode the average L*a*b color of the detection window and the difference between the detection window and the surrounding area. The classifier uses a logistic regression version of Adaboost [5] to boost eight-node decision tree classifiers. For cars, we trained two views (front/back: 32x24 pixels and side: 40x16 pixels), and for pedestrians, we trained one view (16x40 pixels). Each were trained using the full PAS-CAL dataset [1].
To verify that our baseline detector has reasonable performance, we trained a car detector on the PASCAL challenge training/validation set, and evaluated the images in test set 1 using the criteria prescribed for the official competition. For the sake of comparison in this validation experiment, we did not search for cars shorter than 10% of the image height, since most of the official entries could not detect small cars. We obtain an average precision of 0.423 which is comparable to the best scores reported by the top 3 groups: 0.613, 0.489, and 0.353.
To estimate the height distribution of cars (in the 3D world), we used Consumer Reports (www.consumerreports.org) and, for pedestrians, used data from the National Center for Health Statistics (www.cdc.gov/nchs/). For cars, we estimated a mean of 1.59m and a standard deviation of 0.21m. For adult humans, the mean height is 1.7m with a standard deviation of 0.085m. Alternatively, the distribution of (relative) object heights and camera heights could be learned simultaneously using the EM algorithm if the training set includes images that contain multiple objects. Surface Geometry. P (g i |o i ) was found by counting the occurrences of the values of g i for both people and cars in the 60 training images from LabelMe. We set P (g i ) to be uniform, because we found experimentally that learned values for P (g i ) resulted in the system over-relying on geometry. This over-reliance may be due to our labeled images (general outdoor) being drawn from a different distribution than our test set (streets of Boston) or to the lack of a modeled direct dependence between surface geometries. Further investigation is required.

Evaluation
Our test set consists of 422 random outdoor images from the LabelMe dataset [22]. The busy city streets, sidewalks, parking lots, and roads provide realistic environments for testing car and pedestrian detectors, and the wide variety of object pose and size and the frequency of occlusions make detection extremely challenging. In the dataset, 60 images have no cars or pedestrians, 44 have only pedestrians, 94 have only cars, and 224 have both cars and pedestrians. In total, the images contain 923 cars and 720 pedestrians.
We detect cars with heights as small as 14 pixels and pedestrians as small as 36 pixels tall. To get detection confidences for each window, we reverse the process described in Section 3.2. We then determine the bounding boxes of objects in the standard way, by thresholding the confidences and performing non-maxima suppression.
Our goal in these experiments is to show that, by modeling the interactions among several aspects of the scene and inferring their likelihoods together, we can do much better than if we estimate each one individually.
Object Detection Results. Figure 6 plots the ROC curves for car and pedestrian detection on our test set when different subsets of the model are considered.  our framework, we report the percent reduction in false negatives for varying false positive rates in Table 1. When the viewpoint and surface geometry are considered, about 20% of cars and pedestrians missed by the baseline are detected for the same false positive rate! The improvement due to considering the viewpoint is especially amazing, since the viewpoint uses no direct image evidence. Also note that, while individual use of surface geometry estimates and the viewpoint provides improvement, using both together improves results further.
Horizon Estimation Results. By performing inference over our model, the object and geometry evidence can also be used to improve the horizon estimates. We manually labeled the horizon in 100 of our images that contained both types of objects. Table 2 gives the mean and median absolute error over these images. Our prior of 0.50 results in a median error of 0.085% of the image height, but when objects and surface geometry are considered, the median error reduces to 0.038%. Notice how the geometry evidence provides a substantial improvement in horizon estimation, even though it is separated from the viewpoint by two variables in our model.

More is Better.
Intuitively, the more types of objects that we can identify, the better our horizon estimates will Figure 6. Considering viewpoint and surface geometry improves results over purely local object detection. The left two plots show object detection results using only local object evidence (Obj), object and geometry evidence (ObjGeom), objects related through the viewpoint (ObjView), and the full model (ObjViewGeom). On the right, we plot results using the Dalal-Triggs local detector [6].
be, leading to improved object detection. We verify this experimentally, performing the inference with only car detection, only pedestrian detection, and both. Table 3 gives the accuracy for horizon estimation and object detection when only cars are detected, when only pedestrians are detected, and when both are detected. As predicted, detecting two objects provides better horizon estimation and object detection than detecting one.

Dalal-Triggs Detector.
To support our claim that any local object detector can be easily improved by plugging it into our framework, we performed experiments using the Dalal-Triggs detector [6] after converting the SVM outputs to probabilities using the method of [21]. We used code, data, and parameters provided by the authors, training an 80x24 car detector and 32x96 and 16x48 (for big and small) pedestrian detectors . The Dalal-Triggs local detector is currently among the most accurate for pedestrians, but it's accuracy ( Figure 6) improves considerably with our framework, from 57% to 66% detections at 1 FP per image.

Discussion
In this paper, we have provided a "skeleton" model of a scene -a tree structure of camera, objects, and surface geometry. Our model-based approach has two main advantages over the more direct "bag of features/black box" classification method: 1) subtle relationships (such as that object sizes relate through the viewpoint) can be easily represented; and 2) additions and extensions to the model are easy (the direct method requires complete retraining whenever anything changes).
To add a new object to our model, one needs only to train a detector for that object and supply the distribution of the object's height in the 3D scene. Our framework could also be extended by modeling other scene properties, such as scene category. By modeling the direct relationships of objects and geometry (which can be done in 3D, since perspective is already part of our framework) further improvement is possible.
As more types of objects can be identified and more aspects of the scene can be estimated, we hope that our framework will eventually grow into a vision system that would fulfill the ambitions of the early computer vision researchers -a system capable of complete image understanding.