Skip to content

Commit a5f9ed3

Browse files
duanzhihuachhluo
andauthored
Update maskformer.py and Update maskformer_head.py (#8263)
* Update maskformer.py * Update maskformer_head.py * Update maskformer.py * fix lint * fix lint Co-authored-by: Cedric Luo <[email protected]>
1 parent 35effe9 commit a5f9ed3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mmdet/models/dense_heads/maskformer_head.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ def __init__(self,
116116
self.test_cfg = test_cfg
117117
self.train_cfg = train_cfg
118118
if train_cfg:
119-
self.assigner = build_assigner(train_cfg.assigner)
120-
self.sampler = build_sampler(train_cfg.sampler, context=self)
119+
self.assigner = build_assigner(train_cfg.get('assigner', None))
120+
self.sampler = build_sampler(
121+
train_cfg.get('sampler', None), context=self)
121122

122-
self.class_weight = loss_cls.class_weight
123+
self.class_weight = loss_cls.get('class_weight', None)
123124
self.loss_cls = build_loss(loss_cls)
124125
self.loss_mask = build_loss(loss_mask)
125126
self.loss_dice = build_loss(loss_dice)

mmdet/models/detectors/maskformer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Copyright (c) OpenMMLab. All rights reserved.
2+
import copy
3+
24
import mmcv
35
import numpy as np
46

@@ -27,12 +29,12 @@ def __init__(self,
2729
if neck is not None:
2830
self.neck = build_neck(neck)
2931

30-
panoptic_head_ = panoptic_head.deepcopy()
32+
panoptic_head_ = copy.deepcopy(panoptic_head)
3133
panoptic_head_.update(train_cfg=train_cfg)
3234
panoptic_head_.update(test_cfg=test_cfg)
3335
self.panoptic_head = build_head(panoptic_head_)
3436

35-
panoptic_fusion_head_ = panoptic_fusion_head.deepcopy()
37+
panoptic_fusion_head_ = copy.deepcopy(panoptic_fusion_head)
3638
panoptic_fusion_head_.update(test_cfg=test_cfg)
3739
self.panoptic_fusion_head = build_head(panoptic_fusion_head_)
3840

0 commit comments

Comments
 (0)