yolov3 详解
目录
- paper
- 网络结构图
- 数据处理
- Default anchors
- Loss
- Function Loss
- Reference
paper
https://arxiv.org/pdf/1804.02767v1.pdf
网络结构图
性能上远超Darknet-19,但在效率上同样优于ResNet-101和ResNet-152。下表是在ImageNet上的实验结果:
网络详细结构图:
网络简版结构图:
数据处理
train_pipeline = [
dict(type='LoadImageFromFile', to_float32=True),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='ZeroOneNormalize'),
dict(type='RandomJitter', jitter=(0.3, 0.3), img_scale=(1440, 864)),
dict(type='RandomDistort', hue=0.1, saturation=1.5, exposure=1.5),
dict(type='RandomTransform', img_scale=(1440, 864)),
dict(type='RandomFlipCv2', flip_code=[1]),
dict(type='NormalizeCoord', cxcywh=True),
dict(type='DefaultFormatBundle'),
dict(type='ParametersSetting', tensor=True),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]
Default anchors
通过IOU与Kmean计算训练样本中9个anchors, anchors_generate.py
Loss
Function Loss
- total loss:
- build target
- 计算当前层的每个anchor 与 target 之间的IOU,并取得最大的IOU对应的anchor的index
- 过滤因为数据增强带来的bbox的越界, 找到best_index
- 计算object weight scale. (sc = 2 - gw * gh)
- 由best_index计算最佳的anchor对应的target, (obj_mask, noobj_mask, tx, ty, tw, th, tconf, tcls, scale)
- 正负样本选择:
- 用预测出来的
predict box(pb)
与target box(tb)
做一个IOU匹配, - 找到
pb
对应tb
的最大iou
, 如果这个iou
小于ignore_thresh
就被当做负样本
- 用预测出来的
- Loss计算
location: 使用mse loss, 乘上一个object weight scale(sc)
conf_obj and conf_noobj 使用 mse loss(均方差)
classify loss 使用ce loss(交叉熵)
- Location Loss