Back to paper library
arXiv 2023Action recognitionPaper notes

YOWOv2

Striking at Every Scale

Original paper

YOWOv2: A Stronger yet Efficient Multi-level Detection Framework for Real-time Spatio-temporal Action Detection

Paper authors

Jianhua Yang · Kun Dai

Publication
Publication venue not yet verified
First submitted to arXiv
arXiv:2302.06848
Cite this paper · BibTeX

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

@misc{actionrecognitionyowov22023,
  title = {{YOWOv2: A Stronger yet Efficient Multi-level Detection Framework for Real-time Spatio-temporal Action Detection}},
  author = {Jianhua Yang and Kun Dai},
  year = {2023},
  eprint = {2302.06848},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.06848}
}
On this page

In 2019, YOWO made spatio-temporal action detection single-stage. A 2D CNN looks at the current frame, a 3D CNN looks at the whole clip, and after fusion the boxes and actions come out the way YOLOv2 does it.

Four years later, object detection had gone through several generations. Feature pyramids let detectors find objects at different scales; YOLOX removed anchor boxes in favor of dynamic label assignment; YOLOv7 pushed real-time detection to new heights. YOWO's detection head, though, was still stuck at YOLOv2.

Real-time action detection had another line of work over the same period. Methods such as ACT and MOC use a 2D CNN with shared parameters to extract features frame by frame and keep them in a buffer. Each time a new frame arrives, only that new frame needs computing, and it is then combined with the old features in the buffer. This is fast, but the temporal relationships between frames are modeled rather shallowly; to be more accurate you have to add optical flow, and high-quality optical flow is hard to compute in real time.

Jianhua Yang and Kun Dai of the Harbin Institute of Technology chose to stand on YOWO's side, keeping the 3D CNN's ability to model time and replacing the detection part with something new. In 2022, Jianhua Yang had already written a four-page paper, YOWO-Plus, with some small improvements to YOWO; this paper overhauls the whole architecture.

Defining the problem

The authors point out two weaknesses of YOWO.

First, YOWO detects at only one scale. Both branches output at 1/32 of the input size, and with an input of only 224×224, the final feature map is just 7×7. Smaller people in the frame are easily missed.

Second, YOWO uses anchor boxes. The number, size and aspect ratio of the anchor boxes all have to be designed in advance; YOWO computes them separately on each dataset with k-means and has to redo it for every new dataset.

Solving the problem

Original Fig. 1. The YOWOv2 architecture. At top left, the key frame goes into the 2D backbone, which outputs features at three scales, H/8, H/16 and H/32, each split into classification features and regression features. At bottom left, the whole clip goes into the 3D backbone, which outputs one H/32 spatio-temporal feature map; it is upsampled 4×, 2× and 1× and sent to the decoupled fusion heads at the three scales. The enlarged box on the right is the decoupled fusion head: the classification features and the regression features are each fused with the spatio-temporal features through a channel encoder and then followed by two convolution layers each; the classification branch outputs Nc classes, and the regression branch outputs 4 offsets and 1 confidence score. At the far top right is the channel encoder, made up of channel fusion and an attention module.
Original Fig. 1, Yang et al., from PDF page 2, arXiv license, scholarly quotation.

A multi-scale 2D backbone

The 2D branch is replaced by FreeYOLO, which the authors put together themselves, with its backbone and feature pyramid taken straight from YOLOv7. To make training converge a bit faster, the authors first pretrain it, together with the convolution layers after it, on COCO as an ordinary object detector, and release those weights too. From the key frame it outputs features at three scales: 1/8, 1/16 and 1/32 of the input image.

Each scale's features are first compressed to 256 channels and then split into two branches, each followed by two 3×3 convolution layers, one for classification and one for box regression. Classification and regression need rather different information; this is the idea behind YOLOX's decoupled detection head.

3D backbone and fusion

The 3D branch keeps the series of efficient 3D CNNs compiled by YOWO's authors, such as 3D-ShuffleNetV2 and 3D-ResNeXt-101, and outputs one spatio-temporal feature map at 1/32 of the input size. This feature map is upsampled 4×, 2× and 1× to line up with the three scales.

The fusion module also carries over YOWO's CFAM, which the authors call the channel encoder. It concatenates the two kinds of features, passes them through two convolution layers, then applies channel self-attention once. The difference is that at every scale, YOWOv2 fuses the classification features and the regression features with the spatio-temporal features separately, which they call the decoupled fusion head.

After fusion, the classification branch outputs the probability of each location belonging to each action, and the regression branch outputs 4 box offsets plus a confidence score for "is there an action here." Each location has just one prediction, and there are no anchor boxes.

Label assignment and loss

With the anchor boxes gone, something has to decide which locations' predictions are responsible for which ground-truth box. The authors lift YOLOX's SimOTA wholesale, computing a cost for every prediction and every ground-truth box that combines the classification error and the box error:

cij=Lcls(a^i,aj)+γ Lreg(b^i,bj)c_{ij} = \mathcal{L}_{cls}(\hat{a}_i, a_j) + \gamma\, \mathcal{L}_{reg}(\hat{b}_i, b_j)

a^i\hat{a}_i is the classification score multiplied by the confidence score, and γ\gamma is set to 3. Each ground-truth box gets the kk lowest-cost predictions, with kk decided dynamically from their IoUs.

The loss is the sum of three terms. Confidence and classification both use binary cross-entropy, and boxes use the GIoU loss, with a box weight λ\lambda of 5. The authors swept it from 1 to 7. At λ=1\lambda = 1, frame-mAP is 83.3 on UCF101-24 and 19.6 on AVA; raised to 4 or 5, they are 85.2 and 20.2; anywhere from 3 to 6 the results are about the same.

A family

Combining 2D and 3D backbones of different sizes gives three sizes:

Version2D backbone3D backbone
YOWOv2-TFreeYOLO-Tiny3D-ShuffleNetV2 1.0x
YOWOv2-MFreeYOLO-Large3D-ShuffleNetV2 2.0x
YOWOv2-LFreeYOLO-Large3D-ResNeXt-101

Training uses AdamW with a learning rate of 10−410^{-4}, a batch size of 8 with 16 steps of gradient accumulation, and the same 224×224 input. UCF101-24 trains for 7 epochs and AVA for 9, with the learning rate halved at intervals.

Discussion

The experiments use the same datasets as YOWO. UCF101-24 has 3,207 untrimmed videos and 24 sports actions, using the first split; AVA has 430 15-minute movie clips and 80 actions, annotated once per second, and following the official protocol only the 60 most common classes are evaluated.

Against YOWO

ModelClipFPSframe-mAPvideo-mAPGFLOPsParams
YOWO163480.448.843.7121.4M
YOWOv2-T165080.551.32.910.9M
YOWOv2-M164283.150.712.052.0M
YOWOv2-L163085.252.053.6109.7M
YOWOv2-L322287.052.891.9109.7M

These are UCF101-24 results, with FPS measured on an RTX 3090. The smallest model, YOWOv2-T, needs only a fifteenth of YOWO's computation, yet ties it on frame-mAP and is 2.5 points higher on video-mAP.

The L size is nearly 5 points higher on frame-mAP, while its computation goes up from 43.7 to 53.6 GFLOPs; this is what YOWOv3 was pointing at when it later complained that v2 uses even more compute than v1. Stretching the clip to 32 frames brings frame-mAP to 87.0 and adds another 70% of computation. The M size's video-mAP is 50.7, a little lower than the T size's, and the table doesn't explain why.

Also, the version in the YOWO paper with long-term features has a frame-mAP of 87.3 on UCF101-24, higher than YOWOv2-L's 87.0. That version uses future frames, though, and can't run in real time, and YOWOv2's UCF101-24 comparison tables don't list it either.

Original Fig. 6. Scatter plot of frame-mAP on UCF101-24 against FPS on an RTX 3090. The red stars are the three sizes of YOWOv2: L at about 30 FPS and 85.2, M at about 42 FPS and 83.1, T at about 50 FPS and 80.5. The blue dot, YOWO, is at about 35 FPS and 80.4; orange SAMOC at about 34 FPS and 74.2; green MOC at about 69 FPS and 72.4; purple ACT at about 35 FPS and 54.
Original Fig. 6, Yang et al., from PDF page 6, arXiv license, scholarly quotation.

The authors show the effect of multi-scale detection with a few side-by-side frames. Smaller people far away in the scene are missed by YOWO because their confidence scores are too low, while YOWOv2 catches them at the high-resolution level.

Put next to other real-time methods, YOWOv2's three points all sit at the very top. The FPS in the figure is measured at batch size 1, and the authors treat more than 20 frames per second as the threshold for real time. MOC is much faster, at nearly 70 frames per second, but with RGB alone its frame-mAP is only in the low seventies.

Against non-real-time methods, YOWOv2-L with 32 frames has a frame-mAP of 87.0, higher than TubeR (83.2), which uses a 3D CNN; but its video-mAP is 52.8, below TubeR's 58.4 and below MOC with optical flow (53.8). Accurate detection in each frame gives a less clear advantage once the detections are linked into tubes.

AVA

The progress on AVA is less obvious. YOWOv2-L with 16 frames scores 20.2, the same as YOWO with long-term features; with 32 frames it reaches 21.7. The smallest, the T size, gets only 14.9, 3 points below YOWO's 17.9, and the authors admit that expecting such a small model to beat YOWO on AVA isn't realistic.

For comparison, the non-real-time TubeR reaches 31.7 on AVA, but at 120 GFLOPs it can process only 3 frames per second. The authors' position is that YOWOv2 cares more about whether it can actually be put to use.

They also ran a demo of the model on ordinary everyday scenes. Most AVA actions rarely show up in daily footage, so only 14 basic pose actions are displayed, such as standing, sitting, walking and bending over.

Decoupled fusion head

The authors' reasoning is that classification features care about "what action this is" and regression features care about "where the box is." Their semantics differ a lot, so they should also be handled separately when fused with the spatio-temporal features. Switching the decoupled fusion head back to a version where classification and regression share one set of features costs the three sizes 0.9 to 1.9 points of frame-mAP, while speed goes up a little, from 30 to 33 frames per second for the L size.

Code

The official code is released under the MIT license, with weights for each size. The repository was last updated in May 2024, and the author last replied in the issues in August 2023. Most of the twenty-odd issues opened after that got no response; one person reported that evaluating the released nano weights gave a frame-mAP nearly 1 point off what the README says.

In May 2024, someone opened an issue in this repository saying they were developing a new version. The poster was the first author of YOWOv3.

Conclusion

YOWOv2 keeps YOWO's skeleton, with 2D looking at the present, 3D looking at the clip and CFAM fusing them, and replaces the whole detection part with what was standard practice in 2023. The multi-scale feature pyramid, the decoupled detection head, anchor-free detection and SimOTA's dynamic label assignment are almost all moved straight over from YOLOX and YOLOv7.

The effect on UCF101-24 is clear. A small model catches up with YOWO, and a large model adds several points. In the conclusion, the authors write that YOWOv2 is an effective attempt but not the end of YOWO. The price is that the large model uses even more computation than YOWO, a problem left for the next generation, [24.08] YOWOv3: Taking the Baton.