CAIC-AD / YOLOPv2

YOLOPv2: Better, Faster, Stronger for Panoptic driving Perception
MIT License
544 stars 67 forks source link

RuntimeError: Found no NVIDIA driver #26

Closed Miaoishappening closed 1 year ago

Miaoishappening commented 2 years ago

Hi, i tried python demo.py --source data/example.jpg but i ran into following error:

File "/home/yiwei/dev_ws_ml/src/YOLOPv2/demo.py", line 50, in detect
    model  = torch.jit.load(weights)
  File "/home/yiwei/miniconda3/envs/YOLOPv2/lib/python3.8/site-packages/torch/jit/_serialization.py", line 161, in load
    cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

i only want to try this example image with my cpu and i do not have a GPU installed.

can anyone give me some help?

Itto1992 commented 2 years ago

@Miaoishappening I think you have to specify the device. By default, demo.py uses GPU. https://github.com/CAIC-AD/YOLOPv2/blob/5523b2c45329a0315a410374406bc96e48358f63/demo.py#L24

I succeeded in running the demo on CPU by the following command.

python demo.py --source data/example.jpg --device cpu
Miaoishappening commented 2 years ago

@Itto1992 Hi, Thanks for helping, but the problem remains the same. The output shows device is set to 'cpu'. What torch version do you have? Here is some details of mine, i tried to use python3.7 but result remains the same:

# in YOLOPv2 folder
conda create -n YOLOPv2 python=3.7
pip install -r requirements.txt
python demo.py  --source data/example.jpg --device cpu

my pytorch version is:

>>> import torch
>>> print(torch.__version__)
1.7.0

The output:

Namespace(agnostic_nms=False, classes=None, conf_thres=0.3, device='cpu', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='data/example.jpg', weights='data/weights/yolopv2.pt')
Traceback (most recent call last):
  File "demo.py", line 161, in <module>
    detect()
  File "demo.py", line 50, in detect
    model  = torch.jit.load(weights)
  File "/home/yiwei/miniconda3/envs/YOLOPv2_t/lib/python3.7/site-packages/torch/jit/_serialization.py", line 161, in load
    cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

again the output from pip install -r requirements.txt

Successfully installed MarkupSafe-2.1.1 Pillow-9.2.0 PyYAML-6.0 absl-py-1.2.0 backcall-0.2.0 cachetools-5.2.0 charset-normalizer-2.1.1 cycler-0.11.0 dataclasses-0.6 decorator-5.1.1 fonttools-4.37.4 future-0.18.2 google-auth-2.12.0 google-auth-oauthlib-0.4.6 grpcio-1.49.1 idna-3.4 importlib-metadata-5.0.0 ipython-7.34.0 jedi-0.18.1 kiwisolver-1.4.4 markdown-3.4.1 matplotlib-3.5.3 matplotlib-inline-0.1.6 numpy-1.21.6 oauthlib-3.2.1 opencv-python-4.6.0.66 packaging-21.3 pandas-1.3.5 parso-0.8.3 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.31 protobuf-3.19.6 psutil-5.9.2 ptyprocess-0.7.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pygments-2.13.0 pyparsing-3.0.9 python-dateutil-2.8.2 pytz-2022.4 requests-2.28.1 requests-oauthlib-1.3.1 rsa-4.9 scipy-1.7.3 seaborn-0.12.0 six-1.16.0 tensorboard-2.10.1 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 thop-0.1.1.post2209072238 torch-1.7.0 torchvision-0.8.1 tqdm-4.64.1 traitlets-5.4.0 typing-extensions-4.3.0 urllib3-1.26.12 wcwidth-0.2.5 werkzeug-2.2.2 zipp-3.8.1

If you noticed any different, please tell me. Thx. :D

sgzqc commented 2 years ago

sorry , i have no computer in hand, but i suggest if you want to run the demo.py using cpu, you can try the web demo from this url link .

sgzqc commented 2 years ago

Maybe you can try this: torch.jit.load(buffer, map_location='cpu')

Miaoishappening commented 2 years ago

@sgzqc Hi, Thanks for replying! That really helped.

With this torch.jit.load(weights, map_location='cpu') it works fine.

And i also changed the default --device to "cpu"

the output still warns me, but delivers the result.

Namespace(agnostic_nms=False, classes=None, conf_thres=0.3, device='cpu', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='data/example.jpg', weights='data/weights/yolopv2.pt')
/home/yiwei/miniconda3/envs/YOLOPv2_t/lib/python3.7/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at  /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
  return torch._C._cuda_getDeviceCount() > 0
/home/yiwei/miniconda3/envs/YOLOPv2_t/lib/python3.7/site-packages/torch/nn/functional.py:3063: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
384x640 Done. (1.116s)
 The image with the result is saved in: runs/detect/exp8/example.jpg
inf : (1.1156s/frame)   nms : (0.0020s/frame)
Done. (1.269s)