open-mmlab/mmdetection · warning
``ignore_label`` and ``loss_weight`` would be deprecated soo
Error message
``ignore_label`` and ``loss_weight`` would be deprecated soon. Please set ``ingore_index`` and ``loss_weight`` in ``loss_seg`` instead.
What it means
Warning from FusedSemanticHead.__init__: the standalone `ignore_label` and `loss_weight` constructor arguments are being deprecated; they are merely copied into loss_seg['ignore_index'] / loss_seg['loss_weight']. Set them inside the loss_seg dict instead.
Source
Thrown at mmdet/models/roi_heads/mask_heads/fused_semantic_head.py:97
in_channels,
conv_out_channels,
3,
padding=1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg))
self.conv_embedding = ConvModule(
conv_out_channels,
conv_out_channels,
1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg)
self.conv_logits = nn.Conv2d(conv_out_channels, self.num_classes, 1)
if ignore_label:
loss_seg['ignore_index'] = ignore_label
if loss_weight:
loss_seg['loss_weight'] = loss_weight
if ignore_label or loss_weight:
warnings.warn('``ignore_label`` and ``loss_weight`` would be '
'deprecated soon. Please set ``ingore_index`` and '
'``loss_weight`` in ``loss_seg`` instead.')
self.criterion = MODELS.build(loss_seg)
def forward(self, feats: Tuple[Tensor]) -> Tuple[Tensor]:
"""Forward function.
Args:
feats (tuple[Tensor]): Multi scale feature maps.
Returns:
tuple[Tensor]:
- mask_preds (Tensor): Predicted mask logits.
- x (Tensor): Fused feature.
"""
x = self.lateral_convs[self.fusion_level](feats[self.fusion_level])
fused_size = tuple(x.shape[-2:])View on GitHub (pinned to cfd5d3a985)
Solutions
- Move ignore_label into loss_seg as ignore_index (e.g. loss_seg=dict(type='CrossEntropyLoss', ignore_index=-1))
- Move loss_weight into loss_seg as loss_weight
- Remove the top-level ignore_label/loss_weight keys from the head config
Example fix
# before roi_head=dict(..., semantic_head=dict(type='FusedSemanticHead', ignore_label=-1, loss_weight=0.2)) # after roi_head=dict(..., semantic_head=dict(type='FusedSemanticHead', loss_seg=dict(type='CrossEntropyLoss', ignore_index=-1, loss_weight=0.2)))
Defensive patterns
Strategy: validation
Validate before calling
assert 'ignore_label' not in sem_head_cfg and 'loss_weight' not in sem_head_cfg, 'set ignore_index/loss_weight inside loss_seg'
Prevention
- Move all loss kwargs into the loss dict when migrating heads
- Compare with current panoptic-fpn/htc configs after upgrades
When it happens
Trigger: Constructing FusedSemanticHead with ignore_label=-1 (typical for Panoptic FPN / HTC configs) and/or an explicit loss_weight argument; any config inherited from older mask-rcnn/htc configs.
Common situations: Upgrading configs from older mmdet where ignore_label/loss_weight were top-level head args; panoptic segmentation setups.
Related errors
- pretrained must be a str or None
- DeprecationWarning: pretrained is deprecated, please use "in
- DeprecationWarning: `num_anchors` is deprecated, for consist
- DeprecationWarning: anchor_generator is deprecated, please u
- You are calling `simple_test_bboxes` in `dense_test_mixins`,
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/3205b3dc4b7e4e7f.
Report an issue: GitHub.