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

Can't pickle local object 'BezierSampler.get_bezier_coefficient.<locals>.<lambda>' #113

Closed Zhuanglong2 closed 1 year ago

Zhuanglong2 commented 1 year ago

In the windows10, I meet the following problem.

D:\Users\409\Anaconda3\envs\pad\python.exe F:/PycharmProjects/pytorch-auto-drive-master/main_landet.py D:\Users\409\Anaconda3\envs\pad\lib\site-packages\torch\package_directory_reader.py:17: UserWarning: Failed to initialize NumPy: No module named 'numpy.core._multiarray_umath' (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.) _dtype_to_storage = {data_type(0).dtype: data_type for data_type in _storages} F:\PycharmProjects\pytorch-auto-drive-master\utils\models\lane_detection\laneatt.py:22: UserWarning: Can't complie line nms op for LaneATT. Set verbose=True for load in /utils/csrc/apis.py L9 for details. Loaded torchvision ImageNet pre-trained weights V1. Not using distributed mode cuda Traceback (most recent call last): File "F:/PycharmProjects/pytorch-auto-drive-master/main_landet.py", line 65, in runner.run() File "F:\PycharmProjects\pytorch-auto-drive-master\utils\runners\lane_det_trainer.py", line 35, in run for i, data in enumerate(self.dataloader, 0): File "D:\Users\409\Anaconda3\envs\pad\lib\site-packages\torch\utils\data\dataloader.py", line 359, in iter return self._get_iterator() File "D:\Users\409\Anaconda3\envs\pad\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_iterator return _MultiProcessingDataLoaderIter(self) File "D:\Users\409\Anaconda3\envs\pad\lib\site-packages\torch\utils\data\dataloader.py", line 918, in init w.start() File "D:\Users\409\Anaconda3\envs\pad\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "D:\Users\409\Anaconda3\envs\pad\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "D:\Users\409\Anaconda3\envs\pad\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "D:\Users\409\Anaconda3\envs\pad\lib\multiprocessing\popen_spawn_win32.py", line 65, in init reduction.dump(process_obj, to_child) File "D:\Users\409\Anaconda3\envs\pad\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'BezierSampler.get_bezier_coefficient..'

voldemortX commented 1 year ago

@Zhuanglong2 Hi! Did you launch a training? can you provide the config file for your model, and some info about your local machine? e.g., CPU, GPU, memory

voldemortX commented 1 year ago

Also, I think your error message includes something about a numpy error? It could be related.

Maybe this can help: https://stackoverflow.com/a/54708388/15449902

Zhuanglong2 commented 1 year ago

@Zhuanglong2你好!你开始培训了吗?你能提供你的模型的配置文件,以及关于你本地机器的一些信息吗?例如,CPU、GPU、内存

Thank you for your responce. I have addressed this problem by setting"numer works = 0".

Zhuanglong2 commented 1 year ago

When i run "lane_video.py", i meet this problem"RuntimeError: input must be contiguous". Then, I debug this code, and i find the problem appears in "flipped = self.proj2_conv(flipped, feature)". This is DCN_V2_Ref.

voldemortX commented 1 year ago

When i run "lane_video.py", i meet this problem"RuntimeError: input must be contiguous". Then, I debug this code, and i find the problem appears in "flipped = self.proj2_conv(flipped, feature)". This is DCN_V2_Ref.

Could you provide the exact command so I can try reproduce this? Usually this kind of problems can be solved by adding .contiguous() in proper places.

Zhuanglong2 commented 1 year ago

Thank you. I just run "lane_video.py" by following the"VISUALIZATION.md", and meet this problem. W[hen i DEBUG, i find that the code stops in "modulated_deform_conv.py".In this part, I find it have not class "apply". QQ图片20220909205722

voldemortX commented 1 year ago

@Zhuanglong2 Could you try changing this line: https://github.com/voldemortX/pytorch-auto-drive/blob/2b0d5ec5f7536c9d2d2b6d8498718a8fca2ab276/utils/datasets/video.py#L28

to:

        images = images[..., [2, 1, 0]].permute(0, 3, 1, 2).contiguous() / 255.0  # BHWC-rgb uint8 -> BCHW-rgb float

In my machine, without this change I can see a harmless warning for mixed memory format. However, with or without this change the code can still run properly.

Zhuanglong2 commented 1 year ago

@Zhuanglong2 Could you try changing this line:

https://github.com/voldemortX/pytorch-auto-drive/blob/2b0d5ec5f7536c9d2d2b6d8498718a8fca2ab276/utils/datasets/video.py#L28

to:

        images = images[..., [2, 1, 0]].permute(0, 3, 1, 2).contiguous() / 255.0  # BHWC-rgb uint8 -> BCHW-rgb float

In my machine, without this change I can see a harmless warning for mixed memory format. However, with or without this change the code can still run properly.

Thank you very much! I have addressed this problem. In fact, my coding environment is windows 10, so i meet some problems. But my friend using Ubuntu has not problems. Your open-source framework works great! Moreover, I have watched your video of this paper, and i am shocked that you are only graduate student! In the future, we will continue lane detection task following your footsteps. In the last, Happy Mid-Autumn Festival!

voldemortX commented 1 year ago

Thanks for your interest in our work! Happy Mid-Autumn Festival!

voldemortX commented 1 year ago

This issue seems to be addressed. I'll close it for now. Feel free to continue commenting for reopen/open a new one.