文章概要
  • 集成decoupled head、SimOTA、anchor-free、NMS-free等strategy
  • 比赛第1名:仅使用YOLOX-L,获得CVPR2021的Workshop on Autonomous Driving的第1名,详见原paper
  • 部署代码:ONNX、TensorRT、NCNN和Openvino
背景
  • YOLOv5性能最优:48.2% AP on COCO at 13.7 ms
  • 过去两年的major advance
方向方法anchor-free detectorsFCOS、CenterNet、CornerNetadvanced label assignment strategiesFreeanchor、ATSS、PAA、Autoassign、IQDet、OTAend-to-end (NMS-free) detectorsDETR、End-to-end object detection with fully convolutional network、PSS

  • 问题:过去两年的major advance未被集成到YOLO系列,YOLOv4和v5仍然是anchor-based、训练时仍使用hand-crafted assigning rules
  • insight:对于anchor-based pipeline,YOLOv4和v5可能有点over-optimized
  • baseline:YOLOv3-SPP(Darknet53)
YOLOX-DarkNet53

实现细节

  • consistent settings:从baseline到final model的训练设置mostly一致
  • epoch:300个epoch,5个epoch的warm up
  • 数据集:COCO train2017
  • 优化器:SGD,momentum 0.9
  • weight decay:0.0005
  • 学习率:lr×BatchSize/64(linear scaling),lr=0.01,cosine lr schedule
  • batch size:128 for 8-GPU
  • input size:448 to 832 with 32 strides
  • inference setting:FP16-precision,batch=1,single Tesla V100

Decoupled head

  • 问题:在OD中,classification任务和regression任务之间存在conflict

实验

以下2个实验说明,coupled head会损害性能

  • 使用decoupled head替换coupled head会提高收敛速度,如下图(图3)所示
  • decoupled head对end-to-end版本的YOLO很重要,如下表(表1)所示。如果使用coupled head,从YOLO转为End-to-end YOLO后AP下降4.2,而如果使用decoupled head则AP只下降0.8

Strong data augmentation

  • 设置:使用Mosaic(ultralytics-YOLOv3提出)和MixUp,在最后15个epoch停止
  • 发现:在使用strong data augmentation之后,作者发现ImageNet预训练不再有益,因此之后的model都是train from scratch。(如何理解“之后”一词?见表2,可知作者是一个个迭代增加模块或trick的)
  • 实验:见消融实验

Anchor-free

  • anchor机制的问题
  • 聚类:在训练前需要通过聚类生成anchor,这些anchor是domain-specific and less generalized
  • complexity:增加了detection head的complexity;每张image中prediction的数量也增加了,而在设备间(比如从NPU到CPU)移动大量prediction的耗时可能会是个瓶颈
  • anchor-free的优点:减少了需要heuristic tuning和Anchor Clustering 、Grid Sensitive等trick的参数的数量,使得decoder的training和decoding相对更简单
  • anchor-free YOLO
  • location:每个location只预测1个box并直接预测4个值(相对于网格左上角的2个offset、box的高度和宽度)
  • 正样本:将每个object的center location作为正样本
  • scale range:按照FCOS那样,预定义1个scale range,根据每个object的size将每个object分配到对应的FPN level
  • 实验:见消融实验

multi positives

  • 问题:对于每个object,如果只将其center location视为正样本,那就只有1个正样本而忽略了其它高质量的prediction。
  • 潜力:对这些高质量prediction进行优化,可能带来beneficial gradient,这可能会缓解training过程中正/负采样的极端不平衡
  • center sampling:如FSOS的center sampling,本文将每个object的center region(3×3)中的所有location作为正样本
  • 实验:见消融实验

SimOTA

  • label assignment应满足的4点
  • loss/quality aware
  • center prior
  • 每个GT的positive anchor的数量应该是动态的(简化为dynamic top-k)。注:“anchor”在anchor-free detector中指“anchor point”,在YOLO中指“grid”
  • global view
  • OTA:
  • 作者:该方法之前就由旷视提出
  • 思路:OTA从global视角分析label assignment并将其formulate为1个Optimal Transport (OT)问题
  • 效果:SOTA
  • Sinkhorn-Knopp:使用Sinkhorn-Knopp算法解决OT问题会增加25%的训练时长,这对于300个epoch来说非常expensive。因此将其简化为dynamic top-k策略,命名为SlimOTA
  • SlimOTA:
  • pair-wise matching degree:首先计算pair-wise matching degree(通过每个prediction-GT pair的cost或quality来表征),SlimOTA中GT \(g_i\)和prediction \(p_j\)之间的cost \(c_{ij}\)如上所示
  • 对于GT \(g_i\),在1个固定的center region中选择cost最小的top-k predictions作为positive sample。注:对于每个GT,k的值是不同的,详见OTA中的Dynamic k Estimation
  • 最后,这些positive prediction对应的grid被指定为positives,其余grid被指定为negatives
  • 实验:见消融实验

End-to-end(NMS-free) YOLO

  • end-to-end:按照PSS,添加了2个额外的卷积层、one-to-one label assignment和stop gradient,这使得detector变成end-to-end
  • optional module:这稍微降低了preformance和inference speed,因此并不将其纳入本文的final module,而是将其作为一个optional module
  • 实验:见消融实验

消融实

  • decoupled head稍微增加了模型size
  • 除了NMS-free,其它strategy都有效涨点并且没有成本/成本很小
性能对比

除了darknet53,YOLOX在其它不同size的backbone上同样实现了improvement

这张图中不同方法的软硬件差异是somewhat controlled

YOLOX-L

  • backbone:采用YOLOv5的backbone以进行对比,包括modified CSPNet、SiLU activation、the PAN head
  • scaling rule:按照YOLOv5的scale rule,得到YOLOX-S、YOLOX-M、YOLOX-L和YOLOX-X
  • 性能:AP提高1%到3%,时间稍稍增加(因为decoupled head)

YOLOX-Tiny & YOLOX-Nano

  • YOLOX-Tiny:
  • 思路:通过shrink模型而得到(没说怎么shrink的
  • 性能:AP提高9%,而模型size差不多
  • YOLOX-Nano:
  • 思路:采用depth wise convolution
  • 性能:模型size更小,但AP却高出1.8%

Model size V.S. Data augmentation

  • 本文的mixup:mixup with scale jittering
  • heavier:本文的mixup实现比原版heavier
  • 思路:受Copypaste启发,本文在mixup两张图片之前会按随机比例抖动2个图像
  • 效果:Copypaste需要instance mask annotation,而mixup不需要,但两者的AP差不多
  • 作用:当没有instance mask annotation时,mixup with scale jittering可以作为Copypaste的替代品
  • 不同size的模型适用的augmentation不同
  • large model:适合增强augmentation
  • YOLOX-L:应用MixUp可以将AP提高0.9%
  • small model:适合减少或弱化augmentation
  • YOLOX-Nano:弱化mosaic(scale range从[0.1, 2.0]到[0.5, 1.5])并移除mixup,AP提高1.3%

SOTA

  • 注:因为软硬件差异,上表(表6)中inference speed通常是uncontrolled
  • 补充:
  • Scale-YOLOv4、YOLOv5-P6等模型性能更高,但size更大
  • Transformer based detector将accuracy-SOTA推高到了∼60 AP