Skip to content

Commit

Permalink
[Fix] Fix init api (#3388)
Browse files Browse the repository at this point in the history
## Motivation

#3384

## Modification

- mmseg/apis/inference.py
  • Loading branch information
xiexinch committed Oct 16, 2023
1 parent 95fbfbb commit 649c50c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mmseg/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ def init_model(config: Union[str, Path, Config],
'but got {}'.format(type(config)))
if cfg_options is not None:
config.merge_from_dict(cfg_options)
elif 'init_cfg' in config.model.backbone:
config.model.backbone.init_cfg = None
if config.model.type == 'EncoderDecoder':
if 'init_cfg' in config.model.backbone:
config.model.backbone.init_cfg = None
elif config.model.type == 'MultimodalEncoderDecoder':
for k, v in config.model.items():
if isinstance(v, dict) and 'init_cfg' in v:
config.model[k].init_cfg = None
config.model.pretrained = None
config.model.train_cfg = None
init_default_scope(config.get('default_scope', 'mmseg'))
Expand Down

0 comments on commit 649c50c

Please sign in to comment.