CV之detectron2:detectron2的简介、安装、使用方法之详细攻略

253 篇文章 236 订阅

CV之detectron2:detectron2的简介、安装、使用方法之详细攻略

 

 

目录

detectron2的简介

1、Detectron2—What's New

detectron2的安装

1、Requirements

2、Build and Install Detectron2

1、官方安装

2、Windows下安装

3、Detectron2 Model Zoo and Baselines

COCO Object Detection Baselines

COCO Instance Segmentation Baselines with Mask R-CNN

COCO Person Keypoint Detection Baselines with Keypoint R-CNN

COCO Panoptic Segmentation Baselines with Panoptic FPN

LVIS Instance Segmentation Baselines with Mask R-CNN

Cityscapes & Pascal VOC Baselines

Other Settings

detectron2的使用方法


 

 

detectron2的简介

         Detectron is Facebook AI Research's software system that implements state-of-the-art object detection algorithms, including Mask R-CNN. It is written in Python and powered by the Caffe2 deep learning framework.
         At FAIR, Detectron has enabled numerous research projects, including: Feature Pyramid Networks for Object Detection, Mask R-CNN, Detecting and Recognizing Human-Object Interactions, Focal Loss for Dense Object Detection, Non-local Neural Networks, Learning to Segment Every Thing, Data Distillation: Towards Omni-Supervised Learning, DensePose: Dense Human Pose Estimation In The Wild, and Group Normalization.
         Detectron是Facebook人工智能研究的软件系统,它实现了最先进的目标检测算法,包括Mask R-CNN。它是用Python编写的,由Caffe2深度学习框架提供支持。
         在Facebook人工智能研究中,Detectron已经启动了许多研究项目,包括:用于物体检测的特征金字塔网络、掩模R-CNN、检测和识别人类与物体的相互作用、用于密集物体检测的焦距损失、非局部神经网络、学习分割每件事物、数据蒸馏:朝向全监督学习,DensePose:在野外进行密集的人体姿势估计,并进行组规范化。
         Detectron2 is Facebook AI Research's next generation software system that implements state-of-the-art object detection algorithms. It is a ground-up rewrite of the previous version, Detectron, and it originates from maskrcnn-benchmark.Detectron2是Facebook人工智能研究的下一代软件系统,实现了最先进的目标检测算法。它是对先前版本Detectron的一次彻底重写,它源于maskrcnn基准测试。

GitHub
Detectron,https://github.com/facebookresearch/Detectron/
Detectron2,https://github.com/facebookresearch/detectron2

       Detectron的目的是为目标检测研究提供高质量、高性能的codebase。它的设计是灵活的,以支持快速实施和评估的新研究。Detectron包括以下对象检测算法的实现:

       采用下列主干网络架构:

       附加的主干架构可能很容易实现。有关这些模型的详细信息,请参阅下面的参考资料

 

1、Detectron2—What's New

  • It is powered by the PyTorch deep learning framework.
  • Includes more features such as panoptic segmentation, densepose, Cascade R-CNN, rotated bounding boxes, etc.
  • Can be used as a library to support different projects on top of it. We'll open source more research projects in this way.
  • It trains much faster.

 

 

detectron2的安装

1、Requirements

  • Linux or macOS
  • Python ≥ 3.6
  • PyTorch ≥ 1.3
  • torchvision that matches the PyTorch installation. You can install them together at pytorch.org to make sure of this.
  • OpenCV, needed by demo and visualization
  • pycocotools: pip install cython; pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
  • GCC ≥ 4.9

2、Build and Install Detectron2

1、官方安装

git clone https://github.com/facebookresearch/detectron2.git
cd detectron2
pip install -e .
# (add --user if you don't have permission)

# or if you are on macOS
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ pip install -e .

2、Windows下安装

git clone https://github.com/facebookresearch/detectron2.git
cd detectron2
python setup.py build develop

相关文章CV之detectron2:detectron2安装过程记录

 

 

3、Detectron2 Model Zoo and Baselines

COCO Object Detection Baselines

Faster R-CNN:

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
model iddownload
R50-C41x0.5510.1104.835.7137257644model | metrics
R50-DC51x0.3800.0685.037.3137847829model | metrics
R50-FPN1x0.2100.0553.037.9137257794model | metrics
R50-C43x0.5430.1104.838.4137849393model | metrics
R50-DC53x0.3780.0735.039.0137849425model | metrics
R50-FPN3x0.2090.0473.040.2137849458model | metrics
R101-C43x0.6190.1495.941.1138204752model | metrics
R101-DC53x0.4520.0826.140.6138204841model | metrics
R101-FPN3x0.2860.0634.142.0137851257model | metrics
X101-FPN3x0.6380.1206.743.0139173657model | metrics

RetinaNet:

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
model iddownload
R501x0.2000.0623.936.5137593951model | metrics
R503x0.2010.0633.937.9137849486model | metrics
R1013x0.2800.0805.139.9138363263model | metrics

RPN & Fast R-CNN:

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
prop.
AR
model iddownload
RPN R50-C41x0.1300.0511.5 51.6137258005model | metrics
RPN R50-FPN1x0.1860.0452.7 58.0137258492model | metrics
Fast R-CNN R50-FPN1x0.1400.0352.637.8 137635226model | metrics

COCO Instance Segmentation Baselines with Mask R-CNN

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
mask
AP
model iddownload
R50-C41x0.5840.1175.236.832.2137259246model | metrics
R50-DC51x0.4710.0746.538.334.2137260150model | metrics
R50-FPN1x0.2610.0533.438.635.2137260431model | metrics
R50-C43x0.5750.1185.239.834.4137849525model | metrics
R50-DC53x0.4700.0756.540.035.9137849551model | metrics
R50-FPN3x0.2610.0553.441.037.2137849600model | metrics
R101-C43x0.6520.1556.342.636.7138363239model | metrics
R101-DC53x0.5450.1557.641.937.3138363294model | metrics
R101-FPN3x0.3400.0704.642.938.6138205316model | metrics
X101-FPN3x0.6900.1297.244.339.5139653917model | metrics

COCO Person Keypoint Detection Baselines with Keypoint R-CNN

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
kp.
AP
model iddownload
R50-FPN1x0.3150.0835.053.664.0137261548model | metrics
R50-FPN3x0.3160.0765.055.465.5137849621model | metrics
R101-FPN3x0.3900.0906.156.466.1138363331model | metrics
X101-FPN3x0.7380.1428.757.366.0139686956model | metrics

COCO Panoptic Segmentation Baselines with Panoptic FPN

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
mask
AP
PQmodel iddownload
R50-FPN1x0.3040.0634.837.634.739.4139514544model | metrics
R50-FPN3x0.3020.0634.840.036.541.5139514569model | metrics
R101-FPN3x0.3920.0786.042.438.543.0139514519model | metrics

LVIS Instance Segmentation Baselines with Mask R-CNN

Mask R-CNN baselines on the LVIS dataset, v0.5. These baselines are described in Table 3(c) of the LVIS paper.

NOTE: the 1x schedule here has the same amount of iterations as the COCO 1x baselines. They are roughly 24 epochs of LVISv0.5 data. The final results of these configs have large variance across different runs.

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
mask
AP
model iddownload
R50-FPN1x0.2920.1277.123.624.4144219072model | metrics
R101-FPN1x0.3710.1247.825.625.9144219035model | metrics
X101-FPN1x0.7120.16610.226.727.1144219108model | metrics

Cityscapes & Pascal VOC Baselines

Simple baselines for

  • Mask R-CNN on Cityscapes instance segmentation (initialized from COCO pre-training, then trained on Cityscapes fine annotations only)
  • Faster R-CNN on PASCAL VOC object detection (trained on VOC 2007 train+val + VOC 2012 train+val, tested on VOC 2007 using 11-point interpolated AP)
Nametrain
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
box
AP50
mask
AP
model iddownload
R50-FPN, Cityscapes0.2400.0924.4  36.5142423278model | metrics
R50-C4, VOC0.5370.0864.851.980.3 142202221model | metrics

Other Settings

Ablations for Deformable Conv and Cascade R-CNN:

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
mask
AP
model iddownload
Baseline R50-FPN1x0.2610.0533.438.635.2137260431model | metrics
Deformable Conv1x0.3420.0613.541.537.5138602867model | metrics
Cascade R-CNN1x0.3170.0664.042.136.4138602847model | metrics
Baseline R50-FPN3x0.2610.0553.441.037.2137849600model | metrics
Deformable Conv3x0.3490.0663.542.738.5144998336model | metrics
Cascade R-CNN3x0.3280.0754.044.338.5144998488model | metrics

Ablations for normalization methods: (Note: The baseline uses 2fc head while the others use 4conv1fc head. According to the GroupNorm paper, the change in head does not improve the baseline by much)

Namelr
sched
train
time
(s/iter)
inference
time
(s/im)
train
mem
(GB)
box
AP
mask
AP
model iddownload
Baseline R50-FPN3x0.2610.0553.441.037.2137849600model | metrics
SyncBN3x0.4640.0635.642.037.8143915318model | metrics
GN3x0.3560.0777.342.638.6138602888model | metrics
GN (scratch)3x0.4000.0779.839.936.6138602908model | metrics

A few very large models trained for a long time, for demo purposes:

Nameinference
time
(s/im)
train
mem
(GB)
box
AP
mask
AP
PQmodel iddownload
Panoptic FPN R1010.12311.447.441.346.1139797668model | metrics
Mask R-CNN X1520.28115.150.244.0 18131413model | metrics
above + test-time aug.  51.945.9  

 

 

detectron2的使用方法

1、demo测试

python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input input1.jpg input2.jpg [--other-options] --opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl

 

 

 

 

 

 

  • 5
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一个处女座的程序猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值