# RetinaNet

**RetinaNet** 是 Facebook AI Research 的林宗毅（Tsung-Yi Lin）、普里娅·戈亚尔（Priya Goyal）、罗斯·吉尔希克（Ross Girshick）、何恺明（Kaiming He）和彼得·多拉尔（Piotr Dollár）于 2017 年在论文《密集目标检测的焦点损失》（*Focal Loss for Dense Object Detection*）中提出的单阶段目标检测模型。<sup>[1](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)</sup> 其名称源于对输入图像中目标位置的密集采样；该模型将高效的网络内特征金字塔与锚框相结合。<sup>[2](https://vision.cornell.edu/se3/wp-content/uploads/2017/09/focal_loss.pdf)</sup> 该论文的核心贡献是焦点损失——一种重塑的交叉熵，它降低已良好分类样本的权重，使训练聚焦于少量困难样本，而非海量简单背景位置。<sup>[1](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)</sup> 使用该损失训练后，RetinaNet 在发表时超越了此前已发表的最佳单模型结果，无论单阶段还是两阶段检测器。<sup>[1](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 类型 | 单阶段、密集目标检测器，在位置、尺度和长宽比的规则采样上应用<sup>[1](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)</sup> |
| 提出 | ICCV 2017，《密集目标检测的焦点损失》，Facebook AI Research<sup>[1](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)</sup> |
| 标志性损失 | 焦点损失，\( \mathrm{FL}(p_t) = -(1 - p_t)^{\gamma} \log(p_t) \)，降低已良好分类样本的权重<sup>[3](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper.pdf)</sup> |
| 骨干网络 | 基于 ResNet 骨干的特征金字塔网络（FPN），具有自底向上和自顶向下通路及横向连接<sup>[4](https://www.sciencedirect.com/science/article/pii/S095219762400616X)</sup> |
| 原始结果 | ResNet-101-FPN 模型在 5 fps 下达到 39.1 COCO test-dev AP<sup>[2](https://vision.cornell.edu/se3/wp-content/uploads/2017/09/focal_loss.pdf)</sup> |
| 训练规模 | 焦点损失应用于每张采样图像中全部约 10 万个锚框<sup>[5](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper)</sup> |
| 标准设置 | \( \gamma = 2 \)，\( \alpha = 0.25 \)，偏置先验 \( \pi = 0.01 \)<sup>[6](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)</sup> |
| 可用性 | Detectron2、MMDetection 和 torchvision 中的参考实现<sup>[7](https://github.com/facebookresearch/detectron2/blob/main/MODEL_ZOO.md)</sup><sup> • </sup><sup>[8](https://docs.pytorch.org/vision/stable/models/retinanet.html)</sup> |

## 类别不平衡问题

在 RetinaNet 之前，精度最高的检测器是 [R-CNN](https://www.edgepedia.org/zh/r-cnn) 系列中由候选区域驱动的两阶段系统：第一阶段提出一组稀疏的候选目标位置，第二阶段将每个候选分类为前景或背景。YOLO 和 SSD 等单阶段检测器对位置、尺度和长宽比进行密集采样，有潜力更快更简单，但当时其精度相对两阶段方法落后 10% 到 40%。<sup>[3](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper.pdf)</sup>

RetinaNet 论文将原因归结为训练期间极端的前景-背景类别不平衡。密集检测器每张图像评估数万个候选位置，其中几乎全部包含背景，因此简单负样本主导了损失，淹没了有用的训练信号。<sup>[1](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)</sup>

## 焦点损失

焦点损失通过乘以一个调制因子来重塑标准交叉熵 \( \mathrm{CE}(p_t) = -\log(p_t) \)：

\[ \mathrm{FL}(p_t) = -(1 - p_t)^{\gamma} \log(p_t) \]

其中 \( p_t \) 是模型对真实类别的估计概率，\( \gamma \) 是聚焦参数。当一个样本被良好分类时，\( p_t \) 趋近于 1，因子 \( (1 - p_t)^{\gamma} \) 将损失推向零，因此海量简单负样本贡献甚微，训练集中于困难样本。<sup>[3](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper.pdf)</sup> 在 ResNet-50-FPN 上的消融实验中，\( \gamma = 2 \) 比 \( \alpha \) 平衡交叉熵提升了 2.9 AP 点。<sup>[9](https://docsaid.org/en/papers/object-detection/retinanet/)</sup>

## 架构

RetinaNet 是一个单一统一网络，具有一个骨干架构和两个任务特定子网络，在多个尺度上执行检测。<sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC9033309/)</sup> 骨干是建立在 ResNet 上的特征金字塔网络：自底向上通路在多个分辨率上计算特征图，自顶向下通路将语义强的特征传回下方，横向连接在层级之间融合特征。<sup>[4](https://www.sciencedirect.com/science/article/pii/S095219762400616X)</sup> 融合之后，采样特征进入分类子网络和框回归子网络，分别预测目标类别和偏移量。<sup>[4](https://www.sciencedirect.com/science/article/pii/S095219762400616X)</sup>

该检测器基于锚框。在每个金字塔位置，它在从 \( 32^2 \) 到 \( 512^2 \) 的基础面积上放置具有三种长宽比和三种尺度乘数的锚框，并使用四个偏移量从锚框回归框偏移。<sup>[6](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)</sup><sup> • </sup><sup>[11](https://arxiv.org/pdf/1912.02424)</sup> 训练期间，锚框通过交并比（IoU）阈值 0.5 和 0.4 被分配为正样本或负样本，焦点损失应用于每张采样图像中全部约 100,000 个锚框。<sup>[6](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)</sup><sup> • </sup><sup>[5](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper)</sup> FPN 结构显著改善了小尺度目标的检测，而未大幅影响检测速度。<sup>[4](https://www.sciencedirect.com/science/article/pii/S095219762400616X)</sup>

## 性能与影响

使用 ResNet-101-FPN 骨干，初始模型在 COCO test-dev 集上以每秒 5 帧的速度达到 39.1 的平均精度（AP），超越了此前所有已发表的单模型结果，无论单阶段还是两阶段检测器。<sup>[2](https://vision.cornell.edu/se3/wp-content/uploads/2017/09/focal_loss.pdf)</sup> 使用 ResNeXt-32x8d-101-FPN 骨干进一步提升了 1.7 AP，在 COCO 上超过 40 AP。<sup>[9](https://docsaid.org/en/papers/object-detection/retinanet/)</sup>

**现代参考数据。** Detectron2 的模型库报告 RetinaNet R50-FPN 在 1x 调度下框 AP 为 37.4，3x 下为 38.7，R101-FPN 在 3x 下为 40.4。<sup>[7](https://github.com/facebookresearch/detectron2/blob/main/MODEL_ZOO.md)</sup> [MMDetection](https://www.edgepedia.org/zh/mmdetection) 报告 R-50-FPN 在 1x 下框 AP 为 36.5，X-101-64x4d-FPN 在 3x 调度下高达 41.6。<sup>[12](https://github.com/open-mmlab/mmdetection/blob/main/configs/retinanet/README.md)</sup> 在 torchvision 中，ResNet-50-FPN 权重在 COCO val2017 上以 34.0M 参数达到 36.4 框 AP，改进的 V2 配方以 38.2M 参数达到 41.5 框 AP。<sup>[13](https://docs.pytorch.org/vision/master/models.html)</sup>

**对锚框的敏感性。** RetinaNet 对其锚框设置敏感；论文报告随着设置变化，COCO AP 的波动可达 4 点。<sup>[6](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)</sup> 后来的无锚检测器如 [FCOS](https://www.edgepedia.org/zh/fcos) 完全移除了预定义锚框及其超参数；在相同的 ResNet-101-FPN 骨干上，FCOS 达到 41.5 AP，而 RetinaNet 为 39.1。<sup>[6](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)</sup> 后续分析发现，基于锚框的 RetinaNet 与无锚的 FCOS 之间的本质区别在于正负训练样本的定义方式，而非回归是从框还是从点开始。<sup>[11](https://arxiv.org/pdf/1912.02424)</sup> 扩展工作也直接建立在该模型之上：Cascade RetinaNet 通过减少跨阶段的错位，将其在 MS COCO 上从 39.1 提升到 41.1 AP。<sup>[14](https://arxiv.org/abs/1907.06881)</sup>

焦点损失本身的应用远不局限于 RetinaNet。综述认为它有效解决了单阶段检测中的正负样本不平衡并提升了模型精度，后来的检测器如 FCOS 也沿用了这一损失及其参数 \( \gamma \) 和 \( \alpha \)。<sup>[15](https://doi.org/10.1007/s11042-022-13801-3)</sup><sup> • </sup><sup>[6](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)</sup> RetinaNet 仍是检测研究中的标准基线，并应用于车辆监控、海上搜救图像和作物-杂草检测等领域。<sup>[16](https://arxiv.org/abs/1803.01114)</sup><sup> • </sup><sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC11126793/)</sup>

## References

1. [Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, Piotr Dollár (2017). Focal Loss for Dense Object Detection. ICCV 2017.](https://openaccess.thecvf.com/content_iccv_2017/html/Lin_Focal_Loss_for_ICCV_2017_paper.html)
2. [Focal Loss for Dense Object Detection (paper text), Cornell Vision Group mirror](https://vision.cornell.edu/se3/wp-content/uploads/2017/09/focal_loss.pdf)
3. [Lin et al., Focal Loss for Dense Object Detection, ICCV 2017 open-access PDF](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper.pdf)
4. [The evolution of object detection methods, ScienceDirect](https://www.sciencedirect.com/science/article/pii/S095219762400616X)
5. [Lin et al., ICCV 2017 paper page (architecture figure and training details)](https://openaccess.thecvf.com/content_ICCV_2017/papers/Lin_Focal_Loss_for_ICCV_2017_paper)
6. [One-Stage Detection, Computer Vision textbook chapter, Wits University](https://courses.ms.wits.ac.za/~richard/cv/book/chapters/05-detection-one-stage.html)
7. [Detectron2 MODEL_ZOO.md, facebookresearch](https://github.com/facebookresearch/detectron2/blob/main/MODEL_ZOO.md)
8. [RetinaNet, Torchvision documentation](https://docs.pytorch.org/vision/stable/models/retinanet.html)
9. [RetinaNet paper summary, DOCSAID](https://docsaid.org/en/papers/object-detection/retinanet/)
10. [Tools, techniques, datasets and application areas for object detection in an image: a review, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC9033309/)
11. [Bridging the Gap Between Anchor-based and Anchor-free Detection (ATSS), arXiv:1912.02424](https://arxiv.org/pdf/1912.02424)
12. [MMDetection RetinaNet configs README, open-mmlab](https://github.com/open-mmlab/mmdetection/blob/main/configs/retinanet/README.md)
13. [Models and pre-trained weights, Torchvision documentation](https://docs.pytorch.org/vision/master/models.html)
14. [Cascade RetinaNet: Maintaining Consistency for Single-Stage Object Detection, arXiv:1907.06881](https://arxiv.org/abs/1907.06881)
15. [A survey: object detection methods from CNN to transformer, Multimedia Tools and Applications](https://doi.org/10.1007/s11042-022-13801-3)
16. [Focal Loss Dense Detector for Vehicle Surveillance, arXiv:1803.01114](https://arxiv.org/abs/1803.01114)
17. [Heuristic data-driven anchor generation for UAV-based maritime rescue image object detection, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC11126793/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Language and vision AI › Computer vision

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/retinanet

English original: https://www.edgepedia.org/retinanet
