Closed
Description
The error code:
Use load_from_local loader
~/workspace/mmcv-test/mmseg/models/backbones/hrnet.py:298: UserWarning: DeprecationWarning: pretrained is a deprecated, please use "init_cfg" instead
warnings.warn('DeprecationWarning: pretrained is a deprecated, '
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-9-da74faa07110> in <module>
7 pth_file = osp.join(work_dir, 'iter_30000.pth')
8 print(torch.load(pth_file))
----> 9 model = init_segmentor(cfg, pth_file, device='cuda:0')
10 else:
11 model.cfg = cfg
~/workspace/mmcv-test/mmseg/apis/inference.py in init_segmentor(config, checkpoint, device)
33 checkpoint = load_checkpoint(model, checkpoint, map_location='cpu')
34 model.CLASSES = checkpoint['meta']['CLASSES']
---> 35 model.PALETTE = checkpoint['meta']['PALETTE']
36 model.cfg = config # save the config in the model for convenience
37 model.to(device)
KeyError: 'PALETTE'
My CustomDataset:
@DATASETS.register_module()
class BDD100KLaneLabelDataset(CustomDataset):
CLASSES = classes
PALETTE = palette
def __init__(self, split, **kwargs):
super().__init__(img_suffix='.jpg', seg_map_suffix='.png',
split=split, **kwargs)
assert osp.exists(self.img_dir) and self.split is not None
print('done')
I solved it using a simple way:
modify model.PALETTE = checkpoint['meta']['PALETTE']
to model.PALETTE = my_paletee
at line 35 in mmseg/apis/inference.py
.
But I want to know an official way to solve this error, please tell me.
thanks
Metadata
Metadata
Assignees
Labels
No labels