wikillm

Paper · 2019-09-02 · cs.CV

Self-Training and Adversarial Background Regularization for Unsupervised Domain Adaptive One-Stage Object Detection

Adapts the one-stage SSD300 detector from labelled Pascal VOC to unlabelled target domains. Weak self-training keeps reliable pseudo-labels and drops hard negatives from the loss; background score regularization pushes target background scores toward 0.5 through a gradient reversal layer. On VOC to Clipart1k it reaches 35.7 mAP vs 26.7 for the base (author-reported).

Domain adaptationSelf-trainingObject detectionHard negative miningdomain-adaptationobject-detectionself-training

arXivPDFMarkdown9 min read

AI-compiled by claude-haiku-5-5 on 2026-11-08, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Object detectors learn well from labelled photos, but they often fail on pictures from a different style, such as clip-art, watercolours or comics. Labelling new images is slow and expensive. This paper tries to adapt a fast detector to such a new style without any labels for the new images.

The detector guesses boxes on the new images and keeps only the guesses that agree with their neighbouring boxes. Guesses that are likely to be wrong, and background regions that might hide an object, are left out of the learning signal. A second trick nudges the detector to be unsure about background regions of the new images, which pushes it to learn features that separate objects from background there. Both tricks together give the best results reported.

TL;DR

For a one-stage detector (SSD300) trained on labelled Pascal VOC and adapted to unlabelled target sets, two components are proposed: weak self-training (WST), which trains on pseudo-labels with the less reliable parts of the loss removed, and adversarial background score regularization (BSR), which applies a gradient-reversal term to target background scores. Author-reported gains are largest on Clipart1k (26.7 to 35.7 mAP). Naive self-training hurts there. Code is not published.

Problem

Domain shift lowers detector accuracy when the test images differ from the training images. Collecting labels for each new domain is expensive and time-consuming §1. Self-training, which trains on the model's own predictions, helps classification and segmentation, but naive use of detector pseudo-labels degrades performance §1 tab. 1. The authors state that global feature alignment, as used for two-stage detectors, aligns backgrounds that do not transfer, and that the prior two-stage method is hard to apply to one-stage detectors §2.3 §1. The setting is unsupervised: no target labels §3.1, and the method needs no image-level labels on the target §1. Target sets are Clipart1k (graphical images), Watercolor2k and Comic2k §4.1.

Method

Baseline: SSD300. Layers before conv5 form the feature extractor F; the remaining layers form the classifier C §3.1. The raw output has n detections (n = 8,732 for SSD300); O* is the subset left after non-maximum suppression (NMS) §3.1.

  1. Pseudo-label generation (SRRS). For each final detection r* in O*, collect every detection in O whose IoU with r* is at least δ. Score r* with the supporting region-based reliable score, the mean over those N_s detections of IoU times the probability of class c* (the predicted class of r*), and keep r* as a pseudo-label if the score is at least ε §3.2 eq. 3 alg. 1. The pseudo-labels are regenerated at every iteration §4.3.

    SRRS(r^*) = \frac{1}{N_s} \sum_{i=1}^{N_s} IoU(r_i, r^*)\cdot P(c^*\mid r_i) eq. 3

  2. Weak negative selection. Standard hard negative mining picks the negatives with the highest loss. The authors argue these are often unlabelled foreground objects, so they keep only the ||Neg||/3 negatives with the lowest loss; call the result Neg~ §3.2. Bounding-box regression is not trained on pseudo-labels §3.2.

  3. WST loss. The classification loss uses the positive pseudo-labels and the reduced negative set, with no localisation term §3.2 eq. 2.

    L_{ST}(x^t, \hat c) = -\sum_{i \in Pos} \log p_i(\hat c_i \mid x^t) - \sum_{i \in \widetilde{Neg}} \log p_i(0 \mid x^t) eq. 2

    For reference, the SSD loss the authors start from is eq. 1. Its localisation term L_loc is defined in SSD and is not restated in this paper §3.2.

    L_{task}(x^t, \hat b, \hat c) = -\sum_{i \in Pos} \log p_i(\hat c_i \mid x^t) - \sum_{i \in Neg} \log p_i(0 \mid x^t) + L_{loc}(x^t, \hat b) eq. 1

  4. BSR loss. On target inputs, a binary cross-entropy pulls each background score p_i(0 | x^t) toward a target value t, here 0.5 §3.3 eq. 4.

    L_{adv}(x^t) = -t \sum_i \log p_i(0 \mid x^t) - (1-t) \sum_i \log\bigl(1 - p_i(0 \mid x^t)\bigr) eq. 4

  5. Batch-wise selection and focal weight. Across the whole batch, sort the target detections by background score in ascending order and keep the lowest 3N, where N is the number of detections predicted as foreground. Each term is weighted by |t − p|^γ, a focal factor §3.3 eq. 7.

    L_{adv}(x^t) = -t \sum_i |t - p_i(0 \mid x^t)|^{\gamma} \log p_i(0 \mid x^t) - (1-t) \sum_i |t - p_i(0 \mid x^t)|^{\gamma} \log\bigl(1 - p_i(0 \mid x^t)\bigr) eq. 7

  6. Adversarial training. Source inputs train F and C with the supervised loss. Target inputs train C to minimise the BSR term and F to maximise it, via a gradient reversal layer (GRL) after relu4_3 of SSD300 §3.3 fig. 4. The two objectives are eq. 5 and eq. 6:

    \min_{F}\; L_{task}(x^s, y^s) - L_{adv}(x^t) eq. 5

    \min_{C}\; L_{task}(x^s, y^s) + L_{adv}(x^t) eq. 6

  7. Combination. BSR is trained first. WST starts at 50k iterations and the run stops at 55k §4.2.

Pseudocode
# Pseudo-label generation  [alg. 1] [eq. 3]
# all_dets: O, the n raw detections; kept_dets: O*, the survivors of NMS
def generate_pseudo_labels(all_dets, kept_dets, eps, delta):
    pseudo_labels = []
    for final in kept_dets:
        # Supporting regions: raw detections overlapping the final box  [§3.2]
        support = [d for d in all_dets
                   if iou(d.box, final.box) >= delta]
        # Mean over supports of IoU x class probability  [eq. 3]
        score = mean(iou(d.box, final.box) * d.prob[final.cls]
                     for d in support)
        if score >= eps:
            pseudo_labels.append(final)
    return pseudo_labels
Pseudocode
# Weak self-training loss for one target batch  [§3.2] [eq. 2]
# cls_probs: (n, K+1) softmax outputs; class 0 is background
def wst_loss(cls_probs, pos_idx, pos_cls, neg_idx, neg_loss):
    # Keep the third of hard negatives with the lowest loss  [§3.2]
    # Rounding of ||Neg||/3 is not stated; floor is used here
    num_keep = len(neg_idx) // 3
    easy_neg = sort_by_loss(neg_idx, neg_loss)[:num_keep]
    loss = -sum(log(cls_probs[pos_idx, pos_cls]))
    # No localisation term  [§3.2]
    loss += -sum(log(cls_probs[easy_neg, 0]))
    return loss
Pseudocode
# BSR loss with focal weight  [§3.3] [eq. 7]
# bg_prob: (m,) background scores of target detections in the batch
def bsr_loss(bg_prob, is_fg_pred, t, gamma):
    # Lowest 3N background scores across the batch  [§3.3]
    # "Predicted as foreground" threshold is not stated
    num_fg = count(is_fg_pred)
    chosen = argsort(bg_prob)[: 3 * num_fg]
    p = bg_prob[chosen]
    weight = abs(t - p) ** gamma
    loss = -t * sum(weight * log(p))
    loss += -(1 - t) * sum(weight * log(1 - p))
    return loss
Pseudocode
# One training step with BSR  [§3.3] [eq. 5] [eq. 6]
def training_step(source_batch, target_batch):
    # Supervised loss on labelled source images  [eq. 1]
    task = detection_loss(source_batch)
    # The GRL after relu4_3 reverses the gradient of adv for F  [§3.3]
    adv = bsr_loss(target_batch.bg_prob, target_batch.is_fg_pred,
                   t=0.5, gamma=2.0)
    return task + adv

Hyperparameters

NameValueWhereNotes
Base detectorSSD300§4.2input 300 x 300; SSD augmentations; SGD
Base optimiserlr 1e-3, momentum 0.9, weight decay 5e-4§4.2source only: VOC07+12 trainval
Base schedule120k iterations; lr x0.1 at 80k and 100k§4.2final lr 1e-5; batch size not stated
Base result77.43% mAP§4.2VOC2007 test
BSR batch32 images: 16 source, 16 target§4.2
BSR schedule50k iterations at lr 1e-3, then 10k at lr 1e-4§4.2
BSR target value t0.5§3.3 §4.2
BSR focal exponent γ2.0 (Clipart1k, Watercolor2k); 3.0 (Comic2k)§4.2 §4.3γ appears only in eq. 7
BSR selectionlowest 3N background scores per batch§3.3N = count of detections predicted as foreground
GRL positionafter relu4_3 of SSD300§3.3 fig. 4GRL coefficient not stated
WST initialisationfine-tune from the base model§4.2
WST schedule10 epochs, batch 32, lr 1e-5§4.2epoch size not stated
WST lr on Watercolor2k1e-6 for self-training methods§4.3does not say whether BSR+WST also uses 1e-6
SRRS threshold ε0.8 with SRRS; 0.9 without SRRS (ablation)§4.2 §5.1
SRRS IoU threshold δ0.5§4.2
WST start / stopstart at 50k iterations; early stop at 55k§4.2how the stop point was chosen is not stated
ε schedule (BSR+WST)ε = 1/(1 + e^(−3p)), p = iteration / max iteration§4.2max iteration not stated
Hard negative rationot stated in this paper§3.2base SSD mining is referred to, not restated
Evaluationconfidence 0.05, IoU 0.5§4.1
Source dataVOC2007 + VOC2012 trainval; 16,551 images, 20 classes§4.1
Target dataClipart1k (1k images); Watercolor2k and Comic2k (1k train, 1k test)§4.1

Results

Author-reported. Setup: SSD300 base, source = Pascal VOC07+12 trainval, metric = mAP at IoU 0.5 §4.1 tab. 1 tab. 2 tab. 3. Single run per cell; variance across seeds is not reported.

MethodBSRWSTClipart1kWatercolor2kComic2kSource
Base (SSD300)--26.747.121.9tab. 1 tab. 2 tab. 3
Naive self-training (ST)--10.748.814.2tab. 1 tab. 2 tab. 3
DANN (authors' SSD version)--31.841.522.5tab. 1 tab. 2 tab. 3
Ours✓-34.048.625.5tab. 1 tab. 2 tab. 3
Ours-✓33.849.225.4tab. 1 tab. 2 tab. 3
Ours✓✓35.749.926.8tab. 1 tab. 2 tab. 3

Ablation of WST on Clipart1k (BSR off) tab. 4:

VariantSRRSMaskWeak maskmAP
ST (A)---10.7
SRRS (B)✓--10.5
Mask (C)-✓-16.8
SRRS + Mask (D)✓✓-29.2
Weak mask (E)--✓31.3
SRRS + Weak mask (F) = WST✓-✓33.8

BSR sensitivity on Clipart1k tab. 5: with t = 0.5, γ = 0 and γ = 1 give "not converge"; γ = 2 gives 34.0; γ = 4 gives 32.9; γ = 5 gives 31.1. With γ = 2, t = 0.25 gives 28.5; t = 0.33 gives 19.8; t = 0.5 gives 34.0; t = 0.67 gives 21.2; t = 0.75 gives 20.8.

Figures are described in words only: fig. 1 shows the setting; fig. 2 plots mAP over epochs for naive self-training against WST; fig. 3 shows the WST pipeline; fig. 4 shows the network and the GRL; fig. 5 plots the ablation trends; fig. 6 visualises BSR for several γ; fig. 7 shows qualitative detections.

Paper vs code

No official code. Searched: the arXiv abstract page (no code link; comments field reads "ICCV 2019 (oral)"); the paper's LaTeX source (no URL); GitHub repository search for "weak self-training background score regularization", "background score regularization" and "domain adaptation detection SSD clipart watercolor" (zero results); user search for the first author (zero results).

Pitfalls

  • Clipart1k evaluation is not held out. All Clipart1k images are used for training and for evaluation §4.1. The Clipart1k numbers are therefore transductive. Watercolor2k and Comic2k use the standard train/test split §4.1.
  • The text overstates one gap. §4.3 says BSR is "8%" above the base on Clipart1k. Table 1 gives 34.0 − 26.7 = 7.3 tab. 1. The "2.2%" gap over DANN matches the table.
  • γ is named in the wrong equation. §4.2 says γ = 2.0 "in Eq. (4)". Eq. 4 has no γ; γ appears only in eq. 7 eq. 4 eq. 7.
  • Pseudo-label source is not stated. The paper does not say whether pseudo-labels come from the same forward pass as the training loss or from a separate pass. The cost per iteration depends on this §4.3.
  • SRRS details the paper leaves open. The class c* is "a predicted class of r*" §3.2. The argmax is assumed but not stated. The box of a pseudo-label is assumed to be r*'s box. Whether r* is in its own supporting set is inferred from the text: O* is the NMS survivors of O, so IoU(r*, r*) = 1 is included.
  • The ε schedule has no stated maximum. ε = 1/(1 + e^(−3p)) needs a maximum iteration, which is not given. The formula gives ε = 0.5 at p = 0, about 0.82 at p = 0.5 and about 0.95 at p = 1. It is not stated whether this schedule replaces the fixed ε = 0.8 §4.2.
  • The stop point is not justified. WST is stopped at 55k iterations on Clipart1k because "self-training is not helpful when it is overused" §4.2. How that point was chosen is not stated. With no held-out Clipart1k split, this choice may use test data.
  • "Predicted as foreground" is undefined. N in the 3N selection depends on a foreground threshold that the paper does not state §3.3. The selection is batch-wise §3.3.
  • GRL and loss weighting are unstated. The GRL coefficient is not given. The paper writes L_task and L_adv with unit weights, which is implicit.
  • Hard negative ratio is not restated. Weak mining keeps ||Neg||/3, but the base hard-negative ratio is taken from SSD and not restated here §3.2. The rounding of ||Neg||/3 is not stated.
  • Learning rate for Watercolor2k. The 1e-6 learning rate applies to "self-training methods" §4.3. It is not stated whether BSR+WST uses it too.
  • Naive ST is the authors' own baseline. It uses pseudo-labels without a localisation loss §4.3. It is not the progressive pseudo-labelling of the Cross-Domain work, which the authors say generates labels once before training §4.3.
  • DANN is the authors' reimplementation. It uses the BSR configuration on SSD and aligns relu4_3 features §4.2. There is no official implementation to check against.
  • Single runs. No seeds or variance are reported. Several per-class gaps are a few AP points, and the sheep row shows WST alone at 1.0 AP tab. 1.
  • Compute and memory. The paper does not state training time, memory or the cost of the per-iteration pseudo-labelling.
  • Focal term is required. With γ = 0 or γ = 1, BSR "does not converge" at t = 0.5 tab. 5. The authors say γ = 0 and γ = 1 over-regularise backgrounds §5.2 fig. 6.

Lineage

  • Builds on: SSD as the base detector §3.1; the gradient reversal layer of the domain-adversarial training work §2.2; background-score regularization motivated by open-set domain adaptation by backpropagation §3.3.
  • Compared against: DANN tab. 1; Cross-Domain weakly-supervised detection (pseudo-labels from image-level labels) §2.3 §4.3; naive self-training (ST, authors' own).
  • Superseded by: not stated.

Source and license

Adapted from “Self-Training and Adversarial Background Regularization for Unsupervised Domain Adaptive One-Stage Object Detection” by Seunghyeon Kim, Jaehoon Choi, Taekyung Kim, Changick Kim (arXiv:1909.00597), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.