Finding Tiny Faces
- Publication
- CVPR 2017Conference
- First submitted to arXiv
- arXiv:1612.04402
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{objectdetectiontinyfaces2016,
title = {{Finding Tiny Faces}},
author = {Peiyun Hu and Deva Ramanan},
year = {2016},
eprint = {1612.04402},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1612.04402}
}
On a face 300 pixels tall you can count the eyebrows, the corners of the eyes and the nostrils; a face 3 pixels tall is just a few dots of slightly different color. The abstract of Finding Tiny Faces sets these two faces side by side and says that "the cues for recognizing a 3px tall face are fundamentally different than those for recognizing a 300px tall face." Detectors, though, often assume that one set of templates, scaled a little, can handle both.
The paper comes from Peiyun Hu and Deva Ramanan at Carnegie Mellon University (CMU). It proposes no new network layers; most of it is controlled experiments answering three very concrete questions. To find a small face, how much of its surroundings should you look at? How big should the template be? Should the image be upscaled first? The detector built from the three answers is what the paper calls HR (hybrid resolution).
Results first. On Hard, the hardest test set of the then-new WIDER FACE, the best entry among the paper's comparisons, CMS-RCNN, scored 0.643, and HR 0.819. Taking 1 minus AP as the error, it drops from 0.357 to 0.181, roughly halved, which is what the abstract means by "reduce error by a factor of 2."
Defining the Problem
How Small Hard's Faces Are
A face detector takes in a photo and outputs a box and a confidence score for each face. WIDER FACE has 32,203 images and 393,703 faces, split 4:1:5 into training, validation and test. The validation and test sets are further divided by difficulty into three groups, Easy, Medium and Hard. The grouping depends on whether a traditional proposal method (EdgeBox) can find the face, and the harder it is to find, the harder the group; the three groups are cumulative, with Hard containing the faces of the first two.
Difficulty is closely tied to face size. The paper says Hard covers all faces taller than 10 pixels. Checked against the validation annotations that come with the official evaluation tool, Hard keeps 31,958 faces, and the 7,750 excluded are all no taller than 10 pixels; the shortest face Medium keeps is 16 pixels, and Easy's is 34 pixels.
Scoring uses AP. A detection counts as correct if its IoU (intersection area divided by union area) with a labeled box is above 0.5. Sort all detections by score from high to low and count down; at each one, compute precision (what fraction of those found are real faces) and recall (what fraction of the real faces have been found), and plot them as a PR curve. AP is the area under the curve.
How Big Should the Template Be?
Detectors have traditionally handled scale in one of two ways.
The first is the image pyramid. The template has a fixed size, such as Viola–Jones's 24×24 window, and the image is scaled into a stack of different sizes, each scanned in turn. To find a 3-pixel face, you have to upscale the image 8× so the face grows as large as the template.
The second is Faster R-CNN's RoI pooling. Candidate boxes are proposed first, and the features inside each box are then resized to a fixed size (7×7, say) for the classification head. A 10-pixel face covers less than one cell of a stride-16 feature map, so resizing it to 7×7 spreads less than one cell of features over 49 cells.
Both approaches resize objects to a "canonical size" before deciding. How should that size be chosen? Only a small template fits a small face, and only a large template can make use of details like the eyes, nose and mouth. The authors' plan is to train a separate detector for each scale, but that leaves each scale with less training data, and testing means running a whole pile of detectors. So these detectors share one backbone, each taking one output channel on the same feature map, trained together as a multi-task model.
Training RPN (Faster R-CNN's proposal network) directly on faces gives 0.716 on validation Hard. Every step after this adds something on top of that baseline.
Small Faces Need Their Surroundings

The left half is a comparison the authors put together. The small face in the top row, cropped out on its own, is nothing but a blob of color; with the box enlarged 3× (blue box), you can just about tell it's a head; only with a fixed 300 pixels of surroundings (yellow box) do you see a group of cyclists, and the head belongs to one of them. The large face in the bottom row is recognizable even without its surroundings.
The right half puts numbers on this. The authors took true positives and false positives from their own detector and had human subjects tell the real ones from the fake, under three conditions: only what's inside the box (green), the box enlarged proportionally by 3× (blue), and a fixed 300 pixels of surroundings (yellow). For XL faces, the three conditions give about 0.88, 0.91 and 0.91, so context makes almost no difference. For XS faces it's about 0.50, 0.54 and 0.69. If real and fake are split half and half, 0.50 is about as good as guessing; a 3× proportional enlargement gives a 10-pixel face only a 30-pixel window, which helps little; only a fixed 300 pixels of surroundings pulls the accuracy up.
The authors therefore argue that the size of the context shouldn't scale in proportion to the face. The smaller the face, the more of its surroundings it needs relative to its size; the simplest approach is to look at an equally large area no matter how big the face is.
That leaves a few questions. What does "surroundings" correspond to inside a CNN? To see 300 pixels, which layer's features should be used? And how should the size of the template be set?
Solving the Problem
Finding Faces of Just One Size
To separate the variables, the authors first shrank the problem to finding faces of a single fixed size, 25×20, with large 250×200 faces for comparison.
Fixed-size detection can be written as heatmap prediction. The network outputs a heatmap whose value at position is the confidence that "a 25×20 face is centered at ." Computing the whole heatmap in one pass with a fully convolutional network (FCN) is equivalent to sliding a 25×20 window over the entire image. The backbone used for the analysis is ResNet-50, and the heatmap can be computed from the last layer of any of its four stages, res2 to res5.
Context Is the Receptive Field
The input region that a position on the heatmap "can see" is called its receptive field. The deeper the layer, the larger the receptive field.
The receptive field can be computed layer by layer. A 3×3 convolution on a feature map with stride sees one more cell on each side, and each cell stands for pixels, so the receptive field grows by . The last layer of ResNet-50's res3 has a receptive field of 99×99. The next stage, res4, has 6 bottleneck blocks, each with one 3×3 convolution at stride 16, so it's . res5 has 3 blocks at stride 32, adding , for 483.

Each column is one combination of features, with the receptive-field size in parentheses under the column name; the dashed boxes draw the receptive fields around the face, and the green box is the face itself. The top row finds small 25×20 faces, the bottom row large 250×200 faces, and each cell shows an average face.
For the small faces, left to right, the scores are 49.6%, 66.6%, 68.5% and 65.0%. With res2 alone, the receptive field just covers the face, and it does worst; growing the receptive field to 291×291 does best; growing it further to 483×483 drops back to 65.0%. The authors compared training and test performance and confirmed that the drop is overfitting.
For the large faces they are 25.8%, 66.3%, 88.6% and 90.1%. When the receptive field is too small, the network sees only the area around the nose and can hardly tell whether a whole face is there, which is why res2 gets only 25.8%.
Taking the receptive field that "just covers the object" as the reference (res2 for small faces, the 291 column for large ones) and comparing it with the best combination, small faces improve by 18.9 percentage points and large faces by only 1.5. This agrees with the human experiment; context mainly helps small faces.
291×291 is best for small faces, and for large faces it is only 1.5 below the best combination. So the authors had templates of every size share the same receptive field. In practice that's a single multi-channel heatmap, with each template taking one channel and computing its own binary classification loss.
Sharp in the Center, Blurry in the Periphery
The combinations in the previous section all stack layers like "res4 + res3 + res2," using deep and shallow features together. What happens with the deepest layer alone?
| Deepest | Small alone | Small stacked | Large alone | Large stacked |
|---|---|---|---|---|
| res3 | 66.5 | 66.6 | 66.7 | 66.3 |
| res4 | 61.3 | 68.5 | 88.1 | 88.6 |
| res5 | 31.9 | 65.0 | 89.8 | 90.1 |
Compiled from Figure 5 of the paper. "Stacked" means adding all the shallower layers on top; the res4 row, for example, is res4 + res3 + res2.
For small faces, using res4 alone loses 7.2 percentage points and res5 alone loses 33.1; large faces are barely affected.
The reason is resolution. res4 has a stride of 16, so a 25×20 face covers only a little over one cell of res4; res5 has a stride of 32, and the face covers less than one cell. The receptive field is big enough, but the positions are too coarse to place the box accurately. Shallow layers have small strides and can pin down where the face is; deep layers take care of the surroundings.
The authors call this combination a foveal descriptor. The fovea is the central pit of the retina, the small patch that sees most sharply when you look at something, with everything around it increasingly blurred. The shallow features are the sharp center, and the deep features are the blurry but large periphery. It's the same idea as the hypercolumn (concatenating the features of one position across layers).
In practice the features don't actually have to be concatenated. Take res3 and res4, which the final model uses. The res3 feature at position is ; the res4 feature has twice the stride and must first be upsampled to res3's resolution, written . The score of the -th template is a linear prediction:
splits into a 512-dimensional for res3 and a 1024-dimensional for res4, and the second line just splits the inner product in two. Bilinear upsampling is a weighted average with fixed weights, , so
Computing scores with a 1×1 convolution on res4's small map first and then upsampling the score map gives exactly the same result. That's how the official code is written. res3 and res4 each get a 1×1 convolution with 125 output channels (classification scores for the 25 templates, plus 4 box-regression values per template), and res4's score map is enlarged 2× by a fixed bilinear deconvolution and added to res3's scores. What gets upsampled is 125 channels, not 1,024.
The paper's analysis uses res2 to res5, but the final model keeps only res3 and res4 and drops res5 entirely. The authors answered in issue #26 (July 2017) that adding res2 performs almost the same but costs more.
Sizing the Template
Next comes the paper's most counterintuitive set of experiments.

Notation first. is a template of size on an image at resolution , responsible for objects of in the original image. is a 50×40 template running on an image upscaled 2×, and it finds 25×20 faces in the original image.
The two paths on the left look for the same batch of 25×20 faces. The upper path uses a 25×20 template directly, 68.5%; the lower path first upscales the image 2×, so the faces become 50×40, and then uses a 50×40 template, 74.8%. The right half is the reverse. 250×200 faces found directly give 88.6%, while shrinking the image by half first and using a 125×100 template gives 94.2%.
Upscaling is interpolation and adds no information whatsoever, yet it gains 6.3 percentage points. Why?
The first possibility is the amount of training data. WIDER FACE has far more small faces than large ones; one photo can be packed with small faces, while large faces usually come only a few at a time. This can explain the large-face pair, where there are more medium-sized faces than large ones and the medium template learns better. It can't explain the small-face pair, though. Small faces have even more samples than medium-sized ones, yet the medium template still wins.
The authors point instead to the pretraining data. Normalize every ImageNet image to 224×224 and tally the average object size of each category, and more than eighty percent of the categories fall between 40 and 140 pixels. ResNet is pretrained on ImageNet, so its filters are probably tuned for objects in this range. 25×20 faces are smaller than the range and 250×200 faces larger; scaling each into the range lets the pretrained features work more smoothly.
This is the authors' hypothesis, and the next section tests it with a larger experiment.
25 Templates, Each Picking Its Own Resolution
Real faces come in more than two sizes. The authors first cluster the boxes of the WIDER FACE training set into 25 representative box shapes. The distance between two box shapes and is defined as
is the IoU of the two boxes with their centers aligned (the paper calls it the Jaccard similarity). Try it with 25×20 and 31×25. The small box lies entirely inside the large one, so the intersection is 500 and the union is , giving and a distance of about 0.355. The official code clusters with K-medoids, using only faces at least 10 pixels in both height and width.
Then, for each box shape and each resolution , a multi-task model is trained, to see which works best.

The horizontal axis is the 25 face sizes (height×width), large on the left and small on the right. The three lines are templates at three resolutions, and the gray dashed line is how much training data each size has (right vertical axis).
The plot falls naturally into three segments. For the largest faces on the left, the blue line (0.5X) is highest; 455×346 faces get about 0.96, while 1X gets only about 0.63. At 136×104 the blue and red lines tie at around 0.90, and further right the red line (1X) leads. At 43×34 the red and yellow lines cross at around 0.81, and from there on the yellow line (2X) rules; at the smallest, 12×11, 2X gets about 0.34 and 1X only about 0.09.
From this the authors set the boundaries. Faces taller than 140 pixels use 0.5X, faces shorter than 40 pixels use 2X, and those in between use 1X. 40 to 140 is exactly the range of ImageNet's average category sizes, and this is the evidence for the hypothesis in the previous section.
Now compare with the gray line. The amount of data rises steadily from left to right; the largest faces number a few hundred, while a single cluster of the smallest faces has over twenty thousand. Small faces have the most data, and 2X still beats 1X by a wide margin, so the amount of data can't explain the gap.
Once the best is chosen for each size, a single model is retrained with each of the 25 templates at its own resolution; this is HR. Its performance roughly follows the upper edge of the three lines.
Pruning Duplicate Templates
Many of the 25 templates are duplicates. is the best template for 31×25 faces, and is the best template for 64×50 faces. The two templates are almost the same size on the image, the former running on an image upscaled 2×. So running the latter directly on the 2× upscaled image would also find faces of about 32×25.
Following this reasoning, most templates can be replaced by "1X templates running on different levels of an image pyramid," and only the smallest faces need dedicated 2X templates. The final model keeps just two groups:
- Type A: 1X templates for faces 40 to 140 pixels tall, run on every level of the image pyramid (including the 2× upscaled level);
- Type B: 2X templates for faces under 20 pixels, run only on the 2× upscaled image.
The official code actually has 8 type A and 7 type B templates; the other 10 (4 at 0.5X, and 6 at 2X covering 23 to 38 pixels) are pruned.

RefBox_N25_scaled.mat and the test script cnn_widerface_test_AB.m in the official repo.The bottom half shows the division of labor after pruning. A face's height on pyramid level is times its height in the original image, and type A templates cover 43 to 110 pixels, which is to in the original image. Joined across the four pyramid levels (2X, 1X, 0.5X, 0.25X), type A covers faces of 21 to 440 pixels in the original image; type B fills in 11 to 20 pixels on the 2X level, and the two ranges almost meet.
| Model | Easy | Medium | Hard |
|---|---|---|---|
| RPN | 0.896 | 0.847 | 0.716 |
| HR (Full, 25 templates) | 0.919 | 0.908 | 0.823 |
| HR (A+B) | 0.925 | 0.914 | 0.831 |
Compiled from Table 1 of the paper, WIDER FACE validation set, ResNet-101.
With 10 templates pruned, all three groups still gain 0.6 to 0.8 percentage points. Compared with RPN, Hard gains 11.5 percentage points.
Running One 1080p Photo End to End
Putting the pieces together, walk a 1920×1080 photo through.
The backbone is ResNet-101, cut off after res4. The photo is first scaled into four copies, 0.25X, 0.5X, 1X and 2X (the setting of the official test script, which skips a level if either side exceeds 5,000 pixels after upscaling). Each copy runs through the network once, giving a 25-channel classification heatmap and a 100-channel regression map at stride 8, and the scores of templates that shouldn't appear on that level are then cleared. At 1X and below only type A is kept, and at 2X both type A and type B.
The 2X copy is 3840×2160, so its heatmap has positions; times 15 templates, that's nearly 1.94 million candidate scores. The 1X copy's heatmap has positions, times 8 templates for 259,200. 0.5X and 0.25X have fewer still. The four copies' pixel counts stand at , so the 2X copy takes about three quarters of the computation, which is why the paper says running time is dominated by the 2X level (this note's estimate).
For heatmap cell (counted from 1), the official demo code converts it back to center coordinates on that level's image, and , and then corrects the box with the template's width and height and the regression values :
Finally it divides by that level's scaling factor to get back to the original image's coordinates. The boxes from all four copies are pooled (the official test script's score threshold is 0.03), followed by a single NMS at IoU 0.3 (non-maximum suppression, which keeps only the highest-scoring box among boxes that overlap too much).
Training
Training images are first scaled at random to 0.5X, 1X or 2X (with a probability of one third each in the official code), then a random 500×500 crop is taken, with any part outside the image filled with the mean color. The scaling factors are the three resolutions considered at test time, so the faces seen in training are the same size as at test time.
For each position and each template on the heatmap, find the face it has the highest IoU with. An IoU above 0.7 is a positive, below 0.3 a negative, and anything in between is ignored. The official code adds one more rule. For each face, the position and template with its highest IoU also count as a positive as long as that IoU is above 0.3, so faces that are hard to line up don't end up with no positives at all.
Large faces produce many positives on the heatmap and small faces only a few, so each image samples at most 128 positives and 128 negatives. Before sampling, hard example mining is done, and positions with a classification loss below 0.03 are dropped outright. A logistic loss of 0.03 means the model gives the correct answer a probability of about 0.97 (); these positions have already been learned.
Box regression follows Faster R-CNN's parameterization, with center offsets divided by the template's width and height and log ratios for width and height, and a Huber loss. The learning rate is fixed at , with weight decay 0.0005 and momentum 0.9, training for 50 epochs and keeping the epoch that does best on the validation set.
Discussion
WIDER FACE Results
| Method | Easy | Medium | Hard |
|---|---|---|---|
| ACF | 0.659 | 0.541 | 0.273 |
| Faceness | 0.713 | 0.664 | 0.424 |
| MTCNN | 0.848 | 0.825 | 0.598 |
| CMS-RCNN | 0.899 | 0.874 | 0.624 |
| HR-VGG16 | 0.862 | 0.844 | 0.749 |
| HR-ResNet50 | 0.907 | 0.890 | 0.802 |
| HR-ResNet101 | 0.919 | 0.908 | 0.823 |
Excerpted from Table 2 of the paper, WIDER FACE validation set.
The gap is concentrated on Hard. CMS-RCNN is still 3.7 above HR-VGG16 on Easy, but 12.5 below it on Hard. CMS-RCNN also uses context, but by enlarging the proposal box proportionally, exactly what the blue bars in the human experiment did. Switching the backbone from VGG16 to ResNet-101 adds another 7.4 percentage points on Hard.
For the test set, results have to be sent to the organizers for scoring. HR-ResNet101 (A+B) scores 0.819 on the Hard test set, against CMS-RCNN at 0.643, MTCNN at 0.607, Faceness at 0.315 and ACF at 0.290.
Two Small Ablations
Hard example mining has almost no effect. With mining the scores are 0.919/0.908/0.823, without it 0.917/0.904/0.825, and Hard is actually slightly higher without mining. Both versions use balanced sampling of 128 against 128 per image, so the ratio of positives to negatives is already fixed, and there seems to be little left for mining to improve.
Box regression is more useful. Removing regression at test time drops Easy from 0.919 to 0.911 and Hard from 0.823 to 0.798, a loss of 2.5 percentage points. A small face's box only has to be off by a few pixels for the IoU to fall below 0.5, so regression is worth the most on small faces.
Where the Detector Goes Wrong
The appendix breaks down the errors with the analysis tool of Hoiem et al. This tool reports normalized AP, fixing the number of positives in each subset to the same value before computing AP, so subsets of different sizes can be compared.
Scale has the biggest effect. The group with the smallest box area (XS) gets only 0.04, and the largest (XL) 0.90. Next comes blur, with clear faces at 0.80 and heavily blurred ones at 0.26. Occlusion matters too, with unoccluded faces at 0.53 and partially or heavily occluded ones at only 0.32 and 0.33. More surprisingly, exaggerated expressions (0.64) and extreme illumination (0.51) actually do better than the typical cases (both 0.46); pose makes almost no difference, with typical and atypical both at 0.46.
The authors also printed out the 20 highest-scoring false positives on the validation set one by one, and 15 of those boxes sit on real faces that simply weren't labeled. Most of the highest-scoring "errors" are faces the labels missed.
FDDB and Ellipses
FDDB is another commonly used exam, with 2,845 images and 5,171 faces, labeled with ellipses. Scoring plots an ROC curve, with the total number of false positives (boxes drawn on things that aren't faces) on the horizontal axis and the fraction of faces found on the vertical axis. The discrete score counts a detection with an IoU above 0.5 as 1 and everything else as 0; the continuous score uses the IoU value directly, so the more tightly the box fits the ellipse, the higher the score.
HR, trained only on WIDER FACE and tested directly on FDDB, beats every published result on the discrete score. On the continuous score it's at a disadvantage, since it outputs rectangles while FDDB's answers are ellipses. So the authors trained a separate linear regressor that turns boxes into ellipses (HR-ER):
are the center, width and height of the predicted box, is the ellipse's center, and are its two semi-axes, and is its rotation angle. The center offsets are again divided by the box's width and height, and the two semi-axes are log ratios against half the box's height and half its width. The regressor is trained offline on the same features as box regression, with 10-fold cross-validation on FDDB itself.
By the numbers in the FDDB legend of the SSH paper, HR's discrete score is 0.970 and HR-ER's 0.976; on the continuous score HR has only 0.688, and with ellipse regression it becomes 0.790, ranking first. The training and test code the authors released in 2017 doesn't include this regressor. Someone opened issue #80 in November 2018 to ask about it and got no reply (the regressor lives only in the paper).
Speed
The paper reports that the ResNet-101 version runs at 1.4 images per second on 1080p images and 3.1 per second on 720p, without naming the GPU. Running time doesn't depend on how many faces are in the frame, unlike two-stage detectors, where every extra proposal means one more pass through the classification head.
This number needs a careful look at what it measures. The measure_runtime.m in the official repo times only one forward pass of the ImageNet ResNet-101 on random 1080p and 720p images upscaled 2×; its comment says that with multi-scale testing the time is dominated by the largest level. In June 2017 a user reported in issue #23 that on a 1080 Ti, the group selfie that comes with the demo still took 500 milliseconds per image even after being shrunk 4×. The author replied that the demo script's pyramid is finer, that switching to three levels, 0.5X, 1X and 2X, gives roughly the paper's speed, and that anyone who doesn't care about tiny faces can keep only 0.5X and 1X.
The later SSH paper timed HR on a Quadro P6000 at 1,010 milliseconds per image on the WIDER FACE validation set.
Official Code and Reproduction
The official code is at peiyunh/tiny, MATLAB with MatConvNet, with training, testing and evaluation scripts. Its license covers academic and nonprofit research use only, so anyone hoping to use it commercially should read the terms carefully first.
The PyTorch port listed in the official README is varunagrawal/tiny-faces-pytorch, whose architecture likewise uses only res3 and res4. The validation results in its README are 0.902/0.892/0.797, with Hard 2.6 below the paper's 0.823. In December 2021 a user reported in issue #26 that following the training procedure gave only 0.812/0.814/0.691, and asked the maintainer for training logs; four days later the person who asked closed the issue themselves, with no reply from the maintainer.
Another number needs checking too. WIDER FACE's official evaluation tool ships PR curves for each method. HR's test-set curve works out to 0.924/0.911/0.820, consistent with the paper's 0.819, but its validation-set curve gives 0.926/0.911/0.806, 1.7 below the 0.823 the paper itself reports. The official README states that all the paper's numbers were computed with the official evaluation script, and the discrepancy goes unexplained. When SSH and PyramidBox compare against HR on the validation set, both use the curve from the evaluation tool, with Hard at 0.806.
How Later Work Saw It
SNIP, which a year later was also working on the scale problem, likewise discusses whether images should be upscaled from the angle of pretraining resolution. When it cites this paper, it doubts that "one set of filters per scale" carries over to objects in general. The SNIP authors added scale-specific filters for each category on R-FCN, and performance actually got worse. Their explanation is that generic object detection has limited data per category, and far more variation in appearance and pose than faces do. Faces are a single class with plenty of data, which is what makes 25 templates affordable.
On the speed side, the successor was SSH in August 2017. It attaches a detection module to layers at different depths of VGG-16 and uses no image pyramid, handling large, medium and small faces in a single forward pass, and it gets its context by enlarging the receptive field with convolutions instead.
Conclusion
In June 2017 someone asked in the official repo whether HR could run in real time, and the author's suggestion for speeding it up was to make the image pyramid coarser; if you don't care about tiny faces, you can drop even the 2X level. HR's trade-off comes down to this one level. It takes about three quarters of the computation, and the type B templates for faces under 20 pixels run only on this level. If the faces in a surveillance feed are all 40 pixels or larger, it's the first thing to drop; to find faces a dozen or so pixels tall in a concert audience, it has to stay, and keep in mind that the official script skips this level when either side exceeds 5,000 pixels after 2× upscaling.
Put together a fixed large context, shallow layers for localization with deep layers for the surroundings, and templates sitting in the 40-to-140-pixel range where ImageNet objects are most common, and the resulting HR scores 0.819 on the WIDER FACE Hard test set, against 0.643 for CMS-RCNN, the best of its comparisons. Upscaling before searching stuck around too; eight months later, SSH also upscaled images to a short side of 1,200 pixels before testing on WIDER FACE.