You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

model_zoo.md 21 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. # 模型库
  2. ## 镜像地址
  3. 从 MMDetection V2.0 起,我们只通过阿里云维护模型库。V1.x 版本的模型已经弃用。
  4. ## 共同设置
  5. - 所有模型都是在 `coco_2017_train` 上训练,在 `coco_2017_val` 上测试。
  6. - 我们使用分布式训练。
  7. - 所有 pytorch-style 的 ImageNet 预训练主干网络来自 PyTorch 的模型库,caffe-style 的预训练主干网络来自 detectron2 最新开源的模型。
  8. - 为了与其他代码库公平比较,文档中所写的 GPU 内存是8个 GPU 的 `torch.cuda.max_memory_allocated()` 的最大值,此值通常小于 nvidia-smi 显示的值。
  9. - 我们以网络 forward 和后处理的时间加和作为推理时间,不包含数据加载时间。所有结果通过 [benchmark.py](https://github.com/open-mmlab/mmdetection/blob/master/tools/analysis_tools/benchmark.py) 脚本计算所得。该脚本会计算推理 2000 张图像的平均时间。
  10. ## ImageNet 预训练模型
  11. 通过 ImageNet 分类任务预训练的主干网络进行初始化是很常见的操作。所有预训练模型的链接都可以在 [open_mmlab](https://github.com/open-mmlab/mmcv/blob/master/mmcv/model_zoo/open_mmlab.json) 中找到。根据 `img_norm_cfg` 和原始权重,我们可以将所有 ImageNet 预训练模型分为以下几种情况:
  12. - TorchVision:torchvision 模型权重,包含 ResNet50, ResNet101。`img_norm_cfg` 为 `dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)`。
  13. - Pycls:[pycls](https://github.com/facebookresearch/pycls) 模型权重,包含 RegNetX。`img_norm_cfg` 为 `dict(
  14. mean=[103.530, 116.280, 123.675], std=[57.375, 57.12, 58.395], to_rgb=False)`。
  15. - MSRA styles:[MSRA](https://github.com/KaimingHe/deep-residual-networks) 模型权重,包含 ResNet50_Caffe,ResNet101_Caffe。`img_norm_cfg` 为 `dict(
  16. mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)`。
  17. - Caffe2 styles:现阶段只包含 ResNext101_32x8d。`img_norm_cfg` 为 `dict(mean=[103.530, 116.280, 123.675], std=[57.375, 57.120, 58.395], to_rgb=False)`。
  18. - Other styles: SSD 的 `img_norm_cfg` 为 `dict(mean=[123.675, 116.28, 103.53], std=[1, 1, 1], to_rgb=True)`,YOLOv3 的 `img_norm_cfg` 为 `dict(mean=[0, 0, 0], std=[255., 255., 255.], to_rgb=True)`。
  19. MMdetection 常用到的主干网络细节如下表所示:
  20. | 模型 | 来源 | 链接 | 描述 |
  21. | ---------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  22. | ResNet50 | TorchVision | [torchvision 中的 ResNet-50](https://download.pytorch.org/models/resnet50-19c8e357.pth) | 来自 [torchvision 中的 ResNet-50](https://download.pytorch.org/models/resnet50-19c8e357.pth)。 |
  23. | ResNet101 | TorchVision | [torchvision 中的 ResNet-101](https://download.pytorch.org/models/resnet101-5d3b4d8f.pth) | 来自 [torchvision 中的 ResNet-101](https://download.pytorch.org/models/resnet101-5d3b4d8f.pth)。 |
  24. | RegNetX | Pycls | [RegNetX_3.2gf](https://download.openmmlab.com/pretrain/third_party/regnetx_3.2gf-c2599b0f.pth),[RegNetX_800mf](https://download.openmmlab.com/pretrain/third_party/regnetx_800mf-1f4be4c7.pth) 等 | 来自 [pycls](https://github.com/facebookresearch/pycls)。 |
  25. | ResNet50_Caffe | MSRA | [MSRA 中的 ResNet-50](https://download.openmmlab.com/pretrain/third_party/resnet50_caffe-788b5fa3.pth) | 由 [Detectron2 中的 R-50.pkl](https://dl.fbaipublicfiles.com/detectron2/ImageNetPretrained/MSRA/R-50.pkl) 转化的副本。原始权重文件来自 [MSRA 中的原始 ResNet-50](https://github.com/KaimingHe/deep-residual-networks)。 |
  26. | ResNet101_Caffe | MSRA | [MSRA 中的 ResNet-101](https://download.openmmlab.com/pretrain/third_party/resnet101_caffe-3ad79236.pth) | 由 [Detectron2 中的 R-101.pkl](https://dl.fbaipublicfiles.com/detectron2/ImageNetPretrained/MSRA/R-101.pkl) 转化的副本。原始权重文件来自 [MSRA 中的原始 ResNet-101](https://github.com/KaimingHe/deep-residual-networks)。 |
  27. | ResNext101_32x8d | Caffe2 | [Caffe2 ResNext101_32x8d](https://download.openmmlab.com/pretrain/third_party/resnext101_32x8d-1516f1aa.pth) | 由 [Detectron2 中的 X-101-32x8d.pkl](https://dl.fbaipublicfiles.com/detectron2/ImageNetPretrained/FAIR/X-101-32x8d.pkl) 转化的副本。原始 ResNeXt-101-32x8d 由 FB 使用 Caffe2 训练。 |
  28. ## Baselines
  29. ### RPN
  30. 请参考 [RPN](https://github.com/open-mmlab/mmdetection/blob/master/configs/rpn)。
  31. ### Faster R-CNN
  32. 请参考 [Faster R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/faster_rcnn)。
  33. ### Mask R-CNN
  34. 请参考 [Mask R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/mask_rcnn)。
  35. ### Fast R-CNN (使用提前计算的 proposals)
  36. 请参考 [Fast R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/fast_rcnn)。
  37. ### RetinaNet
  38. 请参考 [RetinaNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/retinanet)。
  39. ### Cascade R-CNN and Cascade Mask R-CNN
  40. 请参考 [Cascade R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/cascade_rcnn)。
  41. ### Hybrid Task Cascade (HTC)
  42. 请参考 [HTC](https://github.com/open-mmlab/mmdetection/blob/master/configs/htc)。
  43. ### SSD
  44. 请参考 [SSD](https://github.com/open-mmlab/mmdetection/blob/master/configs/ssd)。
  45. ### Group Normalization (GN)
  46. 请参考 [Group Normalization](https://github.com/open-mmlab/mmdetection/blob/master/configs/gn)。
  47. ### Weight Standardization
  48. 请参考 [Weight Standardization](https://github.com/open-mmlab/mmdetection/blob/master/configs/gn+ws)。
  49. ### Deformable Convolution v2
  50. 请参考 [Deformable Convolutional Networks](https://github.com/open-mmlab/mmdetection/blob/master/configs/dcn)。
  51. ### CARAFE: Content-Aware ReAssembly of FEatures
  52. 请参考 [CARAFE](https://github.com/open-mmlab/mmdetection/blob/master/configs/carafe)。
  53. ### Instaboost
  54. 请参考 [Instaboost](https://github.com/open-mmlab/mmdetection/blob/master/configs/instaboost)。
  55. ### Libra R-CNN
  56. 请参考 [Libra R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/libra_rcnn)。
  57. ### Guided Anchoring
  58. 请参考 [Guided Anchoring](https://github.com/open-mmlab/mmdetection/blob/master/configs/guided_anchoring)。
  59. ### FCOS
  60. 请参考 [FCOS](https://github.com/open-mmlab/mmdetection/blob/master/configs/fcos)。
  61. ### FoveaBox
  62. 请参考 [FoveaBox](https://github.com/open-mmlab/mmdetection/blob/master/configs/foveabox)。
  63. ### RepPoints
  64. 请参考 [RepPoints](https://github.com/open-mmlab/mmdetection/blob/master/configs/reppoints)。
  65. ### FreeAnchor
  66. 请参考 [FreeAnchor](https://github.com/open-mmlab/mmdetection/blob/master/configs/free_anchor)。
  67. ### Grid R-CNN (plus)
  68. 请参考 [Grid R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/grid_rcnn)。
  69. ### GHM
  70. 请参考 [GHM](https://github.com/open-mmlab/mmdetection/blob/master/configs/ghm)。
  71. ### GCNet
  72. 请参考 [GCNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/gcnet)。
  73. ### HRNet
  74. 请参考 [HRNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/hrnet)。
  75. ### Mask Scoring R-CNN
  76. 请参考 [Mask Scoring R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/ms_rcnn)。
  77. ### Train from Scratch
  78. 请参考 [Rethinking ImageNet Pre-training](https://github.com/open-mmlab/mmdetection/blob/master/configs/scratch)。
  79. ### NAS-FPN
  80. 请参考 [NAS-FPN](https://github.com/open-mmlab/mmdetection/blob/master/configs/nas_fpn)。
  81. ### ATSS
  82. 请参考 [ATSS](https://github.com/open-mmlab/mmdetection/blob/master/configs/atss)。
  83. ### FSAF
  84. 请参考 [FSAF](https://github.com/open-mmlab/mmdetection/blob/master/configs/fsaf)。
  85. ### RegNetX
  86. 请参考 [RegNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/regnet)。
  87. ### Res2Net
  88. 请参考 [Res2Net](https://github.com/open-mmlab/mmdetection/blob/master/configs/res2net)。
  89. ### GRoIE
  90. 请参考 [GRoIE](https://github.com/open-mmlab/mmdetection/blob/master/configs/groie)。
  91. ### Dynamic R-CNN
  92. 请参考 [Dynamic R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/dynamic_rcnn)。
  93. ### PointRend
  94. 请参考 [PointRend](https://github.com/open-mmlab/mmdetection/blob/master/configs/point_rend)。
  95. ### DetectoRS
  96. 请参考 [DetectoRS](https://github.com/open-mmlab/mmdetection/blob/master/configs/detectors)。
  97. ### Generalized Focal Loss
  98. 请参考 [Generalized Focal Loss](https://github.com/open-mmlab/mmdetection/blob/master/configs/gfl)。
  99. ### CornerNet
  100. 请参考 [CornerNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/cornernet)。
  101. ### YOLOv3
  102. 请参考 [YOLOv3](https://github.com/open-mmlab/mmdetection/blob/master/configs/yolo)。
  103. ### PAA
  104. 请参考 [PAA](https://github.com/open-mmlab/mmdetection/blob/master/configs/paa)。
  105. ### SABL
  106. 请参考 [SABL](https://github.com/open-mmlab/mmdetection/blob/master/configs/sabl)。
  107. ### CentripetalNet
  108. 请参考 [CentripetalNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/centripetalnet)。
  109. ### ResNeSt
  110. 请参考 [ResNeSt](https://github.com/open-mmlab/mmdetection/blob/master/configs/resnest)。
  111. ### DETR
  112. 请参考 [DETR](https://github.com/open-mmlab/mmdetection/blob/master/configs/detr)。
  113. ### Deformable DETR
  114. 请参考 [Deformable DETR](https://github.com/open-mmlab/mmdetection/blob/master/configs/deformable_detr)。
  115. ### AutoAssign
  116. 请参考 [AutoAssign](https://github.com/open-mmlab/mmdetection/blob/master/configs/autoassign)。
  117. ### YOLOF
  118. 请参考 [YOLOF](https://github.com/open-mmlab/mmdetection/blob/master/configs/yolof)。
  119. ### Seesaw Loss
  120. 请参考 [Seesaw Loss](https://github.com/open-mmlab/mmdetection/blob/master/configs/seesaw_loss)。
  121. ### CenterNet
  122. 请参考 [CenterNet](https://github.com/open-mmlab/mmdetection/blob/master/configs/centernet)。
  123. ### YOLOX
  124. 请参考 [YOLOX](https://github.com/open-mmlab/mmdetection/blob/master/configs/yolox)。
  125. ### PVT
  126. 请参考 [PVT](https://github.com/open-mmlab/mmdetection/blob/master/configs/pvt)。
  127. ### SOLO
  128. 请参考 [SOLO](https://github.com/open-mmlab/mmdetection/blob/master/configs/solo)。
  129. ### QueryInst
  130. 请参考 [QueryInst](https://github.com/open-mmlab/mmdetection/blob/master/configs/queryinst)。
  131. ### Other datasets
  132. 我们还在 [PASCAL VOC](https://github.com/open-mmlab/mmdetection/blob/master/configs/pascal_voc),[Cityscapes](https://github.com/open-mmlab/mmdetection/blob/master/configs/cityscapes) 和 [WIDER FACE](https://github.com/open-mmlab/mmdetection/blob/master/configs/wider_face) 上对一些方法进行了基准测试。
  133. ### Pre-trained Models
  134. 我们还通过多尺度训练和更长的训练策略来训练用 ResNet-50 和 [RegNetX-3.2G](https://github.com/open-mmlab/mmdetection/blob/master/configs/regnet) 作为主干网络的 [Faster R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/faster_rcnn) 和 [Mask R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/mask_rcnn)。这些模型可以作为下游任务的预训练模型。
  135. ## 速度基准
  136. ### 训练速度基准
  137. 我们提供 [analyze_logs.py](https://github.com/open-mmlab/mmdetection/blob/master/tools/analysis_tools/analyze_logs.py) 来得到训练中每一次迭代的平均时间。示例请参考 [Log Analysis](https://mmdetection.readthedocs.io/en/latest/useful_tools.html#log-analysis)。
  138. 我们与其他流行框架的 Mask R-CNN 训练速度进行比较(数据是从 [detectron2](https://github.com/facebookresearch/detectron2/blob/master/docs/notes/benchmarks.md/) 复制而来)。在 mmdetection 中,我们使用 [mask_rcnn_r50_caffe_fpn_poly_1x_coco_v1.py](https://github.com/open-mmlab/mmdetection/blob/master/configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_poly_1x_coco_v1.py) 进行基准测试。它与 detectron2 的 [mask_rcnn_R_50_FPN_noaug_1x.yaml](https://github.com/facebookresearch/detectron2/blob/master/configs/Detectron1-Comparisons/mask_rcnn_R_50_FPN_noaug_1x.yaml) 设置完全一样。同时,我们还提供了[模型权重](https://download.openmmlab.com/mmdetection/v2.0/benchmark/mask_rcnn_r50_caffe_fpn_poly_1x_coco_no_aug/mask_rcnn_r50_caffe_fpn_poly_1x_coco_no_aug_compare_20200518-10127928.pth)和[训练 log](https://download.openmmlab.com/mmdetection/v2.0/benchmark/mask_rcnn_r50_caffe_fpn_poly_1x_coco_no_aug/mask_rcnn_r50_caffe_fpn_poly_1x_coco_no_aug_20200518_105755.log.json) 作为参考。为了跳过 GPU 预热时间,吞吐量按照100-500次迭代之间的平均吞吐量来计算。
  139. | 框架 | 吞吐量 (img/s) |
  140. | -------------------------------------------------------------------------------------- | ------------------ |
  141. | [Detectron2](https://github.com/facebookresearch/detectron2) | 62 |
  142. | [MMDetection](https://github.com/open-mmlab/mmdetection) | 61 |
  143. | [maskrcnn-benchmark](https://github.com/facebookresearch/maskrcnn-benchmark/) | 53 |
  144. | [tensorpack](https://github.com/tensorpack/tensorpack/tree/master/examples/FasterRCNN) | 50 |
  145. | [simpledet](https://github.com/TuSimple/simpledet/) | 39 |
  146. | [Detectron](https://github.com/facebookresearch/Detectron) | 19 |
  147. | [matterport/Mask_RCNN](https://github.com/matterport/Mask_RCNN/) | 14 |
  148. ### 推理时间基准
  149. 我们提供 [benchmark.py](https://github.com/open-mmlab/mmdetection/blob/master/tools/analysis_tools/benchmark.py) 对推理时间进行基准测试。此脚本将推理 2000 张图片并计算忽略前 5 次推理的平均推理时间。可以通过设置 `LOG-INTERVAL` 来改变 log 输出间隔(默认为 50)。
  150. ```shell
  151. python toools/benchmark.py ${CONFIG} ${CHECKPOINT} [--log-interval $[LOG-INTERVAL]] [--fuse-conv-bn]
  152. ```
  153. 模型库中,所有模型在基准测量推理时间时都没设置 `fuse-conv-bn`, 此设置可以使推理时间更短。
  154. ## 与 Detectron2 对比
  155. 我们在速度和精度方面对 mmdetection 和 [Detectron2](https://github.com/facebookresearch/detectron2.git) 进行对比。对比所使用的 detectron2 的 commit id 为 [185c27e](https://github.com/facebookresearch/detectron2/tree/185c27e4b4d2d4c68b5627b3765420c6d7f5a659)(30/4/2020)。
  156. 为了公平对比,我们所有的实验都在同一机器下进行。
  157. ### 硬件
  158. - 8 NVIDIA Tesla V100 (32G) GPUs
  159. - Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
  160. ### 软件环境
  161. - Python 3.7
  162. - PyTorch 1.4
  163. - CUDA 10.1
  164. - CUDNN 7.6.03
  165. - NCCL 2.4.08
  166. ### 精度
  167. | 模型 | 训练策略 | Detectron2 | mmdetection | 下载 |
  168. | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  169. | [Faster R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py) | 1x | [37.9](https://github.com/facebookresearch/detectron2/blob/master/configs/COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml) | 38.0 | [model](https://download.openmmlab.com/mmdetection/v2.0/benchmark/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco-5324cff8.pth) | [log](https://download.openmmlab.com/mmdetection/v2.0/benchmark/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco_20200429_234554.log.json) |
  170. | [Mask R-CNN](https://github.com/open-mmlab/mmdetection/blob/master/configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py) | 1x | [38.6 & 35.2](https://github.com/facebookresearch/detectron2/blob/master/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml) | 38.8 & 35.4 | [model](https://download.openmmlab.com/mmdetection/v2.0/benchmark/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco-dbecf295.pth) | [log](https://download.openmmlab.com/mmdetection/v2.0/benchmark/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco_20200430_054239.log.json) |
  171. | [Retinanet](https://github.com/open-mmlab/mmdetection/blob/master/configs/retinanet/retinanet_r50_caffe_fpn_mstrain_1x_coco.py) | 1x | [36.5](https://github.com/facebookresearch/detectron2/blob/master/configs/COCO-Detection/retinanet_R_50_FPN_1x.yaml) | 37.0 | [model](https://download.openmmlab.com/mmdetection/v2.0/benchmark/retinanet_r50_caffe_fpn_mstrain_1x_coco/retinanet_r50_caffe_fpn_mstrain_1x_coco-586977a0.pth) | [log](https://download.openmmlab.com/mmdetection/v2.0/benchmark/retinanet_r50_caffe_fpn_mstrain_1x_coco/retinanet_r50_caffe_fpn_mstrain_1x_coco_20200430_014748.log.json) |
  172. ### 训练速度
  173. 训练速度使用 s/iter 来度量。结果越低越好。
  174. | 模型 | Detectron2 | mmdetection |
  175. | ------------ | ---------- | ----------- |
  176. | Faster R-CNN | 0.210 | 0.216 |
  177. | Mask R-CNN | 0.261 | 0.265 |
  178. | Retinanet | 0.200 | 0.205 |
  179. ### 推理速度
  180. 推理速度通过单张 GPU 下的 fps(img/s) 来度量,越高越好。
  181. 为了与 Detectron2 保持一致,我们所写的推理时间除去了数据加载时间。
  182. 对于 Mask RCNN,我们去除了后处理中 RLE 编码的时间。
  183. 我们在括号中给出了官方给出的速度。由于硬件差异,官方给出的速度会比我们所测试得到的速度快一些。
  184. | 模型 | Detectron2 | mmdetection |
  185. | ------------ | ----------- | ----------- |
  186. | Faster R-CNN | 25.6 (26.3) | 22.2 |
  187. | Mask R-CNN | 22.5 (23.3) | 19.6 |
  188. | Retinanet | 17.8 (18.2) | 20.6 |
  189. ### 训练内存
  190. | 模型 | Detectron2 | mmdetection |
  191. | ------------ | ---------- | ----------- |
  192. | Faster R-CNN | 3.0 | 3.8 |
  193. | Mask R-CNN | 3.4 | 3.9 |
  194. | Retinanet | 3.9 | 3.4 |

No Description

Contributors (3)