hirotomusiker / CLRerNet

The official implementation of "CLRerNet: Improving Confidence of Lane Detection with LaneIoU"
Apache License 2.0
174 stars 18 forks source link

ImportError #6

Closed sjg918 closed 1 year ago

sjg918 commented 1 year ago

Hi. I am trying without using Docker..... I installed it by entering the command below.

(using python==3.8.17)

pip install torch==1.12.1+cu116 torchvision==0.13.1 torchaudio -f https://download.pytorch.org/whl/torch_stable.html
pip install -U openmim
mim install mmcv-full==1.7.0
pip install mmdet==2.28.0
pip install wandb
pip install tensorboard
pip install albumentations==0.4.6
pip install p_tqdm==1.3.3
pip install pytest
pip install pytest-cov
cd libs/models/layers/nms/
python setup.py install

I successfully installed and entered the command below. python tools/test.py configs/clrernet/culane/clrernet_culane_dla34_ema.py checkpoints/clrernet_culane_dla34_ema.pth

And got the following error message:

_Traceback (most recent call last):
  File "/home/jnu-ie/anaconda3/envs/clrernet/lib/python3.8/site-packages/mmcv/utils/misc.py", line 74, in import_modules_from_strings
    imported_tmp = import_module(imp)
  File "/home/jnu-ie/anaconda3/envs/clrernet/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'libs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/test.py", line 269, in <module>
    main()
  File "tools/test.py", line 142, in main
    cfg = Config.fromfile(args.config)
  File "/home/jnu-ie/anaconda3/envs/clrernet/lib/python3.8/site-packages/mmcv/utils/config.py", line 343, in fromfile
    import_modules_from_strings(**cfg_dict['custom_imports'])
  File "/home/jnu-ie/anaconda3/envs/clrernet/lib/python3.8/site-packages/mmcv/utils/misc.py", line 81, in import_modules_from_strings
    raise ImportError
ImportError_

I commented out custom_imports in clrnet_culane_dla34_ema.py to track down the error. And got the error below:

_Traceback (most recent call last):
  File "tools/test.py", line 269, in <module>
    main()
  File "tools/test.py", line 202, in main
    dataset = build_dataset(cfg.data.test)
  File "/home/jnu-ie/anaconda3/envs/clrernet/lib/python3.8/site-packages/mmdet/datasets/builder.py", line 82, in build_dataset
    dataset = build_from_cfg(cfg, DATASETS, default_args)
  File "/home/jnu-ie/anaconda3/envs/clrernet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 61, in build_from_cfg
    raise KeyError(
KeyError: 'CulaneDataset is not in the dataset registry'_

I think this is a simple import error. how can i solve it?

hirotomusiker commented 1 year ago

You have to add your current directory to PYTHONPATH. One way to do so is to add the following lines at the beginning of tools/test.py.

import sys
sys.path.insert(0, "{your_current_absolute_path}")

Also you can try this:

export PYTHONPATH=$PYTHONPATH:{your_current_absolute_path}
sjg918 commented 1 year ago

Thank you for your answer. I solved the problem !