Closed YananGu closed 1 year ago
看起来是config文件写错了,可能是base文件中的evaluation有重复之类的,你可以把config文件发出来看看吗?
@duanduanduanyuchen 我没改配置文件,就是按照原代码跑的。。
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_3x.py',
'../_base_/default_runtime.py'
]
# pretrained = 'https://dl.fbaipublicfiles.com/deit/deit_tiny_patch16_224-a1311bcf.pth'
pretrained = 'pretrained/deit_tiny_patch16_224-a1311bcf.pth'
model = dict(
backbone=dict(
_delete_=True,
type='ViTAdapter',
patch_size=16,
embed_dim=192,
depth=12,
num_heads=3,
mlp_ratio=4,
drop_path_rate=0.1,
conv_inplane=64,
n_points=4,
deform_num_heads=6,
cffn_ratio=0.25,
deform_ratio=1.0,
interaction_indexes=[[0, 2], [3, 5], [6, 8], [9, 11]],
window_attn=[True, True, False, True, True, False,
True, True, False, True, True, False],
window_size=[14, 14, None, 14, 14, None,
14, 14, None, 14, 14, None],
pretrained=pretrained),
neck=dict(
type='FPN',
in_channels=[192, 192, 192, 192],
out_channels=256,
num_outs=5))
# optimizer
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
# augmentation strategy originates from DETR / Sparse RCNN
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
dict(type='RandomFlip', flip_ratio=0.5),
dict(type='AutoAugment',
policies=[
[
dict(type='Resize',
img_scale=[(480, 1333), (512, 1333), (544, 1333), (576, 1333),
(608, 1333), (640, 1333), (672, 1333), (704, 1333),
(736, 1333), (768, 1333), (800, 1333)],
multiscale_mode='value',
keep_ratio=True)
],
[
dict(type='Resize',
img_scale=[(400, 1333), (500, 1333), (600, 1333)],
multiscale_mode='value',
keep_ratio=True),
dict(type='RandomCrop',
crop_type='absolute_range',
crop_size=(384, 600),
allow_negative_crop=True),
dict(type='Resize',
img_scale=[(480, 1333), (512, 1333), (544, 1333),
(576, 1333), (608, 1333), (640, 1333),
(672, 1333), (704, 1333), (736, 1333),
(768, 1333), (800, 1333)],
multiscale_mode='value',
override=True,
keep_ratio=True)
]
]),
dict(type='RandomCrop',
crop_type='absolute_range',
crop_size=(1024, 1024),
allow_negative_crop=True),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
]
data = dict(train=dict(pipeline=train_pipeline))
optimizer = dict(
_delete_=True, type='AdamW', lr=0.0001, weight_decay=0.05,
paramwise_cfg=dict(
custom_keys={
'level_embed': dict(decay_mult=0.),
'pos_embed': dict(decay_mult=0.),
'norm': dict(decay_mult=0.),
'bias': dict(decay_mult=0.)
}))
optimizer_config = dict(grad_clip=None)
fp16 = dict(loss_scale=dict(init_scale=512))
checkpoint_config = dict(
interval=1,
max_keep_ckpts=3,
save_last=True,
)
确实是base文件中的evaluation这个key有重复:
ViT-Adapter/detection/configs/_base_/datasets/coco_instance.py
和ViT-Adapter/detection/configs/_base_/default_runtime.py
这两个文件中都有evaluation这个变量,你可以把default_runtime.py
中的evaluation = dict(save_best='auto')
去掉,或者挪到你的这个config文件中来
非常感谢你!问题解决了!
您好, 我在运行代码时出现了以下错误:
发生异常: KeyError "Duplicate key is not allowed among bases. Duplicate keys: {'evaluation'}" File "/mnt/data/ViT-Adapter/detection/train.py", line 91, in main cfg = Config.fromfile(args.config) File "/mnt/data/ViT-Adapter/detection/train.py", line 192, in
main()
KeyError: "Duplicate key is not allowed among bases. Duplicate keys: {'evaluation'}"
请问您遇到过这种错误吗,有什么解决的办法吗?