AI Wiki中文/EN

SSD: default boxes, matching and hard negatives

SSD 检测器

Generate multi-scale defaults, inspect matching conflicts and negative budgets, then derive the loss and train a small convolutional head.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Put several possible boxes at every location

A street image contains a nearby bus and a small person in the distance. A detector needs both a large field of view and enough spatial detail to locate the person. SSD, short for Single Shot MultiBox Detector, attaches detection predictors to several feature maps of different resolutions. Each location starts with a small collection of default boxes having different sizes and aspect ratios. The network predicts how to adjust each box and which class it contains. SSD method overview

Unlike an external proposal pipeline, the candidate geometry is specified before seeing the image. Unlike original YOLO, SSD does not share one class vector across all boxes in a cell. Every default box has its own class scores. Several default boxes can be trained on the same object; later NMS handles redundant detections.

The first SSD preprint was submitted on 8 December 2015. This chapter reads the revised arXiv v5 dated 29 December 2016 and a fixed version of the authors’ Caffe implementation. Those dates identify different artifacts; a later revision is not the first disclosure. The numerical example below is original and does not reproduce a trained SSD benchmark. Version history

Default boxes, target assignment and a normalized loss

Count boxes before counting parameters

Suppose feature map s has height HsH_s, width WsW_s and AsA_s default boxes per location. Let C include the background class. Shared localization means each default box has four coordinate offsets, rather than a different box for every class. The number of boxes P and output scalars O are

P=∑sHsWsAs,O=P(C+4).P=\sum_s H_sW_sA_s,\qquad O=P(C+4).

These are output counts, not network parameter counts. The same convolutional filter is reused at every spatial location within a feature map. Different prediction layers can use different filters. A 3×3 predictor receiving F channels and producing A(C+4) outputs has 9FA(C+4) weights, plus biases, regardless of the feature map’s width. Paper §§2.1–2.2, prediction-head construction

The fixed Pascal configuration uses these six maps. The small numerical program will use fewer maps and channels; it also checks that this full configuration’s box counts add up correctly.

Feature-map sideBoxes per cellDefault boxesCenter step in 300-pixel input
3845,7768
1962,16616
10660032
5615064
3436100
144300

There are 8,732 default boxes. With 20 foreground categories and background, C=21, so the outputs contain 218,300 scalars. That does not imply 8,732 detected objects: most boxes should receive background or low foreground scores. Fixed configuration

A scale formula is not a complete model configuration

For normalized scale s and aspect ratio a, a box has width sas\sqrt a and height s/as/\sqrt a. Their product stays s2s^2: changing the ratio changes shape while preserving area. A base square is accompanied by another square of scale ssnext\sqrt{s s_{\mathrm{next}}}, then the selected ratios and their reciprocals. In our square-grid notation, with normalized center step Δ,

cx=(j+12)Δ,cy=(i+12)Δ,w=sa,h=sa.c_x=(j+\tfrac12)\Delta,\quad c_y=(i+\tfrac12)\Delta,\quad w=s\sqrt a,\quad h=\frac{s}{\sqrt a}.

The paper illustrates evenly spaced scales between 0.2 and 0.9. The fixed SSD300 configuration is more specific: minimum pixel sizes [30,60,111,162,213,264] and maximum sizes [60,111,162,213,264,315]. Its first map uses Δ=8/300, not 1/38. At column 37 its center is exactly 1 in normalized coordinates. Clipping is disabled, so some default boxes extend outside the image. Do not replace those details with a convenient uniform-grid formula and still claim to have reproduced the fixed configuration. Paper scale discussion, configuration, PriorBox generation

The default box also need not equal the feature unit’s receptive field. It is a reference geometry for supervision and decoding. The input pixels affecting that unit depend on the preceding network. Different feature resolutions provide different spatial sampling and visual context; changing default sizes alone cannot restore detail that a feature map has lost.

Match targets without confusing greedy and global assignment

The paper describes an initial best-overlap match for each ground-truth box, followed by additional default boxes above an IoU threshold. The fixed Caffe implementation gives an exact operational profile: it keeps overlaps greater than 1e-6, repeatedly selects the largest remaining overlap between an unused default and an unused target, then assigns other defaults to their best target when IoU is at least 0.5. This initial greedy procedure is not a globally optimized Hungarian assignment. Paper matching, MatchBBox

Consider two default boxes and two true boxes with the following IoUs. These values come from actual rectangles in a common coordinate system: defaults [0.5,0,2.5,1] and [0,0,1,1], targets [0,0,2,1] and [1,0,3,1]. They are arbitrary shared units, not normalized image coordinates.

Target 0Target 1
Default 00.60.6
Default 10.50

With the documented scan order, the first tie goes to default 0–target 0. The remaining pair has no overlap, so the distinct-pair stage stops. The subsequent threshold stage assigns default 1 to target 0 at IoU 0.5. Target 1 gets no positive default. Yet the alternative pairing default 0–target 1 and default 1–target 0 covers both targets. This counterexample limits the claim that every ground-truth object is guaranteed a match. It does not claim that this edge case is common in a dataset.

The teaching code follows this greedy-plus-threshold profile, including zero-overlap exclusion. It does not invent a forced zero-IoU match or silently overwrite an earlier assignment. Ties in hard-negative ranking are explicitly stable by prior order; that is our deterministic teaching choice, not a promise of bit-identical C++ sorting.

Encode offsets relative to a default box

Let d be the default center and size, g the matched true center and size, and v four fixed scale factors. The implementation’s historical name variance does not mean these values were estimated as statistical variances in this example. For the selected configuration, v=[0.1,0.1,0.2,0.2]. The target offsets are

tx=gx−dxdwvx,ty=gy−dydhvy,tw=log⁡(gw/dw)vw,th=log⁡(gh/dh)vh.\begin{aligned} t_x&=\frac{g_x-d_x}{d_wv_x},&t_y&=\frac{g_y-d_y}{d_hv_y},\\ t_w&=\frac{\log(g_w/d_w)}{v_w},&t_h&=\frac{\log(g_h/d_h)}{v_h}. \end{aligned}

Zero offsets recover the default. Decoding reverses the transformation: the x center is dx+vxlxdwd_x+v_x l_xd_w, and width is dwexp⁡(vwlw)d_w\exp(v_wl_w); y and height follow the same pattern. Widths and heights must be positive before taking logarithms. The paper shows unscaled relative offsets, while the fixed implementation exposes these additional scaling factors. Paper equation 2, CENTER_SIZE encoding, fixed factors

Train selected negatives, not every empty location

For an unmatched default, the background classification loss is −log⁡p0-\log p_0, where p is the softmax of its C logits. A default confidently predicting a foreground category has small p0p_0 and therefore a large background loss. The normal hard-negative profile sorts eligible unmatched defaults by this loss and selects at most three times the number of positive default matches, not three times the number of distinct objects. Eligibility also requires the configured negative-overlap condition. Hard-negative mining, eligibility and selection

Let P+P_+ and P−P_- be the selected positive and negative indices, N=∣P+∣N=|P_+|, yiy_i the class label (background zero for negatives), lil_i the predicted offsets and tit_i their targets. With α=1 in this example,

Lcls=−∑i∈P+∪P−log⁡pi,yi,Lloc=∑i∈P+∑k=14ρ(lik−tik),L=Lcls+αLlocN(N>0).\begin{aligned} L_{\mathrm{cls}}&=-\sum_{i\in P_+\cup P_-}\log p_{i,y_i},\\ L_{\mathrm{loc}}&=\sum_{i\in P_+}\sum_{k=1}^{4}\rho(l_{ik}-t_{ik}),\\ L&=\frac{L_{\mathrm{cls}}+\alpha L_{\mathrm{loc}}}{N}\quad(N>0). \end{aligned}

Smooth L1 makes small residuals quadratic and large ones linear:

ρ(e)={12e2,∣e∣<1,∣e∣−12,∣e∣≥1.\rho(e)=\begin{cases}\tfrac12 e^2,&|e|<1,\\|e|-\tfrac12,&|e|\ge1.\end{cases}

For a selected classification row and a positive localization coordinate, the gradients are

∂L∂zic=pic−1[c=yi]N,∂L∂lik=α clip⁡(lik−tik,−1,1)N.\begin{aligned} \frac{\partial L}{\partial z_{ic}}&=\frac{p_{ic}-\mathbf1[c=y_i]}{N},\\ \frac{\partial L}{\partial l_{ik}}&=\frac{\alpha\,\operatorname{clip}(l_{ik}-t_{ik},-1,1)}{N}. \end{aligned}

Unselected rows and negative-box coordinates have zero gradients. Matching and the selected-negative set are held fixed while checking a gradient; sorting itself is not differentiated. Under the paper’s N=0 convention and this 3:1 mining profile, no negatives are selected and the total loss is zero. Other detectors and other mining configurations need not behave that way. Paper equations 1–3, MultiBox loss forward

Train a small convolutional head on supplied feature maps

The original NumPy program connects default-box generation, matching, mining, scaled offsets, the normalized loss and a real 3×3 convolutional prediction head. It also differentiates the head’s kernels and biases. Input feature maps are supplied explicitly: no image backbone, data augmentation or complete dataset training is hidden inside the example.

For a hand check, use one positive and three selected negatives with three equal class logits per row. Classification contributes 4 ln 3. If the positive’s only nonzero offset residual is 0.5, localization adds 0.125. This tests the denominator: dividing by four selected rows instead of one positive would give a different objective.

The executable example uses 2×2 and 1×1 feature maps with four defaults per cell, giving 20 boxes. Seeded small weights produce nonuniform logits. A target equal to the first default yields three positive matches and nine selected negatives. One step updates the convolution parameters while keeping the selected training plan fixed.

"""Original NumPy SSD teaching head; fixed priors, explicit Caffe-style matching profile."""
import numpy as np


def boxes(value):
    a = np.asarray(value, float)
    if a.ndim != 2 or a.shape[1] != 4 or not np.isfinite(a).all() or (a[:,2:] <= a[:,:2]).any():
        raise ValueError('finite N-by-4 xyxy boxes with positive width/height required')
    return a


def default_grid(side, scale, next_scale, ratios=(2.,3.), step=None):
    """Square image; scales and center step are image-normalized; no clipping."""
    step = 1/side if step is None and type(side) is int and side > 0 else step
    if type(side) is not int or side < 1 or step is None:
        raise ValueError('positive integer grid side required')
    if not np.isfinite([scale,next_scale,step]).all() or not 0 < scale < next_scale or step <= 0:
        raise ValueError('finite positive step and increasing scales required')
    if any(not np.isfinite(r) or r <= 1 for r in ratios) or len(set(ratios)) != len(ratios):
        raise ValueError('supply distinct aspect ratios greater than one; reciprocals are added')
    shapes = [(scale,scale), (np.sqrt(scale*next_scale),)*2]
    for ratio in ratios:
        w,h = scale*np.sqrt(ratio), scale/np.sqrt(ratio)
        shapes.extend([(w,h),(h,w)])
    size = np.asarray(shapes)
    row,col = np.indices((side,side))
    centers = (np.stack([col,row],axis=-1)+.5)*step
    return np.concatenate([centers[...,None,:]-size/2,
                           centers[...,None,:]+size/2],axis=-1).reshape(-1,4)


def iou_matrix(first, second):
    a,b = boxes(first),boxes(second)
    area_a = np.prod(a[:,2:]-a[:,:2],axis=1)
    area_b = np.prod(b[:,2:]-b[:,:2],axis=1)
    inter = np.maximum(0,np.minimum(a[:,None,2:],b[None,:,2:])-np.maximum(a[:,None,:2],b[None,:,:2])).prod(axis=-1)
    return inter/(area_a[:,None]+area_b[None,:]-inter)


def match(priors, truth, threshold=.5):
    """Greedy distinct pairs, then per-prior threshold matching; zero-overlap pairs excluded."""
    overlap = iou_matrix(priors,truth)
    count, targets = overlap.shape
    if not np.isfinite(threshold) or not 0 <= threshold <= 1:
        raise ValueError('overlap threshold must lie in [0,1]')
    assigned = np.full(count,-1,dtype=int)
    if count == 0 or targets == 0:
        return assigned,np.zeros(count)
    remaining = np.where(overlap > 1e-6,overlap,-1.)
    for _ in range(min(count,targets)):
        i,j = np.unravel_index(np.argmax(remaining),remaining.shape)
        if remaining[i,j] < 0:
            break
        assigned[i] = j
        remaining[i,:] = -1
        remaining[:,j] = -1
    best = np.argmax(overlap,axis=1)
    quality = overlap[np.arange(count),best]
    eligible = (assigned < 0) & (quality >= threshold) & (quality > 1e-6)
    assigned[eligible] = best[eligible]
    return assigned,quality


def variance_vector(value):
    v = np.asarray(value,float)
    if v.shape != (4,) or not np.isfinite(v).all() or (v <= 0).any():
        raise ValueError('four positive finite offset scale factors required')
    return v


def encode(priors, truth, variance=(.1,.1,.2,.2)):
    d,g,v = boxes(priors),boxes(truth),variance_vector(variance)
    if d.shape != g.shape:
        raise ValueError('one target per supplied prior required')
    ds,gs = d[:,2:]-d[:,:2],g[:,2:]-g[:,:2]
    dc,gc = (d[:,2:]+d[:,:2])/2,(g[:,2:]+g[:,:2])/2
    return np.c_[(gc-dc)/ds,np.log(gs/ds)]/v


def decode(priors, offsets, variance=(.1,.1,.2,.2)):
    d,l,v = boxes(priors),np.asarray(offsets,float),variance_vector(variance)
    if l.shape != d.shape or not np.isfinite(l).all():
        raise ValueError('finite four offsets per prior required')
    ds,dc = d[:,2:]-d[:,:2],(d[:,2:]+d[:,:2])/2
    with np.errstate(over='ignore',invalid='ignore'):
        center = dc+l[:,:2]*v[:2]*ds
        size = ds*np.exp(l[:,2:]*v[2:])
        result = np.c_[center-size/2,center+size/2]
    return boxes(result)


def log_probabilities(logits):
    z = np.asarray(logits,float)
    if z.ndim != 2 or z.shape[1] < 2 or not np.isfinite(z).all():
        raise ValueError('finite P-by-C logits, including background class zero, required')
    shifted = z-z.max(axis=1,keepdims=True)
    return shifted-np.log(np.exp(shifted).sum(axis=1,keepdims=True))


def prepare(priors, truth, target_classes, logits, neg_ratio=3):
    """Freeze matches and hard-negative selection; default thresholds .5, no ignored boxes."""
    d,g = boxes(priors),boxes(truth)
    classes = np.asarray(target_classes)
    lp = log_probabilities(logits)
    if lp.shape[0] != len(d) or classes.shape != (len(g),):
        raise ValueError('target/class or prior/logit count mismatch')
    if len(classes) and (classes.dtype.kind not in 'iu' or (classes < 1).any() or (classes >= lp.shape[1]).any()):
        raise ValueError('target classes must be foreground integer indices')
    if type(neg_ratio) is not int or neg_ratio < 0:
        raise ValueError('nonnegative integer negative-to-positive ratio required')
    assigned,quality = match(d,g)
    positive = np.flatnonzero(assigned >= 0)
    candidates = np.flatnonzero((assigned < 0) & (quality < .5))
    # Larger background cross-entropy first; stable ties retain prior order.
    order = np.argsort(lp[candidates,0],kind='stable')
    negative = candidates[order[:neg_ratio*len(positive)]]
    labels = np.zeros(len(d),dtype=int)
    labels[positive] = classes[assigned[positive]].astype(int)
    targets = np.zeros((len(d),4))
    targets[positive] = encode(d[positive],g[assigned[positive]])
    return {'positive':positive,'negative':negative,'labels':labels,'targets':targets}


def objective(offsets, logits, plan, alpha=1.):
    """Sum selected cross-entropy and positive Smooth L1, divided by positive count."""
    l = np.asarray(offsets,float)
    lp = log_probabilities(logits)
    if l.shape != (len(lp),4) or not np.isfinite(l).all() or not np.isfinite(alpha) or alpha < 0:
        raise ValueError('finite offsets and nonnegative localization weight required')
    pos,neg = plan['positive'],plan['negative']
    dl,dz = np.zeros_like(l),np.zeros_like(lp)
    n = len(pos)
    if n == 0:
        return 0.,{'classification':0.,'localization':0.},dl,dz
    selected = np.r_[pos,neg]
    labels = plan['labels'][selected]
    classification = -lp[selected,labels].sum()/n
    dz[selected] = np.exp(lp[selected])/n
    dz[selected,labels] -= 1/n
    error = l[pos]-plan['targets'][pos]
    magnitude = np.abs(error)
    a = np.minimum(magnitude,1.)
    localization = alpha*np.sum(.5*a*a+(magnitude-a))/n
    dl[pos] = alpha*np.clip(error,-1,1)/n
    parts = {'classification':float(classification),'localization':float(localization)}
    return float(classification+localization),parts,dl,dz


def conv3x3(feature, kernel, bias):
    """HWC input; 3x3xCxO kernels, stride one and zero padding."""
    x,w,b = np.asarray(feature,float),np.asarray(kernel,float),np.asarray(bias,float)
    if x.ndim != 3 or min(x.shape) < 1 or w.ndim != 4 or w.shape[:3] != (3,3,x.shape[2]) or b.shape != (w.shape[3],):
        raise ValueError('incompatible convolution shapes')
    if not all(np.isfinite(a).all() for a in [x,w,b]):
        raise ValueError('finite convolution inputs required')
    padded = np.pad(x,((1,1),(1,1),(0,0)))
    output = np.empty((*x.shape[:2],len(b)))
    for row,col in np.ndindex(x.shape[:2]):
        patch = padded[row:row+3,col:col+3]
        output[row,col] = np.einsum('ijc,ijco->o',patch,w)+b
    return output


def conv_parameter_gradient(feature, output_gradient):
    """Gradient for kernel and bias, holding the provided feature map fixed."""
    x,dy = np.asarray(feature,float),np.asarray(output_gradient,float)
    if x.ndim != 3 or dy.ndim != 3 or x.shape[:2] != dy.shape[:2]:
        raise ValueError('feature/output-gradient grids must match')
    padded = np.pad(x,((1,1),(1,1),(0,0)))
    dw = np.zeros((3,3,x.shape[2],dy.shape[2]))
    for row,col in np.ndindex(x.shape[:2]):
        patch = padded[row:row+3,col:col+3]
        dw += np.einsum('ijc,o->ijco',patch,dy[row,col])
    return dw,dy.sum(axis=(0,1))


if __name__ == '__main__':
    rng = np.random.default_rng(17)
    features = [np.arange(4.).reshape(2,2,1)/4,np.ones((1,1,1))*.5]
    priors = np.concatenate([default_grid(2,.2,.5,(2.,)),default_grid(1,.6,.9,(2.,))])
    anchors,classes = 4,3  # three classes include background
    kernels = [rng.normal(0,.02,(3,3,1,anchors*(4+classes))) for _ in features]
    biases = [np.zeros(anchors*(4+classes)) for _ in features]

    def forward():
        raw = [conv3x3(x,w,b).reshape(-1,4+classes) for x,w,b in zip(features,kernels,biases)]
        joined = np.concatenate(raw)
        return joined[:,:4],joined[:,4:]

    offsets,logits = forward()
    truth = priors[[0]].copy()
    plan = prepare(priors,truth,[1],logits)
    value,parts,dl,dz = objective(offsets,logits,plan)
    gradient = np.concatenate([dl,dz],axis=1)
    cursor = 0
    for i,x in enumerate(features):
        count = x.shape[0]*x.shape[1]*anchors
        dy = gradient[cursor:cursor+count].reshape(*x.shape[:2],-1)
        dw,db = conv_parameter_gradient(x,dy)
        kernels[i] -= .01*dw
        biases[i] -= .01*db
        cursor += count
    print('priors:',len(priors),'positive:',plan['positive'].tolist(),'negative:',plan['negative'].tolist())
    print('loss parts:',{k:round(v,6) for k,v in parts.items()})
    print('fixed-plan loss:',round(value,6),'->',round(objective(*forward(),plan)[0],6))
    print('first decoded box:',np.round(decode(priors,offsets)[0],6).tolist())

Actual output with Python 3.12 and NumPy 1.26.4:

priors: 20 positive: [0, 2, 3] negative: [15, 18, 1, 4, 14, 5, 9, 17, 11]
loss parts: {'classification': 4.404802, 'localization': 1.646181}
fixed-plan loss: 6.050983 -> 6.022782
first decoded box: [0.150183, 0.149552, 0.349627, 0.350073]

Each packed output has four offsets followed by C class logits. Combining the localization and classification output channels into one linear convolution is equivalent to separate convolutions with the corresponding weights, but this array layout is not a Caffe binary format. Flattening follows feature-map, row, column and default-box order. The test suite checks independent finite differences for every small loss output and the convolution’s kernel/bias gradients. Original head layout

For P defaults and G targets, the full IoU table costs O(PG) work and storage. Our literal repeated-scan greedy matcher costs O(PG min(P,G)) time; it is intentionally clear rather than optimized for large images. Negative sorting costs O(P log P), and loss evaluation O(PC). A 3×3 head with F input and Q output channels costs O(9HWFQ); its parameter-gradient computation has the same order. These costs exclude the CNN backbone and inference NMS.

Many positive boxes can still miss an object

Default shapes and feature resolutions determine which targets receive useful supervision. The matching counterexample shows why candidate coverage and matching policy must both be inspected. Tiny objects, crowded scenes and unusual aspect ratios can stress different parts of the system; changing the negative ratio cannot by itself restore missing spatial detail.

The paper also uses image patches and photometric changes during training. Its cropping procedure retains the visible part of a ground-truth box when the object’s center lies in the sampled patch, followed by resizing and possible horizontal flipping. Those transformations affect target geometry as well as pixels. They are part of the training method, but are not implemented by our supplied-feature experiment. Data augmentation

Hard-negative mining concentrates computation on difficult background predictions. It is not a replacement for clean labels or a reason to evaluate on training images. Because several boxes may score highly for one object, SSD still uses NMS at inference. Compare alternatives under the same input resolution, dataset split, IoU metric, hardware and timing boundaries; neither a box-count formula nor a successful gradient check establishes detection accuracy. Model inference, detection evaluation

The empty-target convention also deserves care in application code. Here it follows the chosen loss/mining profile and gives zero training signal for an image with no positive matches. Do not assume every framework’s SSD variant uses that exact choice, and do not transfer it to DETR.

Check counts, geometry and supervision

1. Count the complete output

The six map/default counts are 38²×4, 19²×6, 10²×6, 5²×6, 3²×4 and 1²×4. With 20 foreground classes, how many boxes and output scalars are there? Are these parameter counts?

Answer: The total is 8,732 boxes. Background makes C=21, so there are 8,732×25=218,300 output scalars. Parameters are shared across spatial locations by convolution, so these are not parameter counts.

2. Budget negatives from the correct quantity

One object has three matched defaults. There are 14 eligible unmatched defaults. With a 3:1 ratio, how many negatives are selected, and what normalizes the summed loss?

Answer: Select nine negatives and divide the combined classification/localization sum by N=3 positive defaults. Dividing by one object or twelve selected rows changes the intended objective.

3. Find the missed target

Use the 2×2 IoU table above. Why can target 1 be missed by the fixed greedy-plus-threshold policy even though a one-to-one assignment covering both targets exists?

Answer: The first tie assigns default 0 to target 0. Default 1 has zero overlap with the remaining target, ending the distinct-pair stage. It subsequently passes the 0.5 threshold for target 0, leaving target 1 uncovered. Swapping the first assignment would allow both targets to be covered; greedy local selection does not optimize that global condition.

4. Reverse a scaled offset

A default has center x=0.2 and width 0.2. The true center is 0.3 and width 0.4. With vxv_x=0.1 and vwv_w=0.2, what are the x and width targets, and how do they decode?

Answer: The targets are txt_x=5 and twt_w=ln 2/0.2, approximately 3.465736. Decoding gives 0.2+0.1×5×0.2=0.3 and 0.2exp⁡(0.2tw)=0.40.2\exp(0.2t_w)=0.4. Omitting the scale factors would interpret the same stored outputs as different boxes.

Read the matching rule and the configuration together

Read the paper for the design problem and explicit objective, then inspect the selected configuration and implementation for center steps, scaling factors, threshold equality, ignored boxes and empty examples. Those details determine the training labels and gradients; they are not incidental formatting choices.

The progression from original YOLO through SSD to set-prediction detectors is not simply “more boxes.” It changes how predictions represent classes, how targets obtain supervision, and how inference handles duplicates. The chapter’s rectangle counterexample and independent derivative checks provide concrete questions to bring to the next paper. They do not stand in for a full paper guide or a trained-model reproduction.

Make a prediction, then check

One image has one ground-truth object but three matched positive default boxes. With enough eligible negatives and a 3:1 ratio, how many negatives can be selected?

Choose one answer

Learning objectives

  • Generate multi-scale default boxes and derive class/offset output counts from a fixed configuration.
  • Distinguish greedy matching, threshold positives and hard-negative mining, including collision and empty-target cases.
  • Differentiate the normalized MultiBox loss and train a small convolutional detection head on supplied features.

Prerequisites & connections

Explore related knowledge →

References

  1. SSD: Single Shot MultiBox Detector — arXiv v5 method
    Wei Liu; Dragomir Anguelov; Dumitru Erhan; Christian Szegedy; Scott Reed; Cheng-Yang Fu; Alexander C. Berg · 2016
  2. Caffe SSD box utilities — fixed matching and coordinate encoding
    Wei Liu and Caffe contributors · 2021
  3. SSD Pascal configuration at a fixed author-repository commit
    Wei Liu and Caffe contributors · 2021
  4. Caffe SSD PriorBoxLayer — center steps and default-box order
    Wei Liu and Caffe contributors · 2021
  5. Caffe SSD CreateMultiBoxHead — prediction layers and layout
    Wei Liu and Caffe contributors · 2021
  6. Caffe SSD MultiBoxLossLayer — selected examples and normalization
    Wei Liu and Caffe contributors · 2021
  7. SSD arXiv version history — first preprint and later revisions
    arXiv; Wei Liu and coauthors · 2015

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-07 · Codex single-AI-author technical check: bounded SSD v5 method, fixed author-repository configuration/code, literal box geometry, independent loss/kernel finite differences and complete bilingual comparison. Not independent human review, full-backbone training or benchmark reproduction.

  • Checked 8732 priors and fixed center steps, literal and random box round trips, geometric greedy-matching counterexample, thresholds, zero-overlap exclusion, negative budgets/ranking, hand loss, all output finite differences, convolution parameter finite differences, empty targets, tiny Smooth L1 residual and a complete small-head weight step. Fourteen numerical checks plus one bilingual structural check.
  • Compared complete en/zh arguments, six displayed formulas, code, fixed configuration versus general paper scales, matched-prior normalizer, four answers and seven citation targets. Applied quality standards without relabeling source reading as complete training or independent review.
  • After visual review, typeset explicit inline variable names and short formulas in both formal articles. All displayed equations, code and numeric values are preserved; original frozen drafts remain unchanged.

Source locations checked:

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.