Upload 2 files
Browse files- checkpoint.pth +3 -0
- model_config.py +623 -0
checkpoint.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aef812b0e37faf7ce1f27e1874c37bf7a429ba7716c962bb022ce8f48851f772
|
| 3 |
+
size 1545901561
|
model_config.py
ADDED
|
@@ -0,0 +1,623 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 7 |
+
num_heads=[3, 6, 12, 24],
|
| 8 |
+
window_size=7,
|
| 9 |
+
mlp_ratio=4,
|
| 10 |
+
qkv_bias=True,
|
| 11 |
+
qk_scale=None,
|
| 12 |
+
drop_rate=0.0,
|
| 13 |
+
attn_drop_rate=0.0,
|
| 14 |
+
drop_path_rate=0.2,
|
| 15 |
+
patch_norm=True,
|
| 16 |
+
out_indices=(0, 1, 2, 3),
|
| 17 |
+
with_cp=False,
|
| 18 |
+
convert_weights=True,
|
| 19 |
+
init_cfg=dict(
|
| 20 |
+
type="Pretrained",
|
| 21 |
+
checkpoint="https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth",
|
| 22 |
+
),
|
| 23 |
+
),
|
| 24 |
+
neck=dict(
|
| 25 |
+
type="FPN", in_channels=[96, 192, 384, 768], out_channels=256, num_outs=5
|
| 26 |
+
),
|
| 27 |
+
rpn_head=dict(
|
| 28 |
+
type="RPNHead",
|
| 29 |
+
in_channels=256,
|
| 30 |
+
feat_channels=256,
|
| 31 |
+
anchor_generator=dict(
|
| 32 |
+
type="AnchorGenerator",
|
| 33 |
+
scales=[8],
|
| 34 |
+
ratios=[0.5, 1.0, 2.0],
|
| 35 |
+
strides=[4, 8, 16, 32, 64],
|
| 36 |
+
),
|
| 37 |
+
bbox_coder=dict(
|
| 38 |
+
type="DeltaXYWHBBoxCoder",
|
| 39 |
+
target_means=[0.0, 0.0, 0.0, 0.0],
|
| 40 |
+
target_stds=[1.0, 1.0, 1.0, 1.0],
|
| 41 |
+
),
|
| 42 |
+
loss_cls=dict(type="CrossEntropyLoss", use_sigmoid=True, loss_weight=1.0),
|
| 43 |
+
loss_bbox=dict(type="SmoothL1Loss", beta=0.1111111111111111, loss_weight=1.0),
|
| 44 |
+
),
|
| 45 |
+
roi_head=dict(
|
| 46 |
+
type="CascadeRoIHead_LGF",
|
| 47 |
+
num_stages=3,
|
| 48 |
+
stage_loss_weights=[1, 1, 0.5],
|
| 49 |
+
bbox_roi_extractor=dict(
|
| 50 |
+
type="SingleRoIExtractor",
|
| 51 |
+
roi_layer=dict(type="RoIAlign", output_size=7, sampling_ratio=0),
|
| 52 |
+
out_channels=256,
|
| 53 |
+
featmap_strides=[4, 8, 16, 32],
|
| 54 |
+
),
|
| 55 |
+
bbox_head=[
|
| 56 |
+
dict(
|
| 57 |
+
type="Shared3FCBBoxHead_with_BboxEncoding",
|
| 58 |
+
in_channels=256,
|
| 59 |
+
fc_out_channels=1024,
|
| 60 |
+
bbox_encoding_dim=512,
|
| 61 |
+
roi_feat_size=7,
|
| 62 |
+
num_classes=18,
|
| 63 |
+
bbox_coder=dict(
|
| 64 |
+
type="DeltaXYWHBBoxCoder",
|
| 65 |
+
target_means=[0.0, 0.0, 0.0, 0.0],
|
| 66 |
+
target_stds=[0.1, 0.1, 0.2, 0.2],
|
| 67 |
+
),
|
| 68 |
+
reg_class_agnostic=True,
|
| 69 |
+
loss_cls=dict(type="FocalLoss"),
|
| 70 |
+
loss_bbox=dict(type="BalancedL1Loss", beta=1.0, loss_weight=1.0),
|
| 71 |
+
),
|
| 72 |
+
dict(
|
| 73 |
+
type="Shared3FCBBoxHead_with_BboxEncoding",
|
| 74 |
+
in_channels=256,
|
| 75 |
+
fc_out_channels=1024,
|
| 76 |
+
bbox_encoding_dim=512,
|
| 77 |
+
roi_feat_size=7,
|
| 78 |
+
num_classes=18,
|
| 79 |
+
bbox_coder=dict(
|
| 80 |
+
type="DeltaXYWHBBoxCoder",
|
| 81 |
+
target_means=[0.0, 0.0, 0.0, 0.0],
|
| 82 |
+
target_stds=[0.05, 0.05, 0.1, 0.1],
|
| 83 |
+
),
|
| 84 |
+
reg_class_agnostic=True,
|
| 85 |
+
loss_cls=dict(type="FocalLoss"),
|
| 86 |
+
loss_bbox=dict(type="BalancedL1Loss", beta=1.0, loss_weight=1.0),
|
| 87 |
+
),
|
| 88 |
+
dict(
|
| 89 |
+
type="Shared3FCBBoxHead_with_BboxEncoding",
|
| 90 |
+
in_channels=256,
|
| 91 |
+
fc_out_channels=1024,
|
| 92 |
+
bbox_encoding_dim=512,
|
| 93 |
+
roi_feat_size=7,
|
| 94 |
+
num_classes=18,
|
| 95 |
+
bbox_coder=dict(
|
| 96 |
+
type="DeltaXYWHBBoxCoder",
|
| 97 |
+
target_means=[0.0, 0.0, 0.0, 0.0],
|
| 98 |
+
target_stds=[0.033, 0.033, 0.067, 0.067],
|
| 99 |
+
),
|
| 100 |
+
reg_class_agnostic=True,
|
| 101 |
+
loss_cls=dict(type="FocalLoss"),
|
| 102 |
+
loss_bbox=dict(type="BalancedL1Loss", beta=1.0, loss_weight=1.0),
|
| 103 |
+
),
|
| 104 |
+
],
|
| 105 |
+
localglobal_fuser=dict(
|
| 106 |
+
type="LocalGlobal_Context_Fuser",
|
| 107 |
+
channels=256,
|
| 108 |
+
roi_size=7,
|
| 109 |
+
reduced_channels=256,
|
| 110 |
+
lg_merge_layer=dict(type="SELayer", channels=256),
|
| 111 |
+
),
|
| 112 |
+
lgf_shared=False,
|
| 113 |
+
bbox_encoder=dict(
|
| 114 |
+
type="BboxEncoder",
|
| 115 |
+
n_layer=4,
|
| 116 |
+
n_head=4,
|
| 117 |
+
n_embd=512,
|
| 118 |
+
bbox_cord_dim=4,
|
| 119 |
+
bbox_max_num=1024,
|
| 120 |
+
embd_pdrop=0.1,
|
| 121 |
+
attn_pdrop=0.1,
|
| 122 |
+
),
|
| 123 |
+
bbox_encoder_shared=False,
|
| 124 |
+
),
|
| 125 |
+
train_cfg=dict(
|
| 126 |
+
rpn=dict(
|
| 127 |
+
assigner=dict(
|
| 128 |
+
type="MaxIoUAssigner",
|
| 129 |
+
pos_iou_thr=0.7,
|
| 130 |
+
neg_iou_thr=0.3,
|
| 131 |
+
min_pos_iou=0.3,
|
| 132 |
+
match_low_quality=True,
|
| 133 |
+
ignore_iof_thr=-1,
|
| 134 |
+
),
|
| 135 |
+
sampler=dict(
|
| 136 |
+
type="RandomSampler",
|
| 137 |
+
num=256,
|
| 138 |
+
pos_fraction=0.5,
|
| 139 |
+
neg_pos_ub=-1,
|
| 140 |
+
add_gt_as_proposals=False,
|
| 141 |
+
),
|
| 142 |
+
allowed_border=0,
|
| 143 |
+
pos_weight=-1,
|
| 144 |
+
debug=False,
|
| 145 |
+
),
|
| 146 |
+
rpn_proposal=dict(
|
| 147 |
+
nms_pre=2000,
|
| 148 |
+
max_per_img=2000,
|
| 149 |
+
nms=dict(type="nms", iou_threshold=0.7),
|
| 150 |
+
min_bbox_size=0,
|
| 151 |
+
),
|
| 152 |
+
rcnn=[
|
| 153 |
+
dict(
|
| 154 |
+
assigner=dict(
|
| 155 |
+
type="MaxIoUAssigner",
|
| 156 |
+
pos_iou_thr=0.5,
|
| 157 |
+
neg_iou_thr=0.5,
|
| 158 |
+
min_pos_iou=0.5,
|
| 159 |
+
match_low_quality=False,
|
| 160 |
+
ignore_iof_thr=-1,
|
| 161 |
+
),
|
| 162 |
+
sampler=dict(
|
| 163 |
+
type="RandomSampler",
|
| 164 |
+
num=512,
|
| 165 |
+
pos_fraction=0.25,
|
| 166 |
+
neg_pos_ub=-1,
|
| 167 |
+
add_gt_as_proposals=True,
|
| 168 |
+
),
|
| 169 |
+
pos_weight=-1,
|
| 170 |
+
debug=False,
|
| 171 |
+
),
|
| 172 |
+
dict(
|
| 173 |
+
assigner=dict(
|
| 174 |
+
type="MaxIoUAssigner",
|
| 175 |
+
pos_iou_thr=0.6,
|
| 176 |
+
neg_iou_thr=0.6,
|
| 177 |
+
min_pos_iou=0.6,
|
| 178 |
+
match_low_quality=False,
|
| 179 |
+
ignore_iof_thr=-1,
|
| 180 |
+
),
|
| 181 |
+
sampler=dict(
|
| 182 |
+
type="RandomSampler",
|
| 183 |
+
num=512,
|
| 184 |
+
pos_fraction=0.25,
|
| 185 |
+
neg_pos_ub=-1,
|
| 186 |
+
add_gt_as_proposals=True,
|
| 187 |
+
),
|
| 188 |
+
pos_weight=-1,
|
| 189 |
+
debug=False,
|
| 190 |
+
),
|
| 191 |
+
dict(
|
| 192 |
+
assigner=dict(
|
| 193 |
+
type="MaxIoUAssigner",
|
| 194 |
+
pos_iou_thr=0.7,
|
| 195 |
+
neg_iou_thr=0.7,
|
| 196 |
+
min_pos_iou=0.7,
|
| 197 |
+
match_low_quality=False,
|
| 198 |
+
ignore_iof_thr=-1,
|
| 199 |
+
),
|
| 200 |
+
sampler=dict(
|
| 201 |
+
type="RandomSampler",
|
| 202 |
+
num=512,
|
| 203 |
+
pos_fraction=0.25,
|
| 204 |
+
neg_pos_ub=-1,
|
| 205 |
+
add_gt_as_proposals=True,
|
| 206 |
+
),
|
| 207 |
+
pos_weight=-1,
|
| 208 |
+
debug=False,
|
| 209 |
+
),
|
| 210 |
+
],
|
| 211 |
+
),
|
| 212 |
+
test_cfg=dict(
|
| 213 |
+
rpn=dict(
|
| 214 |
+
nms_pre=1000,
|
| 215 |
+
max_per_img=1000,
|
| 216 |
+
nms=dict(type="nms", iou_threshold=0.7),
|
| 217 |
+
min_bbox_size=0,
|
| 218 |
+
),
|
| 219 |
+
rcnn=dict(
|
| 220 |
+
score_thr=0.0, nms=dict(type="nms", iou_threshold=0.7), max_per_img=200
|
| 221 |
+
),
|
| 222 |
+
),
|
| 223 |
+
)
|
| 224 |
+
dataset_type = "CocoDataset"
|
| 225 |
+
data_root = "data/coco/"
|
| 226 |
+
img_norm_cfg = dict(
|
| 227 |
+
mean=[216.45, 212.36, 206.76], std=[55.82, 56.04, 55.56], to_rgb=True
|
| 228 |
+
)
|
| 229 |
+
train_pipeline = [
|
| 230 |
+
dict(type="LoadImageFromFile"),
|
| 231 |
+
dict(type="LoadAnnotations", with_bbox=True),
|
| 232 |
+
dict(
|
| 233 |
+
type="AutoAugment",
|
| 234 |
+
policies=[
|
| 235 |
+
[
|
| 236 |
+
{
|
| 237 |
+
"type": "Resize",
|
| 238 |
+
"img_scale": [
|
| 239 |
+
(480, 1333),
|
| 240 |
+
(512, 1333),
|
| 241 |
+
(544, 1333),
|
| 242 |
+
(576, 1333),
|
| 243 |
+
(608, 1333),
|
| 244 |
+
(640, 1333),
|
| 245 |
+
(672, 1333),
|
| 246 |
+
(704, 1333),
|
| 247 |
+
(736, 1333),
|
| 248 |
+
(768, 1333),
|
| 249 |
+
(800, 1333),
|
| 250 |
+
],
|
| 251 |
+
"multiscale_mode": "value",
|
| 252 |
+
"keep_ratio": True,
|
| 253 |
+
}
|
| 254 |
+
],
|
| 255 |
+
[
|
| 256 |
+
{
|
| 257 |
+
"type": "Resize",
|
| 258 |
+
"img_scale": [(400, 1333), (500, 1333), (600, 1333)],
|
| 259 |
+
"multiscale_mode": "value",
|
| 260 |
+
"keep_ratio": True,
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"type": "RandomCrop",
|
| 264 |
+
"crop_type": "absolute_range",
|
| 265 |
+
"crop_size": (384, 600),
|
| 266 |
+
"allow_negative_crop": True,
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"type": "Resize",
|
| 270 |
+
"img_scale": [
|
| 271 |
+
(480, 1333),
|
| 272 |
+
(512, 1333),
|
| 273 |
+
(544, 1333),
|
| 274 |
+
(576, 1333),
|
| 275 |
+
(608, 1333),
|
| 276 |
+
(640, 1333),
|
| 277 |
+
(672, 1333),
|
| 278 |
+
(704, 1333),
|
| 279 |
+
(736, 1333),
|
| 280 |
+
(768, 1333),
|
| 281 |
+
(800, 1333),
|
| 282 |
+
],
|
| 283 |
+
"multiscale_mode": "value",
|
| 284 |
+
"override": True,
|
| 285 |
+
"keep_ratio": True,
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"type": "PhotoMetricDistortion",
|
| 289 |
+
"brightness_delta": 32,
|
| 290 |
+
"contrast_range": (0.5, 1.5),
|
| 291 |
+
"saturation_range": (0.5, 1.5),
|
| 292 |
+
"hue_delta": 18,
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"type": "MinIoURandomCrop",
|
| 296 |
+
"min_ious": (0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
| 297 |
+
"min_crop_size": 0.3,
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"type": "CutOut",
|
| 301 |
+
"n_holes": (5, 10),
|
| 302 |
+
"cutout_shape": [
|
| 303 |
+
(4, 4),
|
| 304 |
+
(4, 8),
|
| 305 |
+
(8, 4),
|
| 306 |
+
(8, 8),
|
| 307 |
+
(16, 32),
|
| 308 |
+
(32, 16),
|
| 309 |
+
(32, 32),
|
| 310 |
+
(32, 48),
|
| 311 |
+
(48, 32),
|
| 312 |
+
(48, 48),
|
| 313 |
+
],
|
| 314 |
+
},
|
| 315 |
+
],
|
| 316 |
+
],
|
| 317 |
+
),
|
| 318 |
+
dict(type="RandomFlip", flip_ratio=0.1),
|
| 319 |
+
dict(
|
| 320 |
+
type="Normalize",
|
| 321 |
+
mean=[216.45, 212.36, 206.76],
|
| 322 |
+
std=[55.82, 56.04, 55.56],
|
| 323 |
+
to_rgb=True,
|
| 324 |
+
),
|
| 325 |
+
dict(type="Pad", size_divisor=32),
|
| 326 |
+
dict(type="DefaultFormatBundle"),
|
| 327 |
+
dict(type="Collect", keys=["img", "gt_bboxes", "gt_labels"]),
|
| 328 |
+
]
|
| 329 |
+
test_pipeline = [
|
| 330 |
+
dict(type="LoadImageFromFile", to_float32=True),
|
| 331 |
+
dict(
|
| 332 |
+
type="MultiScaleFlipAug",
|
| 333 |
+
img_scale=(1333, 800),
|
| 334 |
+
flip=False,
|
| 335 |
+
transforms=[
|
| 336 |
+
dict(type="Resize", keep_ratio=True),
|
| 337 |
+
dict(type="RandomFlip", flip_ratio=0.0),
|
| 338 |
+
dict(
|
| 339 |
+
type="Normalize",
|
| 340 |
+
mean=[216.45, 212.36, 206.76],
|
| 341 |
+
std=[55.82, 56.04, 55.56],
|
| 342 |
+
to_rgb=True,
|
| 343 |
+
),
|
| 344 |
+
dict(type="Pad", size_divisor=32),
|
| 345 |
+
dict(type="DefaultFormatBundle"),
|
| 346 |
+
dict(type="Collect", keys=["img"]),
|
| 347 |
+
],
|
| 348 |
+
),
|
| 349 |
+
]
|
| 350 |
+
data = dict(
|
| 351 |
+
samples_per_gpu=3,
|
| 352 |
+
workers_per_gpu=4,
|
| 353 |
+
train=dict(
|
| 354 |
+
type="CocoDataset",
|
| 355 |
+
ann_file="./data/pmc_2022/pmc_coco/element_detection/train.json",
|
| 356 |
+
img_prefix="./data/pmc_2022/pmc_coco/element_detection/train/",
|
| 357 |
+
pipeline=[
|
| 358 |
+
dict(type="LoadImageFromFile"),
|
| 359 |
+
dict(type="LoadAnnotations", with_bbox=True),
|
| 360 |
+
dict(
|
| 361 |
+
type="AutoAugment",
|
| 362 |
+
policies=[
|
| 363 |
+
[
|
| 364 |
+
{
|
| 365 |
+
"type": "Resize",
|
| 366 |
+
"img_scale": [
|
| 367 |
+
(480, 1333),
|
| 368 |
+
(512, 1333),
|
| 369 |
+
(544, 1333),
|
| 370 |
+
(576, 1333),
|
| 371 |
+
(608, 1333),
|
| 372 |
+
(640, 1333),
|
| 373 |
+
(672, 1333),
|
| 374 |
+
(704, 1333),
|
| 375 |
+
(736, 1333),
|
| 376 |
+
(768, 1333),
|
| 377 |
+
(800, 1333),
|
| 378 |
+
],
|
| 379 |
+
"multiscale_mode": "value",
|
| 380 |
+
"keep_ratio": True,
|
| 381 |
+
}
|
| 382 |
+
],
|
| 383 |
+
[
|
| 384 |
+
{
|
| 385 |
+
"type": "Resize",
|
| 386 |
+
"img_scale": [(400, 1333), (500, 1333), (600, 1333)],
|
| 387 |
+
"multiscale_mode": "value",
|
| 388 |
+
"keep_ratio": True,
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"type": "RandomCrop",
|
| 392 |
+
"crop_type": "absolute_range",
|
| 393 |
+
"crop_size": (384, 600),
|
| 394 |
+
"allow_negative_crop": True,
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"type": "Resize",
|
| 398 |
+
"img_scale": [
|
| 399 |
+
(480, 1333),
|
| 400 |
+
(512, 1333),
|
| 401 |
+
(544, 1333),
|
| 402 |
+
(576, 1333),
|
| 403 |
+
(608, 1333),
|
| 404 |
+
(640, 1333),
|
| 405 |
+
(672, 1333),
|
| 406 |
+
(704, 1333),
|
| 407 |
+
(736, 1333),
|
| 408 |
+
(768, 1333),
|
| 409 |
+
(800, 1333),
|
| 410 |
+
],
|
| 411 |
+
"multiscale_mode": "value",
|
| 412 |
+
"override": True,
|
| 413 |
+
"keep_ratio": True,
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"type": "PhotoMetricDistortion",
|
| 417 |
+
"brightness_delta": 32,
|
| 418 |
+
"contrast_range": (0.5, 1.5),
|
| 419 |
+
"saturation_range": (0.5, 1.5),
|
| 420 |
+
"hue_delta": 18,
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"type": "MinIoURandomCrop",
|
| 424 |
+
"min_ious": (0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
| 425 |
+
"min_crop_size": 0.3,
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
"type": "CutOut",
|
| 429 |
+
"n_holes": (5, 10),
|
| 430 |
+
"cutout_shape": [
|
| 431 |
+
(4, 4),
|
| 432 |
+
(4, 8),
|
| 433 |
+
(8, 4),
|
| 434 |
+
(8, 8),
|
| 435 |
+
(16, 32),
|
| 436 |
+
(32, 16),
|
| 437 |
+
(32, 32),
|
| 438 |
+
(32, 48),
|
| 439 |
+
(48, 32),
|
| 440 |
+
(48, 48),
|
| 441 |
+
],
|
| 442 |
+
},
|
| 443 |
+
],
|
| 444 |
+
],
|
| 445 |
+
),
|
| 446 |
+
dict(type="RandomFlip", flip_ratio=0.1),
|
| 447 |
+
dict(
|
| 448 |
+
type="Normalize",
|
| 449 |
+
mean=[216.45, 212.36, 206.76],
|
| 450 |
+
std=[55.82, 56.04, 55.56],
|
| 451 |
+
to_rgb=True,
|
| 452 |
+
),
|
| 453 |
+
dict(type="Pad", size_divisor=32),
|
| 454 |
+
dict(type="DefaultFormatBundle"),
|
| 455 |
+
dict(type="Collect", keys=["img", "gt_bboxes", "gt_labels"]),
|
| 456 |
+
],
|
| 457 |
+
classes=[
|
| 458 |
+
"x_title",
|
| 459 |
+
"y_title",
|
| 460 |
+
"plot_area",
|
| 461 |
+
"other",
|
| 462 |
+
"xlabel",
|
| 463 |
+
"ylabel",
|
| 464 |
+
"chart_title",
|
| 465 |
+
"x_tick",
|
| 466 |
+
"y_tick",
|
| 467 |
+
"legend_patch",
|
| 468 |
+
"legend_label",
|
| 469 |
+
"legend_title",
|
| 470 |
+
"legend_area",
|
| 471 |
+
"mark_label",
|
| 472 |
+
"value_label",
|
| 473 |
+
"y_axis_area",
|
| 474 |
+
"x_axis_area",
|
| 475 |
+
"tick_grouping",
|
| 476 |
+
],
|
| 477 |
+
),
|
| 478 |
+
val=dict(
|
| 479 |
+
type="CocoDataset",
|
| 480 |
+
ann_file="./data/pmc_2022/pmc_coco/element_detection/val.json",
|
| 481 |
+
img_prefix="./data/pmc_2022/pmc_coco/element_detection/val/",
|
| 482 |
+
pipeline=[
|
| 483 |
+
dict(type="LoadImageFromFile"),
|
| 484 |
+
dict(
|
| 485 |
+
type="MultiScaleFlipAug",
|
| 486 |
+
img_scale=(1333, 800),
|
| 487 |
+
flip=False,
|
| 488 |
+
transforms=[
|
| 489 |
+
dict(type="Resize", keep_ratio=True),
|
| 490 |
+
dict(type="RandomFlip"),
|
| 491 |
+
dict(
|
| 492 |
+
type="Normalize",
|
| 493 |
+
mean=[123.675, 116.28, 103.53],
|
| 494 |
+
std=[58.395, 57.12, 57.375],
|
| 495 |
+
to_rgb=True,
|
| 496 |
+
),
|
| 497 |
+
dict(type="Pad", size_divisor=32),
|
| 498 |
+
dict(type="ImageToTensor", keys=["img"]),
|
| 499 |
+
dict(type="Collect", keys=["img"]),
|
| 500 |
+
],
|
| 501 |
+
),
|
| 502 |
+
],
|
| 503 |
+
classes=[
|
| 504 |
+
"x_title",
|
| 505 |
+
"y_title",
|
| 506 |
+
"plot_area",
|
| 507 |
+
"other",
|
| 508 |
+
"xlabel",
|
| 509 |
+
"ylabel",
|
| 510 |
+
"chart_title",
|
| 511 |
+
"x_tick",
|
| 512 |
+
"y_tick",
|
| 513 |
+
"legend_patch",
|
| 514 |
+
"legend_label",
|
| 515 |
+
"legend_title",
|
| 516 |
+
"legend_area",
|
| 517 |
+
"mark_label",
|
| 518 |
+
"value_label",
|
| 519 |
+
"y_axis_area",
|
| 520 |
+
"x_axis_area",
|
| 521 |
+
"tick_grouping",
|
| 522 |
+
],
|
| 523 |
+
),
|
| 524 |
+
test=dict(
|
| 525 |
+
type="CocoDataset",
|
| 526 |
+
ann_file="./data/pmc_2022/pmc_coco/element_detection/split3_test.json",
|
| 527 |
+
img_prefix="./data/pmc_2022/pmc_coco/element_detection/split3_test/",
|
| 528 |
+
pipeline=[
|
| 529 |
+
dict(type="LoadImageFromFile"),
|
| 530 |
+
dict(
|
| 531 |
+
type="MultiScaleFlipAug",
|
| 532 |
+
img_scale=(1333, 800),
|
| 533 |
+
flip=False,
|
| 534 |
+
transforms=[
|
| 535 |
+
dict(type="Resize", keep_ratio=True),
|
| 536 |
+
dict(type="RandomFlip"),
|
| 537 |
+
dict(
|
| 538 |
+
type="Normalize",
|
| 539 |
+
mean=[123.675, 116.28, 103.53],
|
| 540 |
+
std=[58.395, 57.12, 57.375],
|
| 541 |
+
to_rgb=True,
|
| 542 |
+
),
|
| 543 |
+
dict(type="Pad", size_divisor=32),
|
| 544 |
+
dict(type="ImageToTensor", keys=["img"]),
|
| 545 |
+
dict(type="Collect", keys=["img"]),
|
| 546 |
+
],
|
| 547 |
+
),
|
| 548 |
+
],
|
| 549 |
+
classes=[
|
| 550 |
+
"x_title",
|
| 551 |
+
"y_title",
|
| 552 |
+
"plot_area",
|
| 553 |
+
"other",
|
| 554 |
+
"xlabel",
|
| 555 |
+
"ylabel",
|
| 556 |
+
"chart_title",
|
| 557 |
+
"x_tick",
|
| 558 |
+
"y_tick",
|
| 559 |
+
"legend_patch",
|
| 560 |
+
"legend_label",
|
| 561 |
+
"legend_title",
|
| 562 |
+
"legend_area",
|
| 563 |
+
"mark_label",
|
| 564 |
+
"value_label",
|
| 565 |
+
"y_axis_area",
|
| 566 |
+
"x_axis_area",
|
| 567 |
+
"tick_grouping",
|
| 568 |
+
],
|
| 569 |
+
),
|
| 570 |
+
)
|
| 571 |
+
evaluation = dict(interval=1, metric=["bbox"])
|
| 572 |
+
optimizer = dict(
|
| 573 |
+
type="AdamW",
|
| 574 |
+
lr=0.0002,
|
| 575 |
+
betas=(0.9, 0.999),
|
| 576 |
+
weight_decay=0.05,
|
| 577 |
+
paramwise_cfg=dict(
|
| 578 |
+
custom_keys=dict(
|
| 579 |
+
absolute_pos_embed=dict(decay_mult=0.0),
|
| 580 |
+
relative_position_bias_table=dict(decay_mult=0.0),
|
| 581 |
+
norm=dict(decay_mult=0.0),
|
| 582 |
+
)
|
| 583 |
+
),
|
| 584 |
+
)
|
| 585 |
+
optimizer_config = dict(grad_clip=None)
|
| 586 |
+
lr_config = dict(
|
| 587 |
+
policy="step", warmup="linear", warmup_iters=500, warmup_ratio=0.001, step=[8, 11]
|
| 588 |
+
)
|
| 589 |
+
runner = dict(type="EpochBasedRunner", max_epochs=150)
|
| 590 |
+
checkpoint_config = dict(interval=1)
|
| 591 |
+
log_config = dict(interval=50, hooks=[dict(type="TextLoggerHook")])
|
| 592 |
+
custom_hooks = [dict(type="NumClassCheckHook")]
|
| 593 |
+
dist_params = dict(backend="nccl")
|
| 594 |
+
log_level = "INFO"
|
| 595 |
+
load_from = None
|
| 596 |
+
resume_from = None
|
| 597 |
+
workflow = [("train", 1)]
|
| 598 |
+
opencv_num_threads = 0
|
| 599 |
+
mp_start_method = "fork"
|
| 600 |
+
auto_scale_lr = dict(enable=False, base_batch_size=16)
|
| 601 |
+
pretrained = "https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth"
|
| 602 |
+
classes = [
|
| 603 |
+
"x_title",
|
| 604 |
+
"y_title",
|
| 605 |
+
"plot_area",
|
| 606 |
+
"other",
|
| 607 |
+
"xlabel",
|
| 608 |
+
"ylabel",
|
| 609 |
+
"chart_title",
|
| 610 |
+
"x_tick",
|
| 611 |
+
"y_tick",
|
| 612 |
+
"legend_patch",
|
| 613 |
+
"legend_label",
|
| 614 |
+
"legend_title",
|
| 615 |
+
"legend_area",
|
| 616 |
+
"mark_label",
|
| 617 |
+
"value_label",
|
| 618 |
+
"y_axis_area",
|
| 619 |
+
"x_axis_area",
|
| 620 |
+
"tick_grouping",
|
| 621 |
+
]
|
| 622 |
+
auto_resume = False
|
| 623 |
+
gpu_ids = range(0, 4)
|