原文 https://blog.csdn.net/ChuiGeDaQiQiu/article/details/83868512
Facebook AI Research 开源了 Faster R-CNN 和 Mask R-CNN 的 PyTorch 1.0 实现基准:MaskRCNN-Benchmark。相比 Detectron 和 mmdetection,MaskRCNN-Benchmark 的性能相当,并拥有更快的训练速度和更低的 GPU 内存占用,众多亮点如下。
介绍:https://mp.weixin.qq.com/s/XSGYlNO1wtRrEv2ivJvonA
项目地址:https://mp.weixin.qq.com/s/XSGYlNO1wtRrEv2ivJvonA
这篇文章主要是记录我使用訪框架训练自己的数据集的过程,总得来说还是比较容易上手的,当然坑也是有一点的。目前只包含了Mask R-CNN和Faster R-CNN两种检测模型,我尝试了一下Mask R-CNN(不包含语义分割)和Faster R-CNN目标检测的功能,也是因为我现在的工作只要用到目标检测。
我的基础环境:
系统:Ubutun 16.04
内核:4.15.0-36-generic
Python环境:Anaconda3
要求的环境:
$ conda create --name maskrcnn_benchmark
$ source activate maskrcnn_benchmark
# this installs the right pip and dependencies for the fresh python
$ conda install ipython
# maskrnn_benchmark and coco api dependencies
$ pip install ninja yacs cython matplotlib
# follow PyTorch installation in https://pytorch.org/get-started/locally/
# we give the instructions for CUDA 9.0
$ conda install pytorch-nightly -c pytorch
# install torchvision
$ cd ~/github
$ git clone https://github.com/pytorch/vision.git
$ cd vision
$ python setup.py install
# install pycocotools
$ cd ~/github
$ git clone https://github.com/cocodataset/cocoapi.git
$ cd cocoapi/PythonAPI
$ python setup.py build_ext install
# install PyTorch Detection
$ cd ~/github
$ git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
$ cd maskrcnn-benchmark
$ python setup.py build develop
到这一步,maskrcnn-benchmark的安装就已经完成了,下一步是要准备训练/验证数据。
maskrcnn-benchmark默认是为coco数据集量身打造的,简单起见我跑自己的数据集也完全照搬的coco的设置。COCO数据集现在有3种标注类型:object instances(目标实例), object keypoints(目标上的关键点), 和image captions(看图说话),使用JSON文件存储。具体可以参考COCO数据集的标注格式一文。我的实验只需要用到object detection,甚至都不需要语义分割,格式相对简单。
{
"info": {..} #描述这个数据集的整体信息,训练自己的数据直接给个空词典ok
"licenses": [license],#可以包含多个licenses实例,训练自己的数据继续给个空列表ok
"images": [
{
'file_name': 'xx', #文件路径,这个路径将和一个将root的根目录拼接成你的文件访问路径
'height': xx, #图片高度
'width': xx, #图片宽度
'id': xx,#每张图片都有一个唯一的id,从0开始编码即可
},
...
],
"annotations": [
{
'segmentation': [] #语义分割的时候要用到,我只用到了目标检测,所以忽略.
'area': xx, #区域面积,宽*高就是区域面积
'image_id': xx, #一张当然可能有多个标注,这个image_id和images中的id相对应
'bbox':[x,y,w,h], #通过这4个坐标来定位边框
'category_id': xx, #类别id(与categories中的id对应)
'id': xx, #这是这个annotation的id,也是唯一的,从0编号即可
},
...
]
"categories": [
{
'supercategory': xx, #你类别名称,例如vehicle(交通工具),下一级有car,truck等.
我自己的数据集没有这种层次关系,我就随便取了个名字adas
'id': xx, #类别的id,从1开始编号,0默认为背景
'name': xx, #这个子类别的名字
},
...
],
}
参照上面的标注格式分别生成训练集和验证集的json标注文件,可以继续沿用coco数据集默认的名字:instances_train2104.json和instances_val2014.json。数据集的目录组织结构可以参考下面的整体目录结构中datasets目录。
(maskrcnn_benchmark) [zuosi@localhost]$tree -L 3
├── configs
│ ├── e2e_faster_rcnn_R_101_FPN_1x.yaml #训练和验证要用到的faster r-cnn模型配置文件
│ ├── e2e_mask_rcnn_R_101_FPN_1x.yaml #训练和验证要用到的mask r-cnn模型配置文件
│ └── quick_schedules
├── CONTRIBUTING.md
├── datasets
│ └── coco
│ ├── annotations
│ │ ├── instances_train2017.json #训练集标注文件
│ │ ├── instances_test2017.json #测试集标注文件
│ │ └── instances_val2017.json #验证集标注文件
│ ├── train2017 #存放训练集图片
│ ├── test2017 #存放测试集图片
│ └── val2017 #存放验证集图片
├── maskrcnn_benchmark
│ ├── config
│ │ ├── defaults.py #masrcnn_benchmark默认配置文件,启动时会读取默认配置文件,configs目录下的模型配置文件进行参数合并
│ │ ├── __init__.py
│ │ ├── paths_catalog.py #在默认文件中配置训练和测试集的路径
│ │ └── __pycache__
│ ├── csrc
│ ├── data
│ │ ├── build.py #生成数据集的地方
│ │ ├── datasets #默认目录下的coco.py提供了coco数据集的访问接口
│ │ └── transforms
│ ├── engine
│ │ ├── inference.py #验证引擎
│ │ └── trainer.py #训练引擎
│ ├── __init__.py
│ ├── layers
│ │ ├── batch_norm.py
│ │ ├── __init__.py
│ │ ├── misc.py
│ │ ├── nms.py
│ │ ├── __pycache__
│ │ ├── roi_align.py
│ │ ├── roi_pool.py
│ │ ├── smooth_l1_loss.py
│ │ └── _utils.py
│ ├── modeling
│ │ ├── backbone
│ │ ├── balanced_positive_negative_sampler.py
│ │ ├── box_coder.py
│ │ ├── detector
│ │ ├── __init__.py
│ │ ├── matcher.py
│ │ ├── poolers.py
│ │ ├── __pycache__
│ │ ├── roi_heads
│ │ ├── rpn
│ │ └── utils.py
│ ├── solver
│ │ ├── build.py
│ │ ├── __init__.py
│ │ ├── lr_scheduler.py #在此设置学习率调整策略
│ │ └── __pycache__
│ ├── structures
│ │ ├── bounding_box.py
│ │ ├── boxlist_ops.py
│ │ ├── image_list.py
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ └── segmentation_mask.py
│ └── utils
│ ├── c2_model_loading.py
│ ├── checkpoint.py #检查点
│ ├── __init__.py
│ ├── logger.py #日志设置
│ ├── model_zoo.py
│ ├── __pycache__
│ └── README.md
├── output #我自己设定的输出目录
├── tools
│ ├── test_net.py #验证入口
│ └── train_net.py #训练入口
└── TROUBLESHOOTING.md
这样一来数据集就准备好了。
这里涉及到的配置文件主要有3个:
模型配置文件在启动训练时由--config-file参数指定,在config子目录下默认提供了mask_rcnn和faster_rcnn框架不同骨干网的基于YAML格式的配置文件。我选用的是e2e_mask_rcnn_R_101_FPN_1x.yaml,也就是使用mask_rcnn检测模型,骨干网使用ResNet101-FPN,配置详情如下(根据自己的数据集作相应的调整):
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
WEIGHT: "catalog://ImageNetPretrained/MSRA/R-101"
BACKBONE:
CONV_BODY: "R-101-FPN"
OUT_CHANNELS: 256
RPN:
USE_FPN: True #是否使用FPN,也就是特征金字塔结构,选择True将在不同的特征图提取候选区域
ANCHOR_STRIDE: (4, 8, 16, 32, 64) #ANCHOR的步长
PRE_NMS_TOP_N_TRAIN: 2000 #训练时,NMS之前的候选区数量
PRE_NMS_TOP_N_TEST: 1000 #测试时,NMS之后的候选区数量
POST_NMS_TOP_N_TEST: 1000
FPN_POST_NMS_TOP_N_TEST: 1000
ROI_HEADS:
USE_FPN: True
ROI_BOX_HEAD:
POOLER_RESOLUTION: 7
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
POOLER_SAMPLING_RATIO: 2
FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
PREDICTOR: "FPNPredictor"
ROI_MASK_HEAD:
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor"
PREDICTOR: "MaskRCNNC4Predictor"
POOLER_RESOLUTION: 14
POOLER_SAMPLING_RATIO: 2
RESOLUTION: 28
SHARE_BOX_FEATURE_EXTRACTOR: False
MASK_ON: False #默认是True,我这里改为False,因为我没有用到语义分割的功能
DATASETS:
TRAIN: ("coco_2014_train",) #注意这里的训练集和测试集的名字,
TEST: ("coco_2014_val",) #它们和paths_catalog.py中DATASETS相对应
DATALOADER:
SIZE_DIVISIBILITY: 32
SOLVER:
BASE_LR: 0.01 #起始学习率,学习率的调整有多种策略,訪框架自定义了一种策略
WEIGHT_DECAY: 0.0001
#这是什么意思呢?是为了在不同的迭代区间进行学习率的调整而设定的.以我的数据集为例,
#我149898张图,计划是每4个epoch衰减一次,所以如下设置.
STEPS: (599592, 1199184)
MAX_ITER: 1300000 #最大迭代次数
看完模型配置文件,你再看看MaskRCNN-Benchmark框架默认配置文件(defaults.py)你就会发现有不少参数有重合。嘿嘿,阅读代码会发现defaults.py会合并模型配置文件中的参数,defaults.py顾名思义就是提供了默认的参数配置,如果模型配置文件中对訪参数有改动则以模型中的为准。当然还有更多的参数是模型配置文件中没有的,我这里对部分参数进行简单的说明。
import os
from yacs.config import CfgNode as CN
_C = CN()
_C.MODEL = CN()
_C.MODEL.RPN_ONLY = False
_C.MODEL.MASK_ON = False
_C.MODEL.DEVICE = "cuda"
_C.MODEL.META_ARCHITECTURE = "GeneralizedRCNN"
_C.MODEL.WEIGHT = ""
_C.INPUT = CN()
_C.INPUT.MIN_SIZE_TRAIN = 800 #训练集图片最小尺寸
_C.INPUT.MAX_SIZE_TRAIN = 1333 #训练集图片最大尺寸
_C.INPUT.MIN_SIZE_TEST = 800
_C.INPUT.MAX_SIZE_TEST = 1333
_C.INPUT.PIXEL_MEAN = [102.9801, 115.9465, 122.7717]
_C.INPUT.PIXEL_STD = [1., 1., 1.]
_C.INPUT.TO_BGR255 = True
_C.DATASETS = CN()
_C.DATASETS.TRAIN = () #在模型配置文件中已给出
_C.DATASETS.TEST = ()
_C.DATALOADER = CN()
_C.DATALOADER.NUM_WORKERS = 4 #数据生成启线程数
_C.DATALOADER.SIZE_DIVISIBILITY = 0
_C.DATALOADER.ASPECT_RATIO_GROUPING = True
_C.MODEL.BACKBONE = CN()
_C.MODEL.BACKBONE.CONV_BODY = "R-50-C4"
_C.MODEL.BACKBONE.FREEZE_CONV_BODY_AT = 2
_C.MODEL.BACKBONE.OUT_CHANNELS = 256 * 4
_C.MODEL.RPN = CN()
_C.MODEL.RPN.USE_FPN = False
_C.MODEL.RPN.ANCHOR_SIZES = (32, 64, 128, 256, 512)
_C.MODEL.RPN.ANCHOR_STRIDE = (16,)
_C.MODEL.RPN.ASPECT_RATIOS = (0.5, 1.0, 2.0)
_C.MODEL.RPN.STRADDLE_THRESH = 0
_C.MODEL.RPN.FG_IOU_THRESHOLD = 0.7
_C.MODEL.RPN.BG_IOU_THRESHOLD = 0.3
_C.MODEL.RPN.BATCH_SIZE_PER_IMAGE = 256
_C.MODEL.RPN.POSITIVE_FRACTION = 0.5
_C.MODEL.RPN.PRE_NMS_TOP_N_TRAIN = 12000
_C.MODEL.RPN.PRE_NMS_TOP_N_TEST = 6000
_C.MODEL.RPN.POST_NMS_TOP_N_TRAIN = 2000
_C.MODEL.RPN.POST_NMS_TOP_N_TEST = 1000
_C.MODEL.RPN.NMS_THRESH = 0.7
_C.MODEL.RPN.MIN_SIZE = 0
_C.MODEL.RPN.FPN_POST_NMS_TOP_N_TRAIN = 2000
_C.MODEL.RPN.FPN_POST_NMS_TOP_N_TEST = 2000
_C.MODEL.ROI_HEADS = CN()
_C.MODEL.ROI_HEADS.USE_FPN = False
_C.MODEL.ROI_HEADS.FG_IOU_THRESHOLD = 0.5
_C.MODEL.ROI_HEADS.BG_IOU_THRESHOLD = 0.5
_C.MODEL.ROI_HEADS.BBOX_REG_WEIGHTS = (10., 10., 5., 5.)
_C.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 512
_C.MODEL.ROI_HEADS.POSITIVE_FRACTION = 0.25
_C.MODEL.ROI_HEADS.SCORE_THRESH = 0.05
_C.MODEL.ROI_HEADS.NMS = 0.5
_C.MODEL.ROI_HEADS.DETECTIONS_PER_IMG = 100
_C.MODEL.ROI_BOX_HEAD = CN()
_C.MODEL.ROI_BOX_HEAD.FEATURE_EXTRACTOR = "ResNet50Conv5ROIFeatureExtractor"
_C.MODEL.ROI_BOX_HEAD.PREDICTOR = "FastRCNNPredictor"
_C.MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION = 14
_C.MODEL.ROI_BOX_HEAD.POOLER_SAMPLING_RATIO = 0
_C.MODEL.ROI_BOX_HEAD.POOLER_SCALES = (1.0 / 16,)
#数据集类别数,默认是81,因为coco数据集为80+1(背景),我的数据集只有4个类别,加上背景也就是5个类别
_C.MODEL.ROI_BOX_HEAD.NUM_CLASSES = 5
_C.MODEL.ROI_BOX_HEAD.MLP_HEAD_DIM = 1024
_C.MODEL.ROI_MASK_HEAD = CN()
_C.MODEL.ROI_MASK_HEAD.FEATURE_EXTRACTOR = "ResNet50Conv5ROIFeatureExtractor"
_C.MODEL.ROI_MASK_HEAD.PREDICTOR = "MaskRCNNC4Predictor"
_C.MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION = 14
_C.MODEL.ROI_MASK_HEAD.POOLER_SAMPLING_RATIO = 0
_C.MODEL.ROI_MASK_HEAD.POOLER_SCALES = (1.0 / 16,)
_C.MODEL.ROI_MASK_HEAD.MLP_HEAD_DIM = 1024
_C.MODEL.ROI_MASK_HEAD.CONV_LAYERS = (256, 256, 256, 256)
_C.MODEL.ROI_MASK_HEAD.RESOLUTION = 14
_C.MODEL.ROI_MASK_HEAD.SHARE_BOX_FEATURE_EXTRACTOR = True
_C.MODEL.RESNETS = CN()
_C.MODEL.RESNETS.NUM_GROUPS = 1
_C.MODEL.RESNETS.WIDTH_PER_GROUP = 64
_C.MODEL.RESNETS.STRIDE_IN_1X1 = True
_C.MODEL.RESNETS.TRANS_FUNC = "BottleneckWithFixedBatchNorm"
_C.MODEL.RESNETS.STEM_FUNC = "StemWithFixedBatchNorm"
_C.MODEL.RESNETS.RES5_DILATION = 1
_C.MODEL.RESNETS.RES2_OUT_CHANNELS = 256
_C.MODEL.RESNETS.STEM_OUT_CHANNELS = 64
_C.SOLVER = CN()
_C.SOLVER.MAX_ITER = 40000 #最大迭代次数
_C.SOLVER.BASE_LR = 0.02 #初始学习率,这个通常在模型配置文件中有设置
_C.SOLVER.BIAS_LR_FACTOR = 2
_C.SOLVER.MOMENTUM = 0.9
_C.SOLVER.WEIGHT_DECAY = 0.0005
_C.SOLVER.WEIGHT_DECAY_BIAS = 0
_C.SOLVER.GAMMA = 0.1
_C.SOLVER.STEPS = (30000,)
_C.SOLVER.WARMUP_FACTOR = 1.0 / 3
_C.SOLVER.WARMUP_ITERS = 500 #预热迭代次数,预热迭代次数内(小于訪值)的学习率比较低
_C.SOLVER.WARMUP_METHOD = "constant" #预热策略,有'constant'和'linear'两种
_C.SOLVER.CHECKPOINT_PERIOD = 2000 #生成检查点(checkpoint)的步长
_C.SOLVER.IMS_PER_BATCH = 1 #一个batch包含的图片数量
_C.TEST = CN()
_C.TEST.EXPECTED_RESULTS = []
_C.TEST.EXPECTED_RESULTS_SIGMA_TOL = 4
_C.TEST.IMS_PER_BATCH = 1
_C.OUTPUT_DIR = "output" #主要作为checkpoint和inference的输出目录
_C.PATHS_CATALOG = os.path.join(os.path.dirname(__file__), "paths_catalog.py")
关于path_catalog其实最重要的就是DatasetCatalog这个类。
class DatasetCatalog(object):
DATA_DIR = "datasets"
DATASETS = {
"coco_2014_train": (
"coco/train2014", #这里是訪数据集的主目录,称其为root,訪root会和标注文件中images字段中的file_name指定的路径进行拼接得到图片的完整路径
"coco/annotations/instances_train2014.json", # 标注文件路径
),
"coco_2014_val": (
"coco/val2014", #同上
"coco/annotations/instances_val2014.json" #同上
),
}
@staticmethod
def get(name):
if "coco" in name: #e.g. "coco_2014_train"
data_dir = DatasetCatalog.DATA_DIR
attrs = DatasetCatalog.DATASETS[name]
args = dict(
root=os.path.join(data_dir, attrs[0]),
ann_file=os.path.join(data_dir, attrs[1]),
)
return dict(
factory="COCODataset",
args=args,
)
raise RuntimeError("Dataset not available: {}".format(name))
#进入maskrcnn-benchmark目录下,激活maskrcnn_benchmark虚拟环境
[zuosi@localhost]$ cd maskrcnn-benchmark
[zuosi@maskrcnn-benchmark]$ source activate maskrcnn_benchmark
#指定模型配置文件,执行训练启动脚本
(maskrcnn_benchmark) [zuosi@maskrcnn-benchmark]$python tools/train_net.py --config-file configs/adas_e2e_mask_rcnn_R_101_FPN_1x.yaml
#win10
python tools/train_net.py --config-file configs/e2e_faster_rcnn_R_101_FPN_1x.yaml
每隔规定的迭代次数(我设置的是200)会打印训练中间信息,主要是损失值。
2018-11-09 14:40:22,020 maskrcnn_benchmark.trainer INFO: Start training
2018-11-09 14:42:00,113 maskrcnn_benchmark.trainer INFO: eta: 17:35:44 iter: 200 loss: 0.1553 (0.3598) loss_classifier: 0.0728 (0.1902) loss_box_reg: 0.0764 (0.1221) loss_objectness: 0.0110 (0.0392) loss_rpn_box_reg: 0.0028 (0.0083) time: 0.4775 (0.4880) data: 0.0027 (0.0105) avg_loss: 0.3616 (0.3616) lr: 0.003333 max mem: 3629
2018-11-09 14:43:37,005 maskrcnn_benchmark.trainer INFO: eta: 17:30:17 iter: 400 loss: 0.2033 (0.3071) loss_classifier: 0.1271 (0.1587) loss_box_reg: 0.0883 (0.1162) loss_objectness: 0.0033 (0.0244) loss_rpn_box_reg: 0.0049 (0.0078) time: 0.4763 (0.4862) data: 0.0029 (0.0068) avg_loss: 0.2541 (0.3078) lr: 0.003333 max mem: 3629
2018-11-09 14:45:13,014 maskrcnn_benchmark.trainer INFO: eta: 17:24:13 iter: 600 loss: 0.3123 (0.2915) loss_classifier: 0.1296 (0.1511) loss_box_reg: 0.1310 (0.1127) loss_objectness: 0.0090 (0.0197) loss_rpn_box_reg: 0.0086 (0.0080) time: 0.4613 (0.4842) data: 0.0028 (0.0056) avg_loss: 0.2604 (0.2920) lr: 0.010000 max mem: 3629
2018-11-09 14:46:48,015 maskrcnn_benchmark.trainer INFO: eta: 17:17:40 iter: 800 loss: 0.3133 (0.2929) loss_classifier: 0.1620 (0.1534) loss_box_reg: 0.1227 (0.1121) loss_objectness: 0.0067 (0.0189) loss_rpn_box_reg: 0.0075 (0.0084) time: 0.4625 (0.4819) data: 0.0029 (0.0049) avg_loss: 0.2604 (0.2932) lr: 0.010000 max mem: 3629
2018-11-09 14:48:24,037 maskrcnn_benchmark.trainer INFO: eta: 17:15:17 iter: 1000 loss: 0.2165 (0.2952) loss_classifier: 0.1061 (0.1554) loss_box_reg: 0.0781 (0.1148) loss_objectness: 0.0037 (0.0167) loss_rpn_box_reg: 0.0047 (0.0082) time: 0.4688 (0.4815) data: 0.0031 (0.0046) avg_loss: 0.2968 (0.2955) lr: 0.010000 max mem: 3629
....省略若干....
2018-11-10 12:59:40,231 maskrcnn_benchmark.trainer INFO: eta: 4 days, 0:48:47 iter: 230600 loss: 0.0727 (0.0878) loss_classifier: 0.0355 (0.0466) loss_box_reg: 0.0321 (0.0369) loss_objectness: 0.0002 (0.0018) loss_rpn_box_reg: 0.0017 (0.0026) time: 0.6915 (0.3259) data: 0.0041 (0.0033) avg_loss: 0.0849 (0.0877) lr: 0.010000 max mem: 3626
2018-11-10 13:01:57,302 maskrcnn_benchmark.trainer INFO: eta: 4 days, 0:56:11 iter: 230800 loss: 0.0767 (0.0878) loss_classifier: 0.0388 (0.0466) loss_box_reg: 0.0275 (0.0368) loss_objectness: 0.0002 (0.0018) loss_rpn_box_reg: 0.0022 (0.0026) time: 0.6475 (0.3264) data: 0.0040 (0.0033) avg_loss: 0.0849 (0.0877) lr: 0.010000 max mem: 3626
2018-11-10 13:04:13,533 maskrcnn_benchmark.trainer INFO: eta: 4 days, 1:03:28 iter: 231000 loss: 0.0705 (0.0878) loss_classifier: 0.0338 (0.0466) loss_box_reg: 0.0350 (0.0368) loss_objectness: 0.0004 (0.0018) loss_rpn_box_reg: 0.0023 (0.0026) time: 0.7095 (0.3269) data: 0.0038 (0.0033) avg_loss: 0.0849 (0.0877) lr: 0.010000 max mem: 3626
2018-11-10 13:06:31,076 maskrcnn_benchmark.trainer INFO: eta: 4 days, 1:10:53 iter: 231200 loss: 0.0825 (0.0878) loss_classifier: 0.0428 (0.0466) loss_box_reg: 0.0383 (0.0368) loss_objectness: 0.0001 (0.0018) loss_rpn_box_reg: 0.0018 (0.0026) time: 0.7105 (0.3273) data: 0.0042 (0.0033) avg_loss: 0.0849 (0.0877) lr: 0.010000 max mem: 3626
注意观察发现,在预热阶段,也就是前500次迭代内,虽然我初始学习率是设置的0.1,但是因为预热策略的原因,学习率调整为0.003333,而500次之后学习率恢复到0.01。训练的平均损失(200次迭代内的平均损失)由开始的0.3616降到0.0849。当然到此训练还没有完结,我跑一次验证看一下效果。
#指定模型配置文件,执行测试启动脚本
(maskrcnn_benchmark) [zuosi@maskrcnn-benchmark]$python tools/test_net.py --config-file configs/adas_e2e_mask_rcnn_R_101_FPN_1x.yaml
验证结果:
Loading and preparing results...
DONE (t=0.07s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
DONE (t=2.19s).
Accumulating evaluation results...
DONE (t=0.61s).
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.581
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.901
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.704
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.315
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.602
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.660
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.672
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.672
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.485
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.687
2018-11-12 10:09:53,659 maskrcnn_benchmark.inference INFO: OrderedDict([('bbox', OrderedDict([('AP', 0.5814026956555445), ('AP50', 0.9011506516649963), ('AP75', 0.7036490447010381), ('APs', -1.0), ('APm', 0.315219783930203), ('APl', 0.601876363241837)]))])