voldemortX / pytorch-auto-drive

PytorchAutoDrive: Segmentation models (ERFNet, ENet, DeepLab, FCN...) and Lane detection models (SCNN, RESA, LSTR, LaneATT, BézierLaneNet...) based on PyTorch with fast training, visualization, benchmarking & deployment help
BSD 3-Clause "New" or "Revised" License
837 stars 137 forks source link

error when visualizing the lane points (ModuleNotFoundError: No module named 'configs.lane_detection') #84

Closed sjtuljw520 closed 2 years ago

sjtuljw520 commented 2 years ago

when I tried this: python tools/vis/lane_img_dir.py --image-path=test_image/culane --keypoint-path=test_image/culane --image-suffix=.jpg --keypoint-suffix=.lines.txt --save-path=test_image/culane/culane_res --config=configs/lane_detection/bezierlanenet/resnet34_culane_aug1b.py

obtaning this error: Traceback (most recent call last): File "/home/liujianwei/project/opensource/pytorch-auto-drive/tools/vis/lane_img_dir.py", line 72, in cfg = read_config(args.config) File "/home/liujianwei/project/opensource/pytorch-auto-drive/utils/args.py", line 57, in read_config module = SourceFileLoader(module_name, config_path).load_module() File "", line 529, in _check_name_wrapper File "", line 1029, in load_module File "", line 854, in load_module File "", line 274, in _load_module_shim File "", line 711, in _load File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "configs/lane_detection/bezierlanenet/resnet34_culane_aug1b.py", line 2, in from configs.lane_detection.common.datasets.culane_bezier import dataset ModuleNotFoundError: No module named 'configs.lane_detection'

PS: when I run the main_lanedet.py to test, it works.

voldemortX commented 2 years ago

@sjtuljw520 There have been multiple reports of this. But I really don't know why because on my machine things are fine.

https://github.com/voldemortX/pytorch-auto-drive/issues/76#issuecomment-1114438016

sjtuljw520 commented 2 years ago

Thanks for replying. I have solved this by adding this code in the config file: import sys sys.path.append('/home/xxx/xxx/pytorch-auto-drive')

But when I run the "main_lanedet.py", this code should be remove otherwise other error will occur.

voldemortX commented 2 years ago

@sjtuljw520 You can simply use the with context of importmagician. This way the path will only be changed within the with context and not affecting other part of the codes.

voldemortX commented 2 years ago

The main problem should be that ./ is not /home/xxx/xxx/pytorch-auto-drive for reasons unknown.

sjtuljw520 commented 2 years ago

@sjtuljw520 You can simply use the with context of importmagician. This way the path will only be changed within the with context and not affecting other part of the codes.

Thank you. Using the "with' context of importmagician works, but when running the "main_lanedet.py", this code should be remove too, otherwise, error will occur.

voldemortX commented 2 years ago

@sjtuljw520 This should be fixed by #86 . Feel free to test and reopen if the problem persists.