Back to paper library
Paper notesarXiv 2017ICCV 2017

S3FD

Playing Favorites

Original paper

S$^3$FD: Single Shot Scale-invariant Face Detector

Paper authors

Shifeng Zhang · Xiangyu Zhu · Zhen Lei · Hailin Shi · Xiaobo Wang · Stan Z. Li

Publication
ICCV 2017Conference
First submitted to arXiv
arXiv:1708.05237
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{objectdetections3fd2017,
  title = {{S\$\textasciicircum{}3\$FD: Single Shot Scale-invariant Face Detector}},
  author = {Shifeng Zhang and Xiangyu Zhu and Zhen Lei and Hailin Shi and Xiaobo Wang and Stan Z. Li},
  year = {2017},
  eprint = {1708.05237},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1708.05237}
}
On this page

An anchor is a fixed-size box a detector lays out over the image in advance, for comparing against faces. Anchor sizes jump in steps, 16, 32, 64, 128, while face sizes are continuous. The S3FD authors counted, under the rules in common use at the time, that a face whose side lands exactly on an anchor size gets about 4 anchors on average during training; a face wedged between two sizes gets only about 1.5; and a face under 10 pixels doesn't even get 1. The smaller the face and the more awkward its size, the fewer positives the detector has to learn from.

S3FD's full name is Single Shot Scale-invariant Face Detector, and it came out of the Institute of Automation of the Chinese Academy of Sciences in 2017. The scale-invariant in the title is its ambition. Anchor-based detectors of the time didn't treat large and small faces fairly, and results fell as soon as faces got smaller. The authors wanted to find out where the favoritism came from, and then fix it, one spot at a time.

This detector went on to have a long life. face-alignment is the official implementation of FAN; the first time you call FaceAlignment(LandmarksType.TWO_D), it downloads a file called s3fd-619a316812.pth, and before it looks for 68 landmarks, it relies on the S3FD in that file (called SFD in the package) to box the faces. Wav2Lip, which does lip-syncing, also has you put the same file at face_detection/detection/sfd/s3fd.pth. In April 2026 face-alignment released v1.5.0, adding three detectors at once, SCRFD, RetinaFace and YuNet, but the default is still SFD, which the README calls the most accurate, at the cost of speed.

Defining the Problem

How an Anchor-Based Detector Finds Faces

First, anchors in more detail. Take a 640×640640\times640 image, and suppose one of its feature maps has a stride of 4; that map has 160×160160\times160 positions, each corresponding to a point on the original image, one every 4 pixels. At each point a fixed-size box is placed in advance, say 16×1616\times16, and that's an anchor. For each anchor the network answers two questions, whether there's a face in this box (classification), and how the box should shift and resize to fit that face (box regression).

During training you first have to decide which anchors count as positives. The standard approach uses IoU, the area of the intersection of two boxes divided by the area of their union. A 16×1616\times16 anchor and a face of the same size shifted 4 pixels to the right have an intersection of 12×16=19212\times16=192 and a union of 256+256−192=320256+256-192=320, an IoU of 0.6. SSD's rule is that each face first takes the anchor with the highest IoU, and then every anchor with an IoU above 0.5 is assigned to it, with the rest as background; Faster R-CNN's RPN uses the same two steps, only with the positive threshold set at 0.7.

At inference, every anchor with a high enough score is decoded into a detection box. The same face is usually boxed by several neighboring anchors, and non-maximum suppression (NMS) removes the duplicates at the end, keeping the highest-scoring box, deleting the boxes whose IoU with it exceeds a threshold, and repeating the step on the boxes that remain.

WIDER FACE's Hard

The main battleground for evaluation is WIDER FACE, with 32,203 images and 393,703 face boxes, split 40%, 10% and 50% into training, validation and test sets. Each subset is further divided into Easy, Medium and Hard, according to whether the traditional proposal method EdgeBox can pick out the face; faces it finds are easy, faces it can't find are hard. This difficulty is closely tied to face size, and the S3FD paper roughly maps the three groups to large, medium and small faces, with Hard mostly small faces.

Scoring uses AP. A detection counts as correct if its IoU with a labeled box is above 0.5; sort all detections by score from high to low and count down the list, computing precision (what fraction of those found are real) and recall (what fraction of the real faces have been found) at each step, and plot them as a PR curve. AP is the area under the curve.

Four Ways Small Faces Lose Out

Citing Huang et al.'s comparison of generic object detectors, the authors note that the performance of anchor-based detectors falls sharply as objects get smaller. They break the causes down into four small panels.

Original Figure 1: four panels. (a) A very small face passes through a CNN with stride 8 or 16 and is left as a single black cell of features, labeled few features for detection. (b) A white Gaussian-like glow on a black background, with an outer blue box labeled Receptive field, a green box in the middle labeled Pre-set anchor, and a very small face inside it labeled Small face, all three pointing to Mutual Mismatch. (c) The horizontal axis is face scale (logarithmic, from 1 to around 512), the vertical axis the number of matched anchors (0 to 4.5); the blue line has a peak of about 4 near each of 16, 32, 64, 128, 256 and 512, with troughs of about 1.4 to 1.6 between peaks, circled in red and labeled outer face; the red line below 10, labeled tiny face, is only 0 to 1; a horizontal dashed line labeled average line sits at about 3.3. (d) Two photos of the same size: on the left, a small face in a crowd covered with a fine grid, labeled pos: 1 neg: 149; on the right, a single large face with only a coarse grid, labeled pos: 1 neg: 5.
Original Figure 1, Zhang et al., from PDF page 1, arXiv license, scholarly quotation.

(a) is too few features. SSD's shallowest detection layer has a stride of 8, and RPN sits on VGG16's conv5_3 with a stride of 16. A 16-pixel face covers just one cell of a stride-16 feature map, so the network has to decide whether it's a face from the vector at that one position.

(b) is three sizes that don't match. The receptive field is the region of the input image that a position on the feature map can see. The small face, the anchor and the receptive field each go their own way; the anchor is larger than the face, the receptive field is far larger than the anchor, and the small face takes up only a little patch in the middle of the whole receptive field.

(c) is too few anchors matched. Anchor sizes are discrete and face sizes are continuous. A face exactly the size of an anchor gets about 4 anchors, a face wedged between two sizes (an outer face) only about 1.5, and a face under 10 pixels (a tiny face) not even 1. On average each face gets about 3 anchors, which the authors consider too few for the model to give it a high score.

(d) is too much background. To catch small faces you have to tile lots of small anchors on shallow layers. Of two images of the same size, the large face on the right uses large anchors, with only 5 negatives per positive; the small face in the crowd on the left needs small anchors, and the negatives jump to 149.

So this paper has three questions to answer. Which layers should anchors go on, and how big on each, so that small faces have enough features? How can every face, whatever its size, get enough anchors during training? And with so many small anchors tiled, how can the false positives from the background be held down?

Solving the Problem

Following a 640×640 Image

Original Figure 2: the architecture. On the left is a 640×640 input image with green boxes around several faces. The gray block in the middle is Base Convolutional Layers (VGG16 through Pool5 layer), marking three dark-gray feature maps, Conv3_3 (160×160), Conv4_3 (80×80) and Conv5_3 (40×40). The gray block on the right is Extra Convolutional Layers, in order Conv_fc6 (3x3x1024, 20×20), Conv_fc7 (1x1x1024, 20×20), Conv6_1 (1x1x256, 20×20), Conv6_2 (3x3x512-s2, 10×10), Conv7_1 (1x1x128, 10×10) and Conv7_2 (3x3x256-s2, 5×5), of which Conv_fc7, Conv6_2 and Conv7_2 are dark gray. The first three layers pass through Normalization Layers, and all six connect down to Predicted Convolutional Layers; the Conv3_3 branch is labeled 3x3x(1x(Ns+4)) and the rest 3x3x(1x(2+4)); below Conv3_3 is an extra Max-out BG label block, and everything finally flows into the Multi-task Loss Layer (SoftmaxLoss and SmoothL1Loss). A dashed box at the bottom left lists the six detection layers.
Original Figure 2, Zhang et al., from PDF page 3, arXiv license, scholarly quotation.

The backbone is VGG16, keeping conv1_1 through pool5 and removing the classification layers after it. The original fully connected layers fc6 and fc7 are rewritten as convolutions (with parameters sampled from the original weights), followed by two more groups of convolutions, conv6 and conv7, each first reducing channels with a 1×11\times1 and then halving the feature map with a stride-2 3×33\times3.

The six dark-gray feature maps in the figure are the detection layers, with strides doubling from 4 all the way to 128:

LayerStrideAnchorReceptive fieldAnchor count
conv3_34164825,600
conv4_38321086,400
conv5_316642281,600
conv_fc732128340400
conv6_264256468100
conv7_212851272425

Compiled from Tables 1 and 2 of the paper, for a 640×640640\times640 input, in pixels.

Each position holds just one square anchor, because face boxes are roughly square. That's 34,125 anchors in all, 75% of them on conv3_3.

Each detection layer is followed by a 3×33\times3 prediction convolution, which outputs 4 box-regression offsets and 2 scores (face, background) for each anchor. conv3_3 is the exception, outputting 4 scores, for a reason that comes up with max-out below. The feature magnitudes of the shallow layers conv3_3, conv4_3 and conv5_3 differ a lot from those of the deep ones, so they are L2-normalized first and then multiplied by learnable scales initialized at 10, 8 and 5.

The receptive fields in the table already include that 3×33\times3 prediction convolution. Take conv3_3 as a check. From the input to conv3_3, VGG16 stacks seven 3×33\times3 convolutions and two poolings, for a receptive field of 40 pixels; one more 3×33\times3 on the stride-4 feature map sees one more cell on each side, which is 4 more pixels on each side, giving 48.

Compare the shallowest layer with the two baselines. The RPN-style face detector (the paper calls it RPN-face) tiles all six anchor sizes from 16 to 512 on conv5_3, at stride 16; the SSD-style one (SSD-face) starts from conv4_3, at stride 8. S3FD pulls in one more layer, conv3_3, where a 16-pixel face covers 4×44\times4 cells.

Anchor Size: The Effective Receptive Field

How are anchor sizes set? The authors use two grounds, and the first is the receptive field.

Original Figure 3: three panels. (a) A white, grainy glow on a black background, brightest in the center and fading outward. (b) A crop of a face; a black-and-white dashed box around it is the theoretical receptive field, a blue dotted circle on the face is the effective receptive field, and a red square inside the circle is the anchor. (c) Four squares, all of size n, each shifted n/4 down and to the right of the last, colored blue, green, gray and yellow, over a grid cut into n/4 cells, with n and three n/4 marked along the top and left.
Original Figure 3, Zhang et al., from PDF page 4, arXiv license, scholarly quotation.

The theoretical receptive field is the region of the input image that can affect a given output value, 48×4848\times48 for conv3_3 plus the prediction convolution. But the pixels within that 48×48 don't contribute equally. Luo et al. measured in 2016 that the closer a pixel is to the center, the more influence it has, and the truly effective range is roughly a Gaussian blob taking up only part of the theoretical receptive field. This is called the effective receptive field, and (a) shows what it looks like.

(b) is the concrete case of conv3_3. The black-and-white dashed box is the 48×48 theoretical receptive field, the blue dotted circle is the estimated effective receptive field, and the red box is the 16×16 anchor. The anchor is much smaller than the theoretical receptive field and falls right inside the effective receptive field.

This ground is most convincing in the shallow layers. The ratios of anchor to receptive field across the six layers are 16/48, 32/108, 64/228, 128/340, 256/468 and 512/724; the first three are all around 0.3, and the last three rise to 0.38, 0.55 and 0.71, closer to the receptive field the deeper you go. The paper gives only the one concrete example of conv3_3 and doesn't measure the effective receptive field layer by layer.

Anchor Density: Equal-Proportion Interval

The second ground sets the relation between anchor and stride. In the table, every layer's anchor is 4 times its stride, which is exactly what (c) shows, with anchors of size nn placed every n/4n/4.

This arrangement means that on any layer, a face as large as the anchor has 4×4=164\times4=16 anchor centers inside its box. That holds for a 16-pixel face on conv3_3 just as it does for a 256-pixel face on conv6_2. The authors call this the equal-proportion interval principle, meant to give faces of every size about the same number of anchors.

How many anchors a face actually gets follows from the IoU calculation earlier. For a face the same size as the anchor, centered exactly on one anchor:

  • the anchor right at the center has an IoU of 1;
  • the four offset by one stride (n/4n/4) up, down, left or right have an IoU of 3/42−3/4=0.6\frac{3/4}{2-3/4}=0.6;
  • the four offset diagonally have an IoU of 9/162−9/16≈0.39\frac{9/16}{2-9/16}\approx0.39;
  • those offset by two strides have an IoU of 1/22−1/2≈0.33\frac{1/2}{2-1/2}\approx0.33.

At a threshold of 0.5 only the first two pass, at most 5 anchors. That's where the peaks of around 4 in Figure 1(c) come from.

Scale Compensation Anchor Matching

The trouble lies between the peaks. Take a 24-pixel face, which sits between the 16 and 32 anchors:

  • when a 16-pixel anchor lies entirely inside the face, the IoU is at most 256/576≈0.44256/576\approx0.44;
  • when a 32-pixel anchor fully contains the face, the IoU is 576/1024≈0.56576/1024\approx0.56.

Only the few 32-pixel anchors that contain the face get past 0.5. Smaller faces fare even worse. A 10-pixel face sitting entirely inside a 16-pixel anchor has an IoU of 100/256≈0.39100/256\approx0.39, no anchor gets past 0.5, and only the "each face first takes its highest-IoU anchor" rule is left as a floor.

The authors' fix comes in two stages.

  1. Stage one: follow the original rule, but lower the threshold from 0.5 to 0.35.
  2. Stage two: for faces still short of anchors after stage one, pick the anchors whose IoU with the face is above 0.1, sort them by IoU and take the top NN. NN is the average number per face from stage one.

The paper doesn't say what NN is. The first author later added in issue #12 (December 2017) of the official repo that each face gets about 10 anchors at a threshold of 0.35 and fewer than 5 at 0.5; stage two handles only faces with fewer than 6 after stage one, topping them up to their 6 highest-IoU anchors, and issue #34 also confirms that N=6N=6 is an empirical value for WIDER FACE. The lower bound of 0.1 is there to exclude anchors that are too far off.

Which faces does each of the two stages take care of? Let's actually compute it with the six layers of anchors in the table.

A line chart drawn for this note, titled "How many anchors does a face get on average?" The horizontal axis is face width on a log scale from 5 to 600 pixels, with dashed lines marking the six anchor sizes 16, 32, 64, 128, 256 and 512; the vertical axis is the number of matched anchors, 0 to 18. The blue line is the original rule, IoU ≥ 0.5: about 4 near each anchor size, dropping to around 2 between two sizes, labeled Between two anchor sizes, and only 1 at 11 pixels and below. The orange line is stage one, with a threshold of 0.35: about 9 at the anchor sizes, rising instead to 15 or 16 between two sizes, about 3.5 at 10 pixels, and only 1 at 9 pixels and below. The thick green line is stage two, which tops the count up to 6 from 6 to 12 pixels, labeled Topped up to 6, and coincides with the orange line elsewhere; at 5 pixels all three lines are at 1.
Drawn for this note, computed from the anchor settings in Table 1 and the matching rules of Section 3.2 of the paper.

The setup is a square face with its center placed at random on the image (400 placements per width, averaged), looking at this one face only and ignoring the image borders, with N=6N=6.

The blue line is the original rule, peaking around 4 and dropping to about 2 between peaks, the same shape as Figure 1(c). Faces of 16 and 32 pixels get 4.1 anchors on average, the 24-pixel face between them only 1.9, and faces of 11 pixels and below just the floor of 1 (to reach 0.5 with a 16-pixel anchor, a face needs at least 160.5≈11.316\sqrt{0.5}\approx11.3 pixels).

The orange line is after lowering the threshold to 0.35. The most obvious change is between the peaks, where the 24-pixel face jumps to 15.9 at once, because anchors on both neighboring layers now pass the threshold, the 16-pixel layer's 0.44 and the 32-pixel layer's 0.56 counting at the same time. The outer faces that used to lose out the most now get the most.

The green line is stage two, which acts only at the lower left. A 10-pixel face gets 3.5 anchors in stage one and an 8-pixel face only 1, and stage two tops both up to 6. Going smaller, a 5-pixel face's IoU with a 16-pixel anchor is at most 25/256≈0.09825/256\approx0.098, not even 0.1, so it can't be topped up; at 6 pixels it's 36/256≈0.1436/256\approx0.14, still within reach. Official training also throws out ground-truth boxes with a height or width under 6 pixels (as the author explained in issue #62), so the two lower bounds line up exactly.

So by this calculation, lowering the threshold is what handles outer faces, and stage two looks after tiny faces of 6 to 12 pixels. WIDER FACE's faces aren't square, and in crowds several faces often compete for the same anchor, so the real numbers will differ; the paper's ablation adds both stages together, without comparing them separately.

Max-out Background Label

On a 640×640 image, over 99.8% of S3FD's anchors are background. The imbalance comes mainly from conv3_3, whose 25,600 anchors are small and dense, exactly the situation in the left image of Figure 1(d). A small anchor sees only a little patch of texture, and folds in clothing, hands, leaves and distant signs can all look like a 10-pixel face.

The authors' approach is to have each conv3_3 anchor predict several background scores. Where each anchor used to output 2 scores (background, face), it now outputs Nm+1N_m+1; the maximum of the NmN_m background scores is taken and then fed into a softmax together with the face score. The paper sets Nm=3N_m=3.

What does this step look like in the official model? clcarwin converted the official Caffe weights to PyTorch, and face-alignment reuses the same code. conv3_3's classification convolution outputs 4 channels, the first 3 background and the 4th face:

Python
cls1 = self.conv3_3_norm_mbox_conf(f3_3)
# max-out background label
chunk = torch.chunk(cls1, 4, 1)
bmax  = torch.max(torch.max(chunk[0],chunk[1]),chunk[2])
cls1  = torch.cat([bmax,chunk[3]],dim=1)

The classification convolutions of the other five layers have only 2 channels and skip this step.

Plug in numbers for one anchor. Suppose the three background scores are (0.3, 2.1, −0.5)(0.3,\ 2.1,\ -0.5) and the face score is 1.6. Taking the largest background score, 2.1, the face probability after the softmax is

pface=e1.6e1.6+e2.1=11+e0.5≈0.38p_{face}=\frac{e^{1.6}}{e^{1.6}+e^{2.1}}=\frac{1}{1+e^{0.5}}\approx0.38

The face score has to beat the largest of the three background scores to earn a high score.

During training the gradient flows only into the background channel that came out on top. A negative that looks like a fold in clothing pushes up only whichever background channel is currently highest; a leaf that looks like an eye might push up a different one. You can think of the three channels as each covering part of the face-like background, an effect similar to splitting the background into three subclasses, with faces having to be told apart from all three. It's the same idea as Goodfellow et al.'s Maxout, applied to the background class alone.

The ground-truth labels don't change; positives are still "face" and negatives still "background," which is also how the author answered in issue #74. Max-out is applied in both training and testing, and at inference it costs only 2 extra channels per conv3_3 anchor.

Training

The training data is the 12,880 images of the WIDER FACE training set, with three kinds of data augmentation:

  • Color distortion: random changes to brightness, contrast, saturation and so on.
  • Random cropping: five square candidates are cut from the original image, one being the largest square possible and the other four with sides 0.3 to 1 times the short side, and one is picked at random each time; a face box whose center falls inside the crop keeps the part that overlaps the crop.
  • Flipping: the cropped square is resized to 640×640640\times640, then flipped horizontally with probability 0.5.

Take a 1024×7681024\times768 image, whose short side is 768. Cropping at the smallest factor, 0.3, gives a 230-pixel square, and enlarging it to 640 makes the faces about 2.8 times bigger, so a face that was 10 pixels becomes 28 pixels. WIDER FACE's training set has lots of small faces, and the authors deliberately make more large faces by enlarging them. The official README also reminds you to keep the crops square, so resizing doesn't change the faces' aspect ratio.

The loss follows RPN's multi-task form:

L=λNcls∑iLcls(pi,pi∗)+1Nreg∑ipi∗Lreg(ti,ti∗)\begin{aligned} L={}&\frac{\lambda}{N_{cls}}\sum_i L_{cls}(p_i,p_i^*)\\ &+\frac{1}{N_{reg}}\sum_i p_i^*L_{reg}(t_i,t_i^*) \end{aligned}

pip_i is the predicted probability that anchor ii is a face, and pi∗p_i^* is the label, 1 for positives and 0 for background. LclsL_{cls} is a two-class softmax loss; tit_i and ti∗t_i^* are the predicted and ground-truth offsets of the 4 box coordinates, LregL_{reg} is smooth L1, and multiplying by pi∗p_i^* means only positives count toward regression. The classification term is divided by the total number of positive and negative anchors, the regression term by the number of positive anchors, and λ=4\lambda=4.

After matching, the vast majority of anchors are background, and they can't all go into the classification loss. The authors sort the negatives by loss and take only the hardest, keeping the ratio of negatives to positives at no more than 3:1; this is hard negative mining.

The backbone loads VGG16 pretrained on ImageNet, and the new layers use xavier initialization. SGD, momentum 0.9, weight decay 0.0005, batch 32; the learning rate is 10−310^{-3} for 80k iterations, then 10−410^{-4} and 10−510^{-5} for 20k each, 120k iterations in all, or roughly 300 epochs.

At inference, boxes scoring below 0.05 are discarded first, the top 400 go through NMS (IoU 0.3), and the top 200 are kept in the end.

Discussion

Ablation: The Framework Does the Heavy Lifting

MethodEasyMediumHard
RPN-face91.088.273.7
SSD-face92.189.571.6
F92.691.682.3
F + S93.592.084.5
F + S + M93.792.485.2

Compiled from Table 3 of the paper, WIDER FACE validation AP (%). F is the scale-equitable framework, S is scale compensation anchor matching, and M is the max-out background label.

Apart from architecture, the two baselines use the same settings as S3FD.

  1. The framework contributes the most. Changing only the architecture and anchors, Hard jumps from RPN-face's 73.7 to 82.3, up 8.6; against SSD-face it's up 10.7. Easy gains only 0.5 to 1.6. SSD-face uses multi-layer features, yet its Hard is 2.1 below the single-layer RPN-face, which the paper doesn't explain.
  2. The matching strategy adds 0.9, 0.4 and 2.2, the most on Hard. This row includes both the 0.35 threshold and stage two, and the calculation above shows that the two take care of faces of different sizes.
  3. Max-out adds 0.2, 0.4 and 0.7. The authors think that the harder the image and the more cluttered the background, the more useful max-out becomes. Each cell of the table is a single number, so whether a gap of 0.2 can be told apart from random variation in training is something this table can't answer.

Removing One Layer at a Time

The supplementary material runs another set of ablations, removing one detection layer at a time:

RemovedEasyMediumHard
conv3_3+0.3+0.5−24.7
conv4_3−0.6−20.6−8.7
conv5_3−25.8−12.2−4.1
conv_fc7−10.2−5.0−1.8
conv6_2−3.2−1.5−0.6
conv7_2−1.4−0.7−0.2

Compiled from Table 4 of the paper's supplementary material, as the change in WIDER FACE validation AP (percentage points).

Remove conv3_3 and Hard loses 24.7; that layer exists for small faces. Interestingly, Easy and Medium in the same row each go up a little, which the authors read as the large number of smallest anchors interfering slightly with medium and large faces too. Easy depends most on conv5_3 (64-pixel anchors) and Medium most on conv4_3 (32 pixels), so the three groups' difficulty really does line up with face size, layer by layer.

Four Benchmarks

On AFW (205 images, 473 faces) and PASCAL Face (851 images, 1,335 faces), S3FD's AP is 99.85 and 98.49, while the strongest rival in the plots, STN, has 98.35 and 94.10.

FDDB has 2,845 images and 5,171 faces, labeled with ellipses. It has two kinds of score. Discrete counts a face as found as soon as the overlap between a detection box and the ellipse is above 0.5; continuous adds up the overlap of each hit itself as the score, so the better the box fits, the higher the score. Results are plotted as ROC curves, with the number of false positives on the horizontal axis and the true positive rate on the vertical axis. S3FD's discrete score is 0.983 and its continuous score 0.856; the best of its rivals, DeepIR, has 0.971 and 0.847.

These FDDB numbers involve two adjustments. First, S3FD outputs rectangles, so the authors trained a separate regressor to turn rectangles into ellipses, since the difference in shape weighs heavily on the continuous score. Second, FDDB has quite a few unlabeled faces, and a detector that finds them gets charged with false positives, so the authors labeled 238 such faces by hand, all with width and height above 20 pixels. The new annotation file in the official repo has 5,409 faces in all, exactly 5,171 plus 238. The README also states that the paper's FDDB results require this new annotation file. Whether the other methods' curves in the plot were recomputed on the new annotations too, the paper doesn't say.

On WIDER FACE, validation is 93.7, 92.4 and 85.2, and test is 92.8, 91.3 and 84.0. The strongest rival in the comparison plots is CMS-RCNN, at 62.4 on validation Hard, so S3FD leads by 22.8 percentage points. Finding Tiny Faces (HR on the leaderboard), which was on arXiv eight months earlier, isn't in the plot (the legend just didn't have room). HR's own paper reports 82.3 on validation Hard, and the comparison plot in the PyramidBox paper uses the 80.6 from the evaluation tool; by these two numbers, the lead shrinks to 2.9 to 4.6 percentage points.

At the very end of the supplementary material comes another set of "latest results," 94.2, 93.0 and 85.9 on validation and 93.7, 92.5 and 85.8 on test, from two "upgraded detectors" called SFD-F and SFD-C, with no word on what was upgraded (trust us, it's upgraded). These numbers switch to WIDER FACE's new evaluation code and annotations; the official model retested with the new tools gets 93.8, 92.5 and 84.8 (issue #8).

The Multi-Scale Testing the Paper Leaves Out

The paper describes only one way of running inference, in its section on inference time, with a single VGA image at a single scale. WIDER FACE's results weren't measured that way, though. Open the official wider_test.py, and each image is run several times:

  1. once on the original image, with images too large shrunk until they fit on the GPU;
  2. once more on the original image flipped horizontally;
  3. once shrunk to 0.5×, keeping only boxes larger than 30 pixels;
  4. once enlarged to 2×, doubling further up to the GPU's limit if needed, keeping only boxes smaller than 100 pixels;
  5. then all the results are merged by box voting, where overlapping boxes average their coordinates weighted by score, keeping at most 750 boxes.

For a 1024×7681024\times768 image, the code works out an upscaling limit of about 2.18×, so it runs five times, at 1, 1 (flipped), 0.5, 2 and 2.18×. Summed by pixel count, that's about 11 times the computation of the original image alone (this note's estimate).

The number of boxes kept matters too. In issue #57, a user who kept 200 boxes as the paper does could never get Hard past 0.7, and reached 0.8 or more only after switching to the code's 750. The author replied that many WIDER FACE images have over 500 faces, so 200 boxes aren't enough and you should keep as many as you can at test time; real applications don't have that many faces, so fewer will do.

How 36 FPS Was Measured

The paper says S3FD runs at 36 FPS on VGA images on a Titan X (Pascal), about 28 milliseconds per image, roughly eighty percent of it spent in VGG16.

Numbers from the community vary widely. In 2019 a user ran VGA images through the official Python script on a Titan Xp at about 300 milliseconds per image, and the author replied that speed was measured with Caffe's caffe time (issue #66), which times the network's forward pass, without pre- or post-processing. yxlijun's PyTorch reproduction also drew a report of 0.75 seconds per 640×480 image (issue #21), and in November 2021 someone measured 0.5 seconds per frame on an RTX 3080, commenting "The original paper claimed this method is real-time," and got no reply (issue #32).

The two sides are really measuring different things. yxlijun's demo.py first resizes the image to an area of about 1700×12001700\times1200, so a 640×480 image gets enlarged to about 1651×12381651\times1238, 6.6 times the pixels of VGA, and the timed span also includes an NMS written in Python. Another common port (clcarwin) decodes every position one at a time in a Python loop in test.py, 25,600 iterations for a VGA image. face-alignment's version first uses np.where to pick out the positions scoring above 0.05 before decoding, and its timings on an Apple M2, 138.8 milliseconds (CPU) and 33.1 milliseconds (MPS), are closer to what you'd see in actual use.

Official Code and Reproduction

S3FD's paper says the code will be released. In November 2017 the authors put test code and trained Caffe models in the official repo, and the README's Train section is just four lines, telling you to build the database following SSD's instructions, modify SSD's data augmentation yourself to keep aspect ratios unchanged, modify SSD's matching code yourself to implement scale compensation, and start training.

The training code never came out with it. In June 2018 someone asked for it in issue #35, and the author replied, "my boss do not allow me to release the training code, since he has his own company." Asked again in issue #53 in October, the answer was the same (open-sourcing lost to opening a company).

So the issue tracker became the supplementary manual. There the author spelled out, one thread at a time, N=6N=6, the number of matches at the 0.35 threshold, the filtering of ground-truth boxes under 6 pixels, and keeping more boxes at test time. Another detail is in issue #9. In the official prototxt, fc6's padding is 3, so conv_fc7 is 24×24 rather than the 20×20 the paper gives; the author said the extra anchors all fall outside the image and never get matched, and that retraining with a padding of 1 gives almost the same results.

Without training code, reproduction stalls on Hard. In issue #57, at least two users implemented it from the paper, added multi-scale testing, and matched Easy and Medium, but got only 76 to 78 on Hard; the author said the lab gets about 83 even with single-scale testing, and asked them to check again. In August 2019 the author recommended yxlijun's PyTorch version in the same thread, saying its reproduced results were basically consistent. That version's README gives 85.4 on WIDER FACE Hard, against the paper's 85.2.

Open up its code, and half the time the data augmentation is PyramidBox's data-anchor-sampling; the repo's author, yxlijun, also said in issue #2 that this is how it caught up (borrowed the neighbors' augmentation). The second stage of matching differs from the paper as well, picking the top few among all anchors in the whole image with an IoU between 0.1 and 0.35, rather than topping up each face to 6.

What Came After

Seven months later, Baidu's PyramidBox took S3FD's backbone and anchors as its baseline outright, added a context module and a low-level feature pyramid on top, extended max-out into max-in-out, which takes the maximum on both the positive and negative sides, and even thanked Shifeng Zhang for discussions in its acknowledgments.

The problem of a fixed IoU threshold didn't stop at 0.35 either. Two years later ATSS set the threshold from each object's own statistics, using the mean plus the standard deviation of the candidate anchors' IoUs as the dividing line, so it no longer had to be tuned by hand for each dataset.

Conclusion

The paper's last sentence says the next step is to split the background explicitly into several subclasses. By face-alignment v1.5.0 in April 2026, conv3_3's background in the default SFD weights is still three channels with the maximum taken.

Those three channels are worth just 0.7 percentage points in the ablation. Most of S3FD's gain on Hard comes from the way the anchors are tiled. Starting from conv3_3 at stride 4, with anchors fixed at 4 times the stride, it's already 10.7 above the SSD-style baseline; lowering the matching threshold to 0.35 and then topping tiny faces up to 6 anchors adds another 2.2. Validation Hard ends up at 85.2.

When you call it through face-alignment or Wav2Lip, what runs is a single inference at one scale on the image at its original resolution, while the paper's WIDER FACE results merge several inferences on the original, flipped, shrunk and enlarged image. If the faces in the frame are only a dozen or so pixels, you'll have to upscale the image yourself before passing it in; if you're only finding the face in a selfie, BlazeFace in the same package takes 10.9 milliseconds on an Apple M2 CPU, against 138.8 for SFD.