Back to paper library
arXiv 2022AAAI 2023Object detectionPaper notes

YOLOV

That Blurry Frame

Original paper

YOLOV: Making Still Image Object Detectors Great at Video Object Detection

Paper authors

Yuheng Shi · Naiyan Wang · Xiaojie Guo

Publication
AAAI 2023Conference
First submitted to arXiv
arXiv:2208.09686
Cite this paper · BibTeX

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

@misc{objectdetectionyolov2022,
  title = {{YOLOV: Making Still Image Object Detectors Great at Video Object Detection}},
  author = {Yuheng Shi and Naiyan Wang and Xiaojie Guo},
  year = {2022},
  eprint = {2208.09686},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.09686}
}
On this page

Feed a video to YOLO frame by frame, and most of the time the boxes come out fine.

The trouble is in a handful of frames. A fox runs too fast and the frame turns into a smear; a cat is half hidden behind a railing; the camera suddenly loses focus. Looking at that frame alone, even a person can't say what it is. Yet in the frames just before and after, the fox is perfectly clear, and borrowing information from those frames can rescue the blurry one.

That is what video object detection (VID) does. The problem is that around 2022, the field was built almost entirely on two-stage detectors, accurate but slow, at 100 to nearly 300 milliseconds per frame.

Yuheng Shi and Xiaojie Guo of Tianjin University and Naiyan Wang of TuSimple wanted the one-stage YOLO to borrow information from neighboring frames too, while keeping its speed. The V in the name stands for video.

Problem Definition

There are two main ways to borrow information from other frames:

  • Box level. Detect each frame as usual, link the boxes across frames into tubes (tubelets), and use the score of the whole tubelet to correct each frame's results. This is post-processing and works with any detector.
  • Feature level. During detection, aggregate the key frame's features with similar features from other frames (reference frames), so that blurry features get reinforced by clear ones.

Feature-level methods are mostly built on two-stage detectors like Faster R-CNN, for a practical reason. A two-stage detector has a region proposal network (RPN), and each proposal has its own patch of features, so you can simply run attention across frames on those features.

One-stage detectors have nothing like that. YOLO predicts directly at every position of the feature map, with no proposal layer. If every position of the whole feature map took part in cross-frame attention, a 576×576 input would already give over 6,000 positions per frame; multiply that by dozens of frames, and the computation is far beyond what you can afford.

So the authors ask whether the region-level aggregation of two-stage methods can be carried over to a one-stage detector while keeping its speed.

Solution

Predict First, Then Select

Diagram comparing the two pipelines. The top row is a two-stage video detector: reference frames plus the key frame go through an RPN that produces many proposals of uneven quality, RoI features are extracted and aggregated across frames, and the last step is classification and box regression; the note below says many low-quality proposals all get aggregated. The bottom row is YOLOV: reference frames plus the key frame first go through YOLOX, which predicts at over 6,000 positions per frame; the top 750 by confidence are kept, 30 remain after NMS, FAM aggregates them across frames, and the last step only reclassifies; the note below says low-confidence predictions are dropped first, then the rest are aggregated.
Drawn for this note from the pipeline in the Methodology section of the paper.

YOLOV's core idea is right there in the two rows above. It just swaps the order.

A two-stage detector first generates a large number of proposals, then aggregates and classifies every one of them. The computational bottleneck is that most of these proposals are poor, and aggregating them is wasted effort.

YOLOV also works in two steps, but the first runs a full prediction with YOLOX, and the many low-confidence positions are discarded right there; only in the second step are the few remaining predictions aggregated across frames. The authors stress in the paper that such a small difference in design leads to a huge difference in performance.

FSM: Pick the Ones Worth Talking To

The first module is the Feature Selection Module (FSM), which works much like an RPN picking proposals:

  1. Take the top 750 predictions by YOLOX's confidence score.
  2. Run NMS once to remove duplicates and keep a fixed 30.
  3. Collect the features at the positions of these 30 predictions.

With 30 kept per frame, 31 reference frames plus 1 key frame give only a little over 900 features to aggregate at once, which attention can handle.

The authors also ran into a training problem. If the collected features are aggregated and fed straight back into the original classification branch, training becomes unstable; the new aggregation module is randomly initialized, and fine-tuning everything together from the start damages YOLOX's pretrained weights. So they freeze the whole of YOLOX except the linear projection layers of the detection head, and add a new branch of two 3×3 convolutions to the neck just to produce the features for aggregation.

FAM: Who You Talk To Matters Too

The second module is the Feature Aggregation Module (FAM), which is essentially multi-head self-attention. Each prediction in the key frame acts as a query, reads the prediction features of all frames, and takes a weighted average of them.

Standard attention uses the QK⊤QK^\top similarity as weights. The authors point out a trap here. If a key-frame feature has degraded because of blur, the reference features most similar to it are likely the equally blurry ones from other frames. The authors call this the homogeneity issue. The "helpers" it finds can't see any better than it can, so aggregating them does no good.

The fix is to bring in YOLOX's original prediction scores as well. Each prediction has a classification score and an IoU score, which say how confident YOLOX is about it. These scores are arranged into a matrix SS the same size as the attention matrix, with every row identical, holding each reference feature's own score, and multiplied element-wise with the attention scores:

SAc(C)=softmax(Sc∘Ac) Vc\text{SA}_c(C) = \text{softmax}(S_c\circ A_c)\,V_c SAr(R)=softmax(Sr∘Ar) Vc\text{SA}_r(R) = \text{softmax}(S_r\circ A_r)\,V_c

AcA_c and ArA_r are the QK⊤/dQK^\top/\sqrt{d} computed from the features of the classification branch and the regression branch, respectively. With the scores multiplied in, a reference feature that closely resembles the query still has its weight pushed down if YOLOX isn't confident about it.

Both attention paths end up applied to the same VcV_c, because the purpose of this step is to correct the classification. The output is then concatenated with the original VcV_c to keep the original representation. The authors call this the affinity manner.

Average It Out, Don't Just Listen to a Few

There is a second problem. Softmax easily lets a few reference features take most of the weight, and the other references are effectively ignored.

The authors add an average pooling step. They compute similarity as the inner product of features after LayerNorm, pick out every reference feature whose similarity exceeds a threshold τ\tau, and average them directly. This averaged feature goes, together with the key frame's own feature, into a linear layer for the final classification.

FAM as a whole only reclassifies; box positions still come from YOLOX's original predictions.

Discussion

Experimental Setup

The dataset is ImageNet VID, with 30 categories, 3,862 training videos and 555 validation videos, plus still images of the same categories from ImageNet DET. Adjacent video frames are nearly identical, so training randomly samples only 1/10 of the frames. At test time, images are resized to 576×576, and all speeds are measured on a single 2080Ti in FP16. The metric is AP at IoU 0.5 (AP50).

How to Pick Reference Frames

Line chart with the number of reference frames (3, 7, 15, 23, 31, 39) on the horizontal axis and AP50 on the vertical axis. The blue line, global references sampled at random from the whole video, rises from 74.6 to 77.0 and holds at 77.3 from 23 frames on; the orange line, local references taken from consecutive frames near the key frame, climbs slowly from 70.4 to 73.6.
Drawn for this note from the numbers in Table 1 of the paper; YOLOV-S, ImageNet VID validation set.

The chart makes its point bluntly. Just 3 reference frames picked at random from the whole video give 74.6 AP50, higher than 39 consecutive frames taken around the key frame (73.6).

This runs a bit against intuition. Aren't adjacent frames the most relevant? That's exactly the problem; they're too relevant. Neighboring frames capture almost the same thing, so when the key frame is blurry, the frames next to it are probably blurry too; only random sampling from the whole video has a chance of landing on the frames where the object is clear. Earlier two-stage methods such as SELSA and TROIA made similar observations. The default is 31 global reference frames.

How Many to Keep per Frame

Raising the number of predictions kept per frame, aa, from 10 to 100 lifts AP50 from 76.1 to 77.4, saturating at around 75; inference time, meanwhile, grows from 10.4 ms to 29.3 ms, because the cost of self-attention is proportional to the square of the number of inputs. The authors take 30, at 77.3 AP50 and 11.3 ms, only 0.1 below the best. RDN, a comparable two-stage method, needs 75 proposals at its best setting.

Both Designs Contribute

ModelAffinityAvg. poolTime (ms)AP50
YOLOX-S9.3869.5
YOLOV-S✓10.9576.9
YOLOV-S✓✓11.3077.3

Compiled from Table 4 of the paper.

Adding affinity attention alone jumps from 69.5 to 76.9, and average pooling adds another 0.4. The whole FAM costs less than 2 ms extra.

The average-pooling threshold matters too. τ=0\tau = 0 averages all references and gives only 73.1 AP50; raised to between 0.75 and 0.85, it holds steady at 77.3. At τ=1\tau = 1, no reference passes the threshold, so average pooling effectively does nothing, and AP50 falls back to 76.9.

Works at Every Size

The same design attached to YOLOX models of different sizes:

BaseBase AP50YOLOV AP50Time (ms)
YOLOX-S69.577.39.4 → 11.3
YOLOX-L76.183.614.8 → 16.4
YOLOX-X77.885.020.4 → 22.7

Compiled from Table 5 of the paper.

All three sizes gain more than 7 points, with no more than 2.3 ms of extra time. Adding strong data augmentation such as MixUp and Mosaic during fine-tuning brings YOLOV-X to 85.5.

It works on other one-stage detectors too. PPYOLOE-S rises from 69.5 to 74.9, PPYOLOE-L from 76.9 to 82.0 and FCOS from 67.0 to 73.1, gains of five to six points each.

Against Two-Stage Methods

Scatter plot with inference time per frame (ms, log scale) on the horizontal axis and ImageNet VID AP50 on the vertical axis. Blue points are YOLOV: S at 11.3 ms and 77.3, R50 at 17.5 ms and 81.4, L at 16.3 ms and 83.6, X at 22.7 ms and 85.0, all within 25 ms. Gray points are two-stage methods: FGFA at 104.2 ms and 76.3, SELSA at 153.8 ms and 83.1, MEGA at 230.4 ms and 82.9, TROIA at 285.7 ms and 84.3.
Drawn for this note from the numbers in the upper half of Table 6 of the paper (no post-processing); only methods timed on a 2080Ti are plotted.

The blue points crowd to the left and the gray ones sit to the right. YOLOV-X's 85.0 beats TROIA's 84.3 while running more than ten times faster.

You might suspect the backbone deserves the credit, since YOLOX uses a modified CSP backbone while two-stage methods mostly use ResNet-101 or ResNeXt-101. The authors also ran it with a ResNet-50 backbone; YOLOV-R50 gets 81.4 at 17.5 ms, still far better than FGFA (R101, 76.3), which also uses a ResNet.

Add box-level post-processing such as REPP, and YOLOV-X reaches 87.2, or 87.5 for the version with strong data augmentation. The post-processing takes about 6 ms more on the CPU, for a total under 30 ms, still above 30 frames per second.

Limitations

The one the authors mention themselves is the average-pooling threshold τ\tau, currently fixed at 0.75, which should ideally be set dynamically for different cases.

Also, FAM only corrects classification and takes box positions entirely from YOLOX. If the blurry frame misses the object altogether, or the box is off, the aggregation that follows can't save it.

Conclusion

To bring video detection to a one-stage detector, YOLOV moves selection after prediction. YOLOX first filters out most of the low-confidence positions in each frame, leaving only 30 predictions for cross-frame aggregation, and attention is then weighted by YOLOX's own scores so it doesn't recruit equally blurry helpers. The price is 2 ms more per frame, in exchange for more than 7 points of AP50.

When attaching it to your own detector, remember to sample reference frames at random from the whole video rather than taking only a few consecutive neighbors; 3 random frames beat 39 consecutive ones. All of the paper's experiments sample from the whole video; in a streaming setting, only frames already seen can serve as references, and the paper doesn't test that setting.

Two years later, the same authors released YOLOV++, with a stronger backbone and a revised algorithm, reaching 92.9 AP50 on ImageNet VID; it was later published in IJCV.