first commit
Browse files
work_dirs/yolo3/yolov3.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:407e9e50f6014623e0ccbf216175b730ca353a60f13ebf87027dbb24a2021ffa
|
| 3 |
+
size 493184217
|
work_dirs/yolo3/yolov3_d53_mstrain-608_273e_coco.py
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
_base_ = '../_base_/default_runtime.py'
|
| 2 |
+
# model settings
|
| 3 |
+
model = dict(
|
| 4 |
+
type='YOLOV3',
|
| 5 |
+
backbone=dict(
|
| 6 |
+
type='Darknet',
|
| 7 |
+
depth=53,
|
| 8 |
+
out_indices=(3, 4, 5),
|
| 9 |
+
init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://darknet53')),
|
| 10 |
+
neck=dict(
|
| 11 |
+
type='YOLOV3Neck',
|
| 12 |
+
num_scales=3,
|
| 13 |
+
in_channels=[1024, 512, 256],
|
| 14 |
+
out_channels=[512, 256, 128]),
|
| 15 |
+
bbox_head=dict(
|
| 16 |
+
type='YOLOV3Head',
|
| 17 |
+
num_classes=14,
|
| 18 |
+
in_channels=[512, 256, 128],
|
| 19 |
+
out_channels=[1024, 512, 256],
|
| 20 |
+
anchor_generator=dict(
|
| 21 |
+
type='YOLOAnchorGenerator',
|
| 22 |
+
base_sizes=[[(116, 90), (156, 198), (373, 326)],
|
| 23 |
+
[(30, 61), (62, 45), (59, 119)],
|
| 24 |
+
[(10, 13), (16, 30), (33, 23)]],
|
| 25 |
+
strides=[32, 16, 8]),
|
| 26 |
+
bbox_coder=dict(type='YOLOBBoxCoder'),
|
| 27 |
+
featmap_strides=[32, 16, 8],
|
| 28 |
+
loss_cls=dict(
|
| 29 |
+
type='CrossEntropyLoss',
|
| 30 |
+
use_sigmoid=True,
|
| 31 |
+
loss_weight=1.0,
|
| 32 |
+
reduction='sum'),
|
| 33 |
+
loss_conf=dict(
|
| 34 |
+
type='CrossEntropyLoss',
|
| 35 |
+
use_sigmoid=True,
|
| 36 |
+
loss_weight=1.0,
|
| 37 |
+
reduction='sum'),
|
| 38 |
+
loss_xy=dict(
|
| 39 |
+
type='CrossEntropyLoss',
|
| 40 |
+
use_sigmoid=True,
|
| 41 |
+
loss_weight=2.0,
|
| 42 |
+
reduction='sum'),
|
| 43 |
+
loss_wh=dict(type='MSELoss', loss_weight=2.0, reduction='sum')),
|
| 44 |
+
# training and testing settings
|
| 45 |
+
train_cfg=dict(
|
| 46 |
+
assigner=dict(
|
| 47 |
+
type='GridAssigner',
|
| 48 |
+
pos_iou_thr=0.5,
|
| 49 |
+
neg_iou_thr=0.5,
|
| 50 |
+
min_pos_iou=0)),
|
| 51 |
+
test_cfg=dict(
|
| 52 |
+
nms_pre=1000,
|
| 53 |
+
min_bbox_size=0,
|
| 54 |
+
score_thr=0.05,
|
| 55 |
+
conf_thr=0.005,
|
| 56 |
+
nms=dict(type='nms', iou_threshold=0.45),
|
| 57 |
+
max_per_img=100))
|
| 58 |
+
# dataset settings
|
| 59 |
+
data_root = './'
|
| 60 |
+
work_dir = './result/yolov3'
|
| 61 |
+
load_from = 'result/yolov3/latest.pth'
|
| 62 |
+
resume_from = 'result/yolov3/latest.pth'
|
| 63 |
+
img_norm_cfg = dict(mean=[0, 0, 0], std=[255., 255., 255.], to_rgb=True)
|
| 64 |
+
train_pipeline = [
|
| 65 |
+
dict(type='LoadImageFromFile', to_float32=True),
|
| 66 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 67 |
+
dict(
|
| 68 |
+
type='Expand',
|
| 69 |
+
mean=img_norm_cfg['mean'],
|
| 70 |
+
to_rgb=img_norm_cfg['to_rgb'],
|
| 71 |
+
ratio_range=(1, 2)),
|
| 72 |
+
dict(
|
| 73 |
+
type='MinIoURandomCrop',
|
| 74 |
+
min_ious=(0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
| 75 |
+
min_crop_size=0.3),
|
| 76 |
+
dict(type='Resize', img_scale=[(320, 320), (608, 608)], keep_ratio=True),
|
| 77 |
+
dict(type='RandomFlip', flip_ratio=0.5),
|
| 78 |
+
dict(type='PhotoMetricDistortion'),
|
| 79 |
+
dict(type='Normalize', **img_norm_cfg),
|
| 80 |
+
dict(type='Pad', size_divisor=32),
|
| 81 |
+
dict(type='DefaultFormatBundle'),
|
| 82 |
+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
|
| 83 |
+
]
|
| 84 |
+
test_pipeline = [
|
| 85 |
+
dict(type='LoadImageFromFile'),
|
| 86 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 87 |
+
dict(
|
| 88 |
+
type='MultiScaleFlipAug',
|
| 89 |
+
img_scale=(608, 608),
|
| 90 |
+
flip=False,
|
| 91 |
+
transforms=[
|
| 92 |
+
dict(type='Resize', keep_ratio=True),
|
| 93 |
+
dict(type='RandomFlip'),
|
| 94 |
+
dict(type='Normalize', **img_norm_cfg),
|
| 95 |
+
dict(type='Pad', size_divisor=32),
|
| 96 |
+
dict(type='ImageToTensor', keys=['img']),
|
| 97 |
+
dict(type='Collect', keys=['img'])
|
| 98 |
+
])
|
| 99 |
+
]
|
| 100 |
+
classes = ('person bev', 'car bev', 'van bev', 'bus bev', 'truck bev','aeroplane','train' , 'bird', 'boat', 'car', 'person', 'bus', 'truck','camouflage man')
|
| 101 |
+
|
| 102 |
+
data = dict(
|
| 103 |
+
samples_per_gpu=8,
|
| 104 |
+
workers_per_gpu=4,
|
| 105 |
+
train=dict(
|
| 106 |
+
|
| 107 |
+
classes=classes,
|
| 108 |
+
ann_file='./final_train_dataset/label/train_final_with_js.json',
|
| 109 |
+
img_prefix='./final_train_dataset/images',
|
| 110 |
+
pipeline=train_pipeline),
|
| 111 |
+
val=dict(
|
| 112 |
+
|
| 113 |
+
classes=classes,
|
| 114 |
+
ann_file='./final_train_dataset/label/val_final_with_js.json',
|
| 115 |
+
img_prefix='./final_train_dataset/images',
|
| 116 |
+
|
| 117 |
+
pipeline=test_pipeline),
|
| 118 |
+
test=dict(
|
| 119 |
+
|
| 120 |
+
classes=classes,
|
| 121 |
+
ann_file='./final_train_dataset/label/val_final_with_js.json',
|
| 122 |
+
img_prefix='./final_train_dataset/images',
|
| 123 |
+
|
| 124 |
+
pipeline=test_pipeline))
|
| 125 |
+
# optimizer
|
| 126 |
+
optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0005)
|
| 127 |
+
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
|
| 128 |
+
# learning policy
|
| 129 |
+
lr_config = dict(
|
| 130 |
+
policy='step',
|
| 131 |
+
warmup='linear',
|
| 132 |
+
warmup_iters=2000, # same as burn-in in darknet
|
| 133 |
+
warmup_ratio=0.1,
|
| 134 |
+
step=[218, 246])
|
| 135 |
+
# runtime settings
|
| 136 |
+
# checkpoint resumed from 273
|
| 137 |
+
runner = dict(type='EpochBasedRunner', max_epochs=300)
|
| 138 |
+
evaluation = dict(interval=10, metric=['bbox'])
|
| 139 |
+
|
| 140 |
+
log_config = dict(interval=100)
|
| 141 |
+
checkpoint_config = dict(interval=10)
|
| 142 |
+
|
| 143 |
+
seed = 0
|
| 144 |
+
gpu_ids = range(1)
|