SegFormer
SegFormer copied to clipboard
MMSegmentation Tutorial.ipynb fails when running Google Colab
`from mmseg.datasets import build_dataset from mmseg.models import build_segmentor from mmseg.apis import train_segmentor
Build the dataset
datasets = [build_dataset(cfg.data.train)]
Build the detector
model = build_segmentor(cfg.model)
Add an attribute for visualization convenience
model.CLASSES = datasets[0].CLASSES
Create work_dir
mmcv.mkdir_or_exist(osp.abspath(cfg.work_dir)) train_segmentor(model, datasets, cfg, distributed=False, validate=True, meta=dict())`
The error messages are as follows: `2022-05-30 19:36:58,568 - mmseg - INFO - Loaded 572 images
AssertionError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py in build_from_cfg(cfg, registry, default_args) 65 try: ---> 66 return obj_cls(**args) 67 except Exception as e:
5 frames AssertionError: both backbone and segmentor set pretrained weight
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py in build_from_cfg(cfg, registry, default_args) 67 except Exception as e: 68 # Normal TypeError does not print class name. ---> 69 raise type(e)(f'{obj_cls.name}: {e}') 70 71
AssertionError: EncoderDecoder: both backbone and segmentor set pretrained weight`
is seems that you when load the config file in the first time and start training you got error and then when solve it start the training again if that what happen you just need to load the config file again before start training