Upload folder using huggingface_hub
Browse files
mmdets/bbox/mmdet_anime-face_yolov3.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:38208bb6b8a4633193feba532e96ed9a7942129af8fe948b27bfcf8e9a30a12e
|
| 3 |
+
size 246462357
|
mmdets/bbox/mmdet_anime-face_yolov3.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# _base_ = ["../_base_/schedules/schedule_1x.py", "../_base_/default_runtime.py"]
|
| 2 |
+
# model settings
|
| 3 |
+
data_preprocessor = dict(
|
| 4 |
+
type="DetDataPreprocessor",
|
| 5 |
+
mean=[0, 0, 0],
|
| 6 |
+
std=[255.0, 255.0, 255.0],
|
| 7 |
+
bgr_to_rgb=True,
|
| 8 |
+
pad_size_divisor=32,
|
| 9 |
+
)
|
| 10 |
+
model = dict(
|
| 11 |
+
type="YOLOV3",
|
| 12 |
+
data_preprocessor=data_preprocessor,
|
| 13 |
+
backbone=dict(
|
| 14 |
+
type="Darknet",
|
| 15 |
+
depth=53,
|
| 16 |
+
out_indices=(3, 4, 5),
|
| 17 |
+
init_cfg=dict(type="Pretrained", checkpoint="open-mmlab://darknet53"),
|
| 18 |
+
),
|
| 19 |
+
neck=dict(
|
| 20 |
+
type="YOLOV3Neck",
|
| 21 |
+
num_scales=3,
|
| 22 |
+
in_channels=[1024, 512, 256],
|
| 23 |
+
out_channels=[512, 256, 128],
|
| 24 |
+
),
|
| 25 |
+
bbox_head=dict(
|
| 26 |
+
type="YOLOV3Head",
|
| 27 |
+
num_classes=1,
|
| 28 |
+
in_channels=[512, 256, 128],
|
| 29 |
+
out_channels=[1024, 512, 256],
|
| 30 |
+
anchor_generator=dict(
|
| 31 |
+
type="YOLOAnchorGenerator",
|
| 32 |
+
base_sizes=[
|
| 33 |
+
[(116, 90), (156, 198), (373, 326)],
|
| 34 |
+
[(30, 61), (62, 45), (59, 119)],
|
| 35 |
+
[(10, 13), (16, 30), (33, 23)],
|
| 36 |
+
],
|
| 37 |
+
strides=[32, 16, 8],
|
| 38 |
+
),
|
| 39 |
+
bbox_coder=dict(type="YOLOBBoxCoder"),
|
| 40 |
+
featmap_strides=[32, 16, 8],
|
| 41 |
+
loss_cls=dict(
|
| 42 |
+
type="CrossEntropyLoss", use_sigmoid=True, loss_weight=1.0, reduction="sum"
|
| 43 |
+
),
|
| 44 |
+
loss_conf=dict(
|
| 45 |
+
type="CrossEntropyLoss", use_sigmoid=True, loss_weight=1.0, reduction="sum"
|
| 46 |
+
),
|
| 47 |
+
loss_xy=dict(
|
| 48 |
+
type="CrossEntropyLoss", use_sigmoid=True, loss_weight=2.0, reduction="sum"
|
| 49 |
+
),
|
| 50 |
+
loss_wh=dict(type="MSELoss", loss_weight=2.0, reduction="sum"),
|
| 51 |
+
),
|
| 52 |
+
# training and testing settings
|
| 53 |
+
train_cfg=dict(
|
| 54 |
+
assigner=dict(
|
| 55 |
+
type="GridAssigner", pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0
|
| 56 |
+
)
|
| 57 |
+
),
|
| 58 |
+
test_cfg=dict(
|
| 59 |
+
nms_pre=1000,
|
| 60 |
+
min_bbox_size=0,
|
| 61 |
+
score_thr=0.05,
|
| 62 |
+
conf_thr=0.005,
|
| 63 |
+
nms=dict(type="nms", iou_threshold=0.45),
|
| 64 |
+
max_per_img=100,
|
| 65 |
+
),
|
| 66 |
+
)
|
| 67 |
+
# dataset settings
|
| 68 |
+
dataset_type = "CocoDataset"
|
| 69 |
+
data_root = "data/coco/"
|
| 70 |
+
|
| 71 |
+
# Example to use different file client
|
| 72 |
+
# Method 1: simply set the data root and let the file I/O module
|
| 73 |
+
# automatically infer from prefix (not support LMDB and Memcache yet)
|
| 74 |
+
|
| 75 |
+
# data_root = 's3://openmmlab/datasets/detection/coco/'
|
| 76 |
+
|
| 77 |
+
# Method 2: Use `backend_args`, `file_client_args` in versions before 3.0.0rc6
|
| 78 |
+
# backend_args = dict(
|
| 79 |
+
# backend='petrel',
|
| 80 |
+
# path_mapping=dict({
|
| 81 |
+
# './data/': 's3://openmmlab/datasets/detection/',
|
| 82 |
+
# 'data/': 's3://openmmlab/datasets/detection/'
|
| 83 |
+
# }))
|
| 84 |
+
backend_args = None
|
| 85 |
+
|
| 86 |
+
train_pipeline = [
|
| 87 |
+
dict(type="LoadImageFromFile", backend_args=backend_args),
|
| 88 |
+
dict(type="LoadAnnotations", with_bbox=True),
|
| 89 |
+
dict(
|
| 90 |
+
type="Expand",
|
| 91 |
+
mean=data_preprocessor["mean"],
|
| 92 |
+
to_rgb=data_preprocessor["bgr_to_rgb"],
|
| 93 |
+
ratio_range=(1, 2),
|
| 94 |
+
),
|
| 95 |
+
dict(
|
| 96 |
+
type="MinIoURandomCrop",
|
| 97 |
+
min_ious=(0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
| 98 |
+
min_crop_size=0.3,
|
| 99 |
+
),
|
| 100 |
+
dict(type="RandomResize", scale=[(320, 320), (608, 608)], keep_ratio=True),
|
| 101 |
+
dict(type="RandomFlip", prob=0.5),
|
| 102 |
+
dict(type="PhotoMetricDistortion"),
|
| 103 |
+
dict(type="PackDetInputs"),
|
| 104 |
+
]
|
| 105 |
+
test_pipeline = [
|
| 106 |
+
dict(type="LoadImageFromFile", backend_args=backend_args),
|
| 107 |
+
dict(type="Resize", scale=(608, 608), keep_ratio=True),
|
| 108 |
+
dict(type="LoadAnnotations", with_bbox=True),
|
| 109 |
+
dict(
|
| 110 |
+
type="PackDetInputs",
|
| 111 |
+
meta_keys=("img_id", "img_path", "ori_shape", "img_shape", "scale_factor"),
|
| 112 |
+
),
|
| 113 |
+
]
|
| 114 |
+
|
| 115 |
+
train_dataloader = dict(
|
| 116 |
+
batch_size=8,
|
| 117 |
+
num_workers=4,
|
| 118 |
+
persistent_workers=True,
|
| 119 |
+
sampler=dict(type="DefaultSampler", shuffle=True),
|
| 120 |
+
batch_sampler=dict(type="AspectRatioBatchSampler"),
|
| 121 |
+
dataset=dict(
|
| 122 |
+
type=dataset_type,
|
| 123 |
+
data_root=data_root,
|
| 124 |
+
ann_file="annotations/instances_train2017.json",
|
| 125 |
+
data_prefix=dict(img="train2017/"),
|
| 126 |
+
filter_cfg=dict(filter_empty_gt=True, min_size=32),
|
| 127 |
+
pipeline=train_pipeline,
|
| 128 |
+
backend_args=backend_args,
|
| 129 |
+
),
|
| 130 |
+
)
|
| 131 |
+
val_dataloader = dict(
|
| 132 |
+
batch_size=1,
|
| 133 |
+
num_workers=2,
|
| 134 |
+
persistent_workers=True,
|
| 135 |
+
drop_last=False,
|
| 136 |
+
sampler=dict(type="DefaultSampler", shuffle=False),
|
| 137 |
+
dataset=dict(
|
| 138 |
+
type=dataset_type,
|
| 139 |
+
data_root=data_root,
|
| 140 |
+
ann_file="annotations/instances_val2017.json",
|
| 141 |
+
data_prefix=dict(img="val2017/"),
|
| 142 |
+
test_mode=True,
|
| 143 |
+
pipeline=test_pipeline,
|
| 144 |
+
backend_args=backend_args,
|
| 145 |
+
),
|
| 146 |
+
)
|
| 147 |
+
test_dataloader = val_dataloader
|
| 148 |
+
|
| 149 |
+
val_evaluator = dict(
|
| 150 |
+
type="CocoMetric",
|
| 151 |
+
ann_file=data_root + "annotations/instances_val2017.json",
|
| 152 |
+
metric="bbox",
|
| 153 |
+
backend_args=backend_args,
|
| 154 |
+
)
|
| 155 |
+
test_evaluator = val_evaluator
|
| 156 |
+
|
| 157 |
+
train_cfg = dict(max_epochs=273, val_interval=7)
|
| 158 |
+
|
| 159 |
+
# optimizer
|
| 160 |
+
optim_wrapper = dict(
|
| 161 |
+
type="OptimWrapper",
|
| 162 |
+
optimizer=dict(type="SGD", lr=0.001, momentum=0.9, weight_decay=0.0005),
|
| 163 |
+
clip_grad=dict(max_norm=35, norm_type=2),
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
# learning policy
|
| 167 |
+
param_scheduler = [
|
| 168 |
+
dict(type="LinearLR", start_factor=0.1, by_epoch=False, begin=0, end=2000),
|
| 169 |
+
dict(type="MultiStepLR", by_epoch=True, milestones=[218, 246], gamma=0.1),
|
| 170 |
+
]
|
| 171 |
+
|
| 172 |
+
default_hooks = dict(checkpoint=dict(type="CheckpointHook", interval=7))
|
| 173 |
+
|
| 174 |
+
# NOTE: `auto_scale_lr` is for automatically scaling LR,
|
| 175 |
+
# USER SHOULD NOT CHANGE ITS VALUES.
|
| 176 |
+
# base_batch_size = (8 GPUs) x (8 samples per GPU)
|
| 177 |
+
auto_scale_lr = dict(base_batch_size=64)
|