open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
8.3k stars 2.62k forks source link

配置mmseg的时候出现问题ModuleNotFoundError: class `IterBasedTrainLoop` in mmengine/runner/loops.py: No module named 'mmseg.datasets.samplers' #3078

Open lyk595 opened 1 year ago

lyk595 commented 1 year ago

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. The bug has not been fixed in the latest version.

Describe the bug /home/lyk/lyk/mmsegmentation-1.0.0rc6/mmseg/datasets/transforms/loading.py:78: UserWarning: reduce_zero_label will be deprecated, if you would like to ignore the zero label, please set reduce_zero_label=True when dataset initialized warnings.warn('reduce_zero_label will be deprecated, ' Traceback (most recent call last): File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 122, in build_from_cfg obj = obj_cls(*args) # type: ignore File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/runner/loops.py", line 219, in init super().init(runner, dataloader) File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/runner/base_loop.py", line 26, in init self.dataloader = runner.build_dataloader( File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1358, in build_dataloader sampler = DATA_SAMPLERS.build( File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, args, **kwargs, registry=self) File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 98, in build_from_cfg obj_cls = registry.get(obj_type) File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/registry.py", line 442, in get self.import_from_location() File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/registry.py", line 376, in import_from_location import_module(loc) File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'mmseg.datasets.samplers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 101, in main() File "train.py", line 97, in main runner.train() File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1687, in train self._train_loop = self.build_train_loop( File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1479, in build_train_loop loop = LOOPS.build( File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/lyk/anaconda3/envs/mmseg106/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 144, in build_from_cfg raise type(e)( ModuleNotFoundError: class IterBasedTrainLoop in mmengine/runner/loops.py: No module named 'mmseg.datasets.samplers'

Reproduction

  1. What command or script did you run?

python tools/train.py

  1. Did you make any modifications on the code or config? Did you understand what you have modified? 我只是在根据教程配置mmseg。

  2. What dataset did you use? voc2012和ade20都出现这种情况。

Environment

sys.platform: linux Python: 3.8.16 | packaged by conda-forge | (default, Feb 1 2023, 16:01:55) [GCC 11.3.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0,1: NVIDIA GeForce RTX 4090 CUDA_HOME: /usr/local/cuda-11.3 NVCC: Cuda compilation tools, release 11.3, V11.3.109 GCC: gcc (Ubuntu 6.5.0-2ubuntu1~18.04) 6.5.0 20181026 PyTorch: 1.9.0+cu111 PyTorch compiling details: PyTorch built with:

TorchVision: 0.10.0+cu111 OpenCV: 4.7.0 MMEngine: 0.7.4 MMSegmentation: 1.0.0rc6+

mm-assistant[bot] commented 1 year ago

We recommend using English or English & Chinese for issues so that we could have broader discussion.

xiexinch commented 1 year ago

Hi @lyk595, 可以看一下怎么配置的吗?

HePengguang commented 1 year ago

same issue, did you sovle this?

0xrjman commented 1 year ago

I have also encountered the same issue.

My solution was to upgrade mmseg to version 1.1.0 or higher. version <= v1.0.0rc6 image version >= v1.0.0 image