compatible with new config
parent
17a886cb58
commit
a3ffe2ecfe
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
import copy
|
import copy
|
||||||
|
import inspect
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os.path as osp
|
import os.path as osp
|
||||||
import re
|
import re
|
||||||
|
@ -207,6 +208,10 @@ def get_model(model: Union[str, Config],
|
||||||
dataset_meta = {'classes': checkpoint['meta']['CLASSES']}
|
dataset_meta = {'classes': checkpoint['meta']['CLASSES']}
|
||||||
|
|
||||||
if len(dataset_meta) == 0 and 'test_dataloader' in config:
|
if len(dataset_meta) == 0 and 'test_dataloader' in config:
|
||||||
|
# compatible with new config
|
||||||
|
if inspect.isclass(config.test_dataloader.dataset.type):
|
||||||
|
dataset_class = config.test_dataloader.dataset.type
|
||||||
|
else:
|
||||||
from mmpretrain.registry import DATASETS
|
from mmpretrain.registry import DATASETS
|
||||||
dataset_class = DATASETS.get(config.test_dataloader.dataset.type)
|
dataset_class = DATASETS.get(config.test_dataloader.dataset.type)
|
||||||
dataset_meta = getattr(dataset_class, 'METAINFO', {})
|
dataset_meta = getattr(dataset_class, 'METAINFO', {})
|
||||||
|
|
Loading…
Reference in New Issue