-
Notifications
You must be signed in to change notification settings - Fork 9
AssertionError: EncoderDecoderLandcover: both backbone and segmentor set pretrained weight #2
Copy link
Copy link
Open
Description
Error occur after running https://github.com/aiearth-damo/deeplearning/blob/main/quickstart.ipynb
# 训练
trainer.train(validate=False)
2024-04-29 15:54:42,338 - mmseg - INFO - Multi-processing start method is `None`
2024-04-29 15:54:42,338 - mmseg - INFO - Multi-processing start method is `None`
2024-04-29 15:54:42,341 - mmseg - INFO - OpenCV num_threads is `24
2024-04-29 15:54:42,341 - mmseg - INFO - OpenCV num_threads is `24
2024-04-29 15:54:42,395 - root - INFO - Loaded 16800 images
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
File ~/miniconda3/envs/py310/lib/python3.10/site-packages/mmcv/utils/registry.py:69, in build_from_cfg(cfg, registry, default_args)
68 try:
---> 69 return obj_cls(**args)
70 except Exception as e:
71 # Normal TypeError does not print class name.
File ~/deeplearning/aiearth/deeplearning/models/landcover/segmentors/encoder_decoder_landcover.py:15, in EncoderDecoderLandcover.__init__(self, **kwargs)
14 def __init__(self, **kwargs):
---> 15 super(EncoderDecoderLandcover, self).__init__(**kwargs)
File ~/miniconda3/envs/py310/lib/python3.10/site-packages/mmseg/models/segmentors/encoder_decoder.py:33, in EncoderDecoder.__init__(self, backbone, decode_head, neck, auxiliary_head, train_cfg, test_cfg, pretrained, init_cfg)
32 if pretrained is not None:
---> 33 assert backbone.get('pretrained') is None, \
34 'both backbone and segmentor set pretrained weight'
35 backbone.pretrained = pretrained
AssertionError: both backbone and segmentor set pretrained weight
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last)
Cell In[7], line 2
1 # 训练
----> 2 trainer.train(validate=False)
File ~/deeplearning/aiearth/deeplearning/trainer/mmseg/mmseg_trainer.py:268, in MMSegTrainer.train(self, validate, distributed)
266 datasets = self.build_datasets()
267 # Build the detector
--> 268 model = self.build_model()
269 # Add an attribute for visualization convenience
270 model.CLASSES = datasets[0].CLASSES
File ~/deeplearning/aiearth/deeplearning/trainer/mmseg/landcover_trainer.py:43, in LandcoverTrainer.build_model(self)
40 algorithm = self.cfg.get("algorithm", None)
42 if algorithm is None:
---> 43 model = build_segmentor(
44 self.cfg.model,
45 train_cfg=self.cfg.get("train_cfg"),
46 test_cfg=self.cfg.get("test_cfg"),
47 )
48 else:
49 # Different from mmsegmentation
50 # replace `model` to `algorithm`
51 if self.cfg.algorithm.architecture.model == "same":
File ~/miniconda3/envs/py310/lib/python3.10/site-packages/mmseg/models/builder.py:48, in build_segmentor(cfg, train_cfg, test_cfg)
44 assert cfg.get('train_cfg') is None or train_cfg is None, \
45 'train_cfg specified in both outer field and model field '
46 assert cfg.get('test_cfg') is None or test_cfg is None, \
47 'test_cfg specified in both outer field and model field '
---> 48 return SEGMENTORS.build(
49 cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg))
File ~/miniconda3/envs/py310/lib/python3.10/site-packages/mmcv/utils/registry.py:237, in Registry.build(self, *args, **kwargs)
236 def build(self, *args, **kwargs):
--> 237 return self.build_func(*args, **kwargs, registry=self)
File ~/miniconda3/envs/py310/lib/python3.10/site-packages/mmcv/cnn/builder.py:27, in build_model_from_cfg(cfg, registry, default_args)
25 return Sequential(*modules)
26 else:
---> 27 return build_from_cfg(cfg, registry, default_args)
File ~/miniconda3/envs/py310/lib/python3.10/site-packages/mmcv/utils/registry.py:72, in build_from_cfg(cfg, registry, default_args)
69 return obj_cls(**args)
70 except Exception as e:
71 # Normal TypeError does not print class name.
---> 72 raise type(e)(f'{obj_cls.__name__}: {e}')
AssertionError: EncoderDecoderLandcover: both backbone and segmentor set pretrained weight
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels