Spaces:
Build error
Build error
File size: 8,231 Bytes
c7f0cc1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
_base_ = [
'./psgformer_r50.py', '../_base_/datasets/psg.py',
'../_base_/custom_runtime.py'
]
find_unused_parameters = True
custom_imports = dict(imports=[
'openpsg.models.frameworks.psgtr', 'openpsg.models.losses.seg_losses',
'openpsg.models.frameworks.dual_transformer',
'openpsg.models.relation_heads.psgformer_head', 'openpsg.datasets',
'openpsg.datasets.pipelines.loading',
'openpsg.datasets.pipelines.rel_randomcrop',
'openpsg.models.relation_heads.approaches.matcher', 'openpsg.utils'
],
allow_failed_imports=False)
dataset_type = 'PanopticSceneGraphDataset'
# HACK:
object_classes = [
'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train',
'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign',
'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag',
'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite',
'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon',
'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot',
'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant',
'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote',
'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink',
'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
'hair drier', 'toothbrush', 'banner', 'blanket', 'bridge', 'cardboard',
'counter', 'curtain', 'door-stuff', 'floor-wood', 'flower', 'fruit',
'gravel', 'house', 'light', 'mirror-stuff', 'net', 'pillow', 'platform',
'playingfield', 'railroad', 'river', 'road', 'roof', 'sand', 'sea',
'shelf', 'snow', 'stairs', 'tent', 'towel', 'wall-brick', 'wall-stone',
'wall-tile', 'wall-wood', 'water-other', 'window-blind', 'window-other',
'tree-merged', 'fence-merged', 'ceiling-merged', 'sky-other-merged',
'cabinet-merged', 'table-merged', 'floor-other-merged', 'pavement-merged',
'mountain-merged', 'grass-merged', 'dirt-merged', 'paper-merged',
'food-other-merged', 'building-other-merged', 'rock-merged',
'wall-other-merged', 'rug-merged'
]
predicate_classes = [
'over',
'in front of',
'beside',
'on',
'in',
'attached to',
'hanging from',
'on back of',
'falling off',
'going down',
'painted on',
'walking on',
'running on',
'crossing',
'standing on',
'lying on',
'sitting on',
'flying over',
'jumping over',
'jumping from',
'wearing',
'holding',
'carrying',
'looking at',
'guiding',
'kissing',
'eating',
'drinking',
'feeding',
'biting',
'catching',
'picking',
'playing with',
'chasing',
'climbing',
'cleaning',
'playing',
'touching',
'pushing',
'pulling',
'opening',
'cooking',
'talking to',
'throwing',
'slicing',
'driving',
'riding',
'parked on',
'driving on',
'about to hit',
'kicking',
'swinging',
'entering',
'exiting',
'enclosing',
'leaning on',
]
model = dict(bbox_head=dict(
num_classes=len(object_classes),
num_relations=len(predicate_classes),
object_classes=object_classes,
predicate_classes=predicate_classes,
num_obj_query=100,
num_rel_query=100,
), )
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True)
# train_pipeline, NOTE the img_scale and the Pad's size_divisor is different
# from the default setting in mmdet.
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadPanopticSceneGraphAnnotations',
with_bbox=True,
with_rel=True,
with_mask=True,
with_seg=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='RelRandomCrop',
crop_type='absolute_range',
crop_size=(384, 600),
allow_negative_crop=False), # no empty relations
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='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=1),
dict(type='RelsFormatBundle'),
dict(type='Collect',
keys=['img', 'gt_bboxes', 'gt_labels', 'gt_rels', 'gt_masks'])
]
# test_pipeline, NOTE the Pad's size_divisor is different from the default
# setting (size_divisor=32). While there is little effect on the performance
# whether we use the default setting or use size_divisor=1.
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadSceneGraphAnnotations', with_bbox=True, with_rel=True),
dict(type='MultiScaleFlipAug',
img_scale=(1333, 800),
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=1),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_bboxes', 'gt_labels']),
dict(type='ToDataContainer',
fields=(dict(key='gt_bboxes'), dict(key='gt_labels'))),
dict(type='Collect', keys=['img']),
])
]
evaluation = dict(
interval=1,
metric='sgdet',
relation_mode=True,
classwise=True,
iou_thrs=0.5,
detection_method='pan_seg',
)
data = dict(samples_per_gpu=1,
workers_per_gpu=2,
train=dict(pipeline=train_pipeline),
val=dict(pipeline=test_pipeline),
test=dict(pipeline=test_pipeline))
# optimizer
optimizer = dict(
type='AdamW',
lr=0.001,
weight_decay=0.0001,
paramwise_cfg=dict(
custom_keys={
'backbone': dict(lr_mult=0.1, decay_mult=1.0),
'transformer.encoder': dict(lr_mult=0.1, decay_mult=1.0),
'transformer.decoder1': dict(lr_mult=0.1, decay_mult=1.0),
'obj_query_embed': dict(lr_mult=0.1, decay_mult=1.0),
'input_proj': dict(lr_mult=0.1, decay_mult=1.0),
'class_embed': dict(lr_mult=0.1, decay_mult=1.0),
'box_embed': dict(lr_mult=0.1, decay_mult=1.0),
'bbox_attention': dict(lr_mult=0.1, decay_mult=1.0),
'mask_head': dict(lr_mult=0.1, decay_mult=1.0),
}))
optimizer_config = dict(grad_clip=dict(max_norm=0.1, norm_type=2))
# learning policy
lr_config = dict(policy='step', step=40)
runner = dict(type='EpochBasedRunner', max_epochs=60)
project_name = 'psgformer'
expt_name = 'psgformer_r50_psg'
work_dir = f'./work_dirs/{expt_name}'
checkpoint_config = dict(interval=1, max_keep_ckpts=15)
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
dict(
type='WandbLoggerHook',
init_kwargs=dict(
project=project_name,
name=expt_name,
),
)
],
)
load_from = './work_dirs/checkpoints/detr4psgformer_r50.pth'
|