-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I'm trying to run mmseg.apis.inference_model with the "Potsdam(i)2RescueNet.pth" model and am getting AttributeError: 'ConfigDict' object has no attribute 'test_pipeline'. (It looks like the CrossEarth_dinov2_mask2former_512x512_bs1x4.py config file is setup to run this model since it refers to the dg_potsdamRGB2rescue_512x512.py config file, so I didn't modify it any.
from mmseg.apis import init_model, inference_model
config_path = '/CrossEarth/configs/CrossEarth_dinov2/CrossEarth_dinov2_mask2former_512x512_bs1x4.py'
checkpoint_path = '/CrossEarth/checkpoints/Potsdam(i)2RescueNet.pth' # EDITED
model = init_model(config_path, checkpoint_path) # this does give size mismatch warnings, but I saw you said those were ok
result = inference_model(model, img_path)
# AttributeError: 'ConfigDict' object has no attribute 'test_pipeline'Details
File /venv/lib/python3.10/site-packages/mmseg/apis/inference.py:143, in inference_model(model, img)
130 """Inference image(s) with the segmentor.
131
132 Args:
(...)
140 will be returned, otherwise return the segmentation results directly.
141 """
142 # prepare data
--> 143 data, is_batch = _preprare_data(img, model)
145 # forward the model
146 with torch.no_grad():
File /venv/lib/python3.10/site-packages/mmseg/apis/inference.py:99, in _preprare_data(imgs, model)
96 def _preprare_data(imgs: ImageType, model: BaseSegmentor):
98 cfg = model.cfg
---> 99 for t in cfg.test_pipeline:
100 if t.get('type') == 'LoadAnnotations':
101 cfg.test_pipeline.remove(t)
File /venv/lib/python3.10/site-packages/mmengine/config/config.py:1500, in Config.__getattr__(self, name)
1499 def __getattr__(self, name: str) -> Any:
-> 1500 return getattr(self._cfg_dict, name)
File /venv/lib/python3.10/site-packages/mmengine/config/config.py:113, in ConfigDict.__getattr__(self, name)
111 value = value.build()
112 except KeyError:
--> 113 raise AttributeError(f"'{self.__class__.__name__}' object has no "
114 f"attribute '{name}'")
115 except Exception as e:
116 raise e
AttributeError: 'ConfigDict' object has no attribute 'test_pipeline'
python 3.10
torch==2.0.1
torchvision==0.15.2
mmengine= 0.10.7
mmcv==2.0.1
mmdet==3.0.0
mmsegmentation==1.0.0
xformers==0.0.20
Metadata
Metadata
Assignees
Labels
No labels