VisualComputingInstitute / 2D_lidar_person_detection

Person detector for 2D range data. Code release for Self-Supervised Person Detection in 2D Range Data using a Calibrated Camera (https://arxiv.org/abs/2012.08890)
GNU General Public License v3.0
161 stars 35 forks source link

How to run without cuda? #2

Closed lff12940 closed 3 years ago

lff12940 commented 3 years ago

Hi, When I ran this code without CUDA, I encountered many problems. I have solved part of them, but now the problem is as follows and I don't know how to solve it . Because I'm not familiar with Pytorch, Can anyone give some help or provide a better way to run without CUDA? Thanks.

python bin/train.py --cfg ./cfgs/base_dr_spaam_drow_cfg.yaml --ckpt ./ckpts/dr_spaam_e40.pth --evaluation 2020-12-21 16:42:57,517 DEBUG Log directory: /home/liuliu/Documents/dr_spaam/logs/20201221_164257_dr_spaam 2020-12-21 16:42:57,518 DEBUG Backup ./cfgs/base_dr_spaam_drow_cfg.yaml 2020-12-21 16:42:57,519 INFO CUDA_VISIBLE_DEVICES=ALL 2020-12-21 16:42:57,520 DEBUG Pipeline starts. 2020-12-21 16:42:57,556 INFO Load checkpoint ./ckpts/dr_spaam_e40.pth: epoch 40, step 0. 2020-12-21 16:43:19,492 DEBUG Evaluation starts. eval (val): 0%| | 0/3919 [00:00<?, ?it/s]Traceback (most recent call last): File "/home/liuliu/Documents/dr_spaam/bin/train.py", line 90, in run_evaluation(model, pipeline, cfg) File "/home/liuliu/Documents/dr_spaam/bin/train.py", line 40, in run_evaluation pipeline.evaluate(model, val_loader, tb_prefix="VAL") File "/home/liuliu/venvPython/lib/python3.9/site-packages/dr_spaam-1.2.0-py3.9.egg/dr_spaam/pipeline/pipeline.py", line 25, in evaluate File "/home/liuliu/venvPython/lib/python3.9/site-packages/dr_spaam-1.2.0-py3.9.egg/dr_spaam/pipeline/trainer.py", line 41, in evaluate File "/home/liuliu/venvPython/lib/python3.9/site-packages/dr_spaam-1.2.0-py3.9.egg/dr_spaam/model/dr_spaam_fn.py", line 186, in _model_eval_fn File "/home/liuliu/venvPython/lib/python3.9/site-packages/dr_spaam-1.2.0-py3.9.egg/dr_spaam/model/dr_spaam_fn.py", line 72, in _model_fn File "/home/liuliu/venvPython/lib/python3.9/site-packages/torch/cuda/init.py", line 166, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

danjia21 commented 3 years ago

Hi @lff12940 , seems like you did not install pytorch with CUDA, so it is CPU only. I would try reinstall pytorch with CUDA, following the instruction on https://pytorch.org/

To run the code on CPU, set gpu=False on the following line. This though will be much slower. https://github.com/VisualComputingInstitute/2D_lidar_person_detection/blob/master/dr_spaam_ros/src/dr_spaam_ros/dr_spaam_ros.py#L20

lff12940 commented 3 years ago

Hi danjia21, I set gpu=False and the ros package can work normally. I just can't train or evaluate without CUDA using the scripts provided. https://github.com/VisualComputingInstitute/2D_lidar_person_detection/blob/master/dr_spaam/bin/train.py Any suggestion?

danjia21 commented 3 years ago

You can comment out cuda related code in these two files. However, training with CPU will be so slow, such that it is practically impossible. https://github.com/VisualComputingInstitute/2D_lidar_person_detection/blob/master/dr_spaam/bin/train.py https://github.com/VisualComputingInstitute/2D_lidar_person_detection/blob/master/dr_spaam/dr_spaam/model/dr_spaam_fn.py