A tool to visualize feature spaces commonly used in object detection.
We introduce algorithms to visualize feature spaces used by object detectors. The tools in this paper allow a human to put on `HOG goggles' and perceive the visual world as a HOG based object detector sees it. We found that these visualizations allow us to analyze object detection systems in new ways and gain new insight into the detector's failures. For example, when we visualize the features for high scoring false alarms, we discovered that, although they are clearly wrong in image space, they do look deceptively similar to true positives in feature space. This result suggests that many of these false alarms are caused by our choice of feature space, and indicates that creating a better learning algorithm or building bigger datasets is unlikely to correct these errors. By visualizing feature spaces, we can gain a more intuitive understanding of our detection systems.READ FULL TEXT VIEW PDF
We introduce algorithms to visualize feature spaces used by object detec...
Object detection is a very important function of visual perception syste...
Deep learning object detectors often return false positives with very hi...
In this paper, we propose a binarized neural network learning method cal...
Self-supervised learning (SSL) has achieved great success in a variety o...
Deployed into an open world, object detectors are prone to a type of fal...
In this letter, we consider the varying detection environments to addres...
A tool to visualize feature spaces commonly used in object detection.
A tool to visualize feature spaces commonly used in object detection.
A tool to visualize feature spaces commonly used in object detection.
shows a high scoring detection from an object detector with HOG features and a linear SVM classifier trained on PASCAL. Despite our field’s incredible progress in object recognition over the last decade,why do our detectors still think that lakes look like cars?
Unfortunately, computer vision researchers are often unable to explain the failures of object detection systems. Some researchers blame the features, others the training set, and even more the learning algorithm. Yet, if we wish to build the next generation of object detectors, it seems crucial to understand the failures of our current detectors.
In this paper, we introduce tools to explain many of the failures of object detection systems.111Code is available online at http://mit.edu/vondrick/ihog We present algorithms to visualize the feature spaces of object detectors. Since features are too high dimensional for humans to directly inspect, our visualization algorithms work by inverting features back to natural images. We found that these inversions provide an intuitive and accurate visualization of the feature spaces used by object detectors.
Figure 2 shows the output from our visualization on the features for the false car detection. This visualization reveals that, while there are clearly no cars in the original image, there is a car hiding in the HOG descriptor. HOG features see a slightly different visual world than what we see, and by visualizing this space, we can gain a more intuitive understanding of our object detectors.
Figure 3 inverts more top detections on PASCAL for a few categories. Can you guess which are false alarms? Take a minute to study the figure since the next sentence might ruin the surprise. Although every visualization looks like a true positive, all of these detections are actually false alarms. Consequently, we can conclude that, even with a better learning algorithm or more data, these false alarms will likely persist. In other words, the features are to blame.
The principle contribution of this paper is the presentation of algorithms for visualizing features used in object detection. To this end, we present four algorithms to invert object detection features to natural images. Although we focus on HOG features in this paper, our approach is general and can be applied to other features as well. We evaluate our inversions with both automatic benchmarks and a large human study, and we found our visualizations are perceptually more accurate at representing the content of a HOG feature than existing methods; see Figure 4 for a comparison between our visualization and HOG glyphs. We then use our visualizations to inspect the behaviors of object detection systems and analyze their features. Since we hope our visualizations will be useful to other researchers, our final contribution is a public feature visualization toolbox.
Our visualization algorithms extend an actively growing body of work in feature inversion. Torralba and Oliva, in early work , described a simple iterative procedure to recover images only given gist descriptors . Weinzaepfel et al.  were the first to reconstruct an image given its keypoint SIFT descriptors . Their approach obtains compelling reconstructions using a nearest neighbor based approach on a massive database. d’Angelo et al.  then developed an algorithm to reconstruct images given only LBP features [2, 1]. Their method analytically solves for the inverse image and does not require a dataset.
do a good job at reconstructing images from SIFT, LBP, and gist features, our visualization algorithms have several advantages. Firstly, while existing methods are designed for specific features, our visualization algorithms we propose are feature independent. Since we cast feature inversion as a machine learning problem, our algorithms can be used to visualize any feature. In this paper, we focus on features for object detection, the most popular of which is HOG. Secondly, our algorithms are fast: our best algorithm can invert features in under a second on a desktop computer, enabling interactive visualization. Finally, to our knowledge, this paper is the first to invert HOG.
Our visualizations enable analysis that complement a recent line of papers that provide tools to diagnose object recognition systems, which we briefly review here. Parikh and Zitnick [18, 19] introduced a new paradigm for human debugging of object detectors, an idea that we adopt in our experiments. Hoiem et al.  performed a large study analyzing the errors that object detectors make. Divvala et al.  analyze part-based detectors to determine which components of object detection systems have the most impact on performance. Tatu et al.  explored the set of images that generate identical HOG descriptors. Liu and Wang  designed algorithms to highlight which image regions contribute the most to a classifier’s confidence. Zhu et al.  try to determine whether we have reached Bayes risk for HOG. The tools in this paper enable an alternative mode to analyze object detectors through visualizations. By putting on ‘HOG glasses’ and visualizing the world according to the features, we are able to gain a better understanding of the failures and behaviors of our object detection systems.
We pose the feature visualization problem as one of feature inversion, i.e. recovering the natural image that generated a feature vector. Letbe an image and be the corresponding HOG feature descriptor. Since is a many-to-one function, no analytic inverse exists. Hence, we seek an image that, when we compute HOG on it, closely matches the original descriptor :
Optimizing Eqn.1 is challenging. Although Eqn.1 is not convex, we tried gradient-descent strategies by numerically evaluating the derivative in image space with Newton’s method. Unfortunately, we observed poor results, likely because HOG is both highly sensitive to noise and Eqn.1 has frequent local minima.
In the rest of this section, we present four algorithms for inverting HOG features. Since, to our knowledge, no algorithms to invert HOG have yet been developed, we first describe three simple baselines for HOG inversion. In the last section, we present our main inversion algorithm.
Consider the top detections for the exemplar object detector [9, 15] for a few images shown in Figure 5. Although all top detections are false positives, notice that each detection captures some statistics about the query. Even though the detections are wrong, if we squint, we can see parts of the original object appear in each detection.
We use this simple observation to produce our first inversion baseline. Suppose we wish to invert HOG feature . We first train an exemplar LDA detector  for this query, . We score against every sliding window on a large database. The HOG inverse is then the average of the top detections in RGB space: where is an image of a top detection.
This method, although simple, produces surprisingly accurate reconstructions, even when the database does not contain the category of the HOG template. However, it is computationally expensive since it requires running an object detector across a large database. We also point out that a similar nearest neighbor method is used in brain research to visualize what a person might be seeing .
We present a fast, parametric inversion baseline based off ridge regression. Let
be a random variable representing a gray scale image and
be a random variable of its corresponding HOG point. We define these random variables to be normally distributed on a-variate Gaussian with parameters and . In order to invert a HOG feature
, we calculate the most likely image from the conditional Gaussian distribution:
It is well known that Gaussians have a closed form conditional mode:
Under this inversion algorithm, any HOG point can be inverted by a single matrix multiplication, allowing for inversion in under a second.
We estimateand on a large database. In practice, is not positive definite; we add a small uniform prior (i.e., ) so can be inverted. Since we wish to invert any HOG point, we assume that is stationary , allowing us to efficiently learn the covariance across massive datasets. We invert an arbitrary dimensional HOG point by marginalizing out unused dimensions.
We found that ridge regression yields blurred inversions. Intuitively, since HOG is invariant to shifts up to its bin size, there are many images that map to the same HOG point. Ridge regression is reporting the statistically most likely image, which is the average over all shifts. This causes ridge regression to only recover the low frequencies of the original image.
We now provide a baseline that attempts to find images that, when we compute HOG on it, sufficiently match the original descriptor. In order to do this efficiently, we only consider images that span a natural image basis. Let be the natural image basis. We found using the first eigenvectors of worked well for this basis. Any image can be encoded by coefficients in this basis: . We wish to minimize:
Empirically we found success optimizing Eqn.4 using coordinate descent on with random restarts. We use an over-complete basis corresponding to sparse Gabor-like filters for . We compute the eigenvectors of across different scales and translate smaller eigenvectors to form .
In this section, we present our main inversion algorithm. Let be an image and be its HOG descriptor. Suppose we write and in terms of bases and respectively, but with shared coefficients :
The key observation is that inversion can be obtained by first projecting the HOG features onto the HOG basis , then projecting into the natural image basis :
Paired dictionaries require finding appropriate bases and such that Eqn.5
holds. To do this, we solve a paired dictionary learning problem, inspired by recent super resolution sparse coding work[24, 22]:
After a few algebraic manipulations, the above objective simplifies to a standard sparse coding and dictionary learning problem with concatenated dictionaries, which we optimize using SPAMS . Optimization typically took a few hours on medium sized problems. We estimate and with a dictionary size and training samples from a large database. See Figure 7 for a visualization of the learned dictionary pairs.
Unfortunately, the paired dictionary learning formulation suffers on problems of nontrivial scale. In practice, we only learn dictionaries for HOG templates. In order to invert a HOG template , we invert every subpatch inside and average overlapping patches in the final reconstruction. We found that this approximation works well in practice.
We evaluate our inversion algorithms using both qualitative and quantitative measures. We use PASCAL VOC 2011  as our dataset and we invert patches corresponding to objects. Any algorithm that required training could only access the training set. During evaluation, only images from the validation set are examined. The database for exemplar LDA excluded the category of the patch we were inverting to reduce the potential effect of dataset biases.
We show our inversions in Figure 8 for a few object categories. Exemplar LDA and ridge regression tend to produce blurred visualizations. Direct optimization recovers high frequency details at the expense of extra noise. Paired dictionary learning tends to produce the best visualization for HOG descriptors. By learning a dictionary over the visual world and the correlation between HOG and natural images, paired dictionary learning recovered high frequencies without introducing significant noise.
We discovered that the paired dictionary is able to recover color from HOG descriptors. Figure 9 shows the result of training a paired dictionary to estimate RGB images instead of grayscale images. While the paired dictionary assigns arbitrary colors to man-made objects and in-door scenes, it frequently colors natural objects correctly, such as grass or the sky, likely because those categories are strongly correlated to HOG descriptors. We focus on grayscale visualizations in this paper because we found those to be more intuitive for humans to understand.
Our HOG inversions are sensitive to the dimension of their templates. For medium () to large templates (), we obtain reasonable performance. But, for small templates () the inversion is blurred. Fig.10 shows examples as the HOG descriptor dimension changes.
In the remainder of this section, we evaluate our algorithms under two benchmarks. Firstly, we evaluate against an automatic inversion metric that measures how well our inversions reconstruct the original images. Secondly, we conducted a large visualization challenge with human subjects on Amazon Mechanical Turk (MTurk), which is designed to determine how well people can infer the original category from the inverse. The first experiment measures the algorithm’s reconstruction error, while the second experiment analyzes the people’s ability to recover high level semantics from our visualizations.
We consider the inversion performance of our algorithm: given a HOG feature , how well does our inverse reconstruct the original pixels for each algorithm? Since HOG is invariant up to a constant shift and scale, we score each inversion against the original image with normalized cross correlation. Our results are shown in Table 1. Overall, exemplar LDA does the best at pixel level reconstruction.
While the inversion benchmark evaluates how well the inversions reconstruct the original image, it does not capture the high level content of the inverse: is the inverse of a sheep still a sheep? To evaluate this, we conducted a study on MTurk. We sampled 2,000 windows corresponding to objects in PASCAL VOC 2011. We then showed participants an inversion from one of our algorithms and asked users to classify it into one of the 20 categories. Each window was shown to three different users. Users were required to pass a training course and qualification exam before participating in order to guarantee users understood the task. Users could optionally select that they were not confident in their answer. We also compared our algorithms against the standard black-and-white HOG glyph popularized by .
Our results in Table 2 show that paired dictionary learning and direct optimization provide the best visualization of HOG descriptors for humans. Ridge regression and exemplar LDA performs better than the glyph, but they suffer from blurred inversions. Human performance on the HOG glyph is generally poor, and participants were even the slowest at completing that study. Interestingly, the glyph does the best job at visualizing bicycles, likely due to their unique circular gradients. Our results overall suggest that visualizing HOG with the glyph is misleading, and richer visualizations from our paired dictionary are useful for interpreting HOG vectors.
There is strong correlation with the accuracy of humans classifying the HOG inversions with the performance of HOG based object detectors. We found human classification accuracy on inversions and the state-of-the-art object detection AP scores from  are correlated with a Spearman’s rank correlation coefficient of 0.77. This result suggests that humans can predict the performance of object detectors by only looking at HOG visualizations.
We also asked computer vision PhD students to classify HOG glyphs in order to compare MTurk workers with experts in HOG. Our results are summarized in the last column of Table 2. HOG experts performed slightly better than non-experts on the glyph challenge, but experts on glyphs did not beat non-experts on other visualizations. This result suggests that our algorithms produce more intuitive visualizations even for object detection researchers.
We have so far presented four algorithms to visualize object detection features. We evaluated the visualizations with a large human study, and we found that paired dictionary learning provides the most intuitive visualization of HOG features. In this section, we will use this visualization to inspect the behavior of object detection systems.
Our visualizations reveal that the world that features see is slightly different from the world that the human eye perceives. Figure (a)a shows a normal photograph of a man standing in a dark room, but Figure (b)b shows how HOG features see the same man. Since HOG is invariant to illumination changes and amplifies gradients, the background of the scene, normally invisible to the human eye, materializes in our visualization.
In order to understand how this clutter affects object detection, we visualized the features of some of the top false alarms from the Felzenszwalb et al. object detection system  when applied to the PASCAL VOC 2007 test set. Figure 3 shows our visualizations of the features of the top false alarms. Notice how the false alarms look very similar to true positives. This result suggests that these failures are due to limitations of HOG, and consequently, even if we develop better learning algorithms or use larger datasets, these will false alarms will likely persist.
Figure 14 shows the corresponding RGB image patches for the false positives discussed above. Notice how when we view these detections in image space, all of the false alarms are difficult to explain. Why do chair detectors fire on buses, or people detectors on cherries? Instead, by visualizing the detections in feature space, we discovered that the learning algorithm actually made reasonable failures since the features are deceptively similar to true positives.
Although HOG features are designed for machines, how well do humans see in HOG space? If we could quantify human vision on the HOG feature space, we could get insights into the performance of HOG with a perfect learning algorithm (people). Inspired by Parikh and Zitnick’s methodology [18, 19], we conducted a large human study where we had Amazon Mechanical Turk workers act as sliding window HOG based object detectors.
We built an online interface for humans to look at HOG visualizations of window patches at the same resolution as DPM. We instructed workers to either classify a HOG visualization as a positive example or a negative example for a category. By averaging over multiple people (we used 25 people per window), we obtain a real value score for a HOG patch. To build our dataset, we sampled top detections222Note that recall will now go to in these experiments because we only consider windows that DPM detects. Consequently, this experiment can only give us relative orderings of detectors. Unfortunately, computing full precision-recall curves is cost prohibitive. from DPM on the PASCAL VOC 2007 dataset for a few categories. Our dataset consisted of around windows per category and around were true positives.
Figure 12 shows precision recall curves for the Human+HOG based object detector. In most cases, human subjects classifying HOG visualizations were able to rank sliding windows with either the same accuracy or better than DPM. Humans tied DPM for recognizing cars, suggesting that performance may be saturated for car detection on HOG. Humans were slightly superior to DPM for chairs, although performance might be nearing saturation soon. There appears to be the most potential for improvement for detecting cats with HOG. Subjects performed slightly worst than DPM for detecting people, but we believe this is the case because humans tend to be good at fabricating people in abstract drawings.
We then repeated the same experiment as above on chairs except we instructed users to classify the original RGB patch instead of the HOG visualization. As expected, humans achieved near perfect accuracy at detecting chairs with RGB sliding windows. The performance gap between the Human+HOG detector and Human+RGB detector demonstrates the amount of information that HOG features discard.
Our experiments suggest that there is still some performance left to be squeezed out of HOG. However, DPM is likely operating very close to the performance limit of HOG. Since humans are the ideal learning agent and they still had trouble detecting objects in HOG space, HOG may be too lossy of a descriptor for high performance object detection. If we wish to significantly advance the state-of-the-art in recognition, we suspect focusing effort on building better features that capture finer details as well as higher level information will lead to substantial performance improvements in object detection.
We found our algorithms are also useful for visualizing the learned models of an object detector. Figure 13 visualizes the root templates and the parts from  by inverting the positive components of the learned weights. These visualizations provide hints on which gradients the learning found discriminative. Notice the detailed structure that emerges from our visualization that is not apparent in the HOG glyph. In most cases, one can recognize the category of the detector by only looking at the visualizations.
We believe visualizations can be a powerful tool for understanding object detection systems and advancing research in computer vision. To this end, this paper presented and evaluated four algorithms to visualize object detection features. Since object detection researchers analyze HOG glyphs everyday and nearly every recent object detection paper includes HOG visualizations, we hope more intuitive visualizations will prove useful for the community.
We thank Hamed Pirsiavash, Joseph Lim, the MIT CSAIL vision group, and anonymous reviewers. Funding for this research was provided by a NSF GRFP to CV, a Facebook fellowship to AK, and a Google research award, ONR MURI N000141010933 and NSF Career Award No. 0747120 to AT.
We provide the full inversion benchmark with normalized cross correlation:
We provide the full visualization benchmark with human subjects:
We show the confusion matrices for humans classifying our HOG inversions for various algorithms:
On the left, we show the color inverse. On the right, we show the original image.