PeterH0323 / Smart_Construction

Base on YOLOv5 Head Person Helmet Detection on Construction Sites,基于目标检测工地安全帽和禁入危险区域识别系统,🚀😆附 YOLOv5 训练自己的数据集超详细教程🚀😆2021.3新增可视化界面❗❗
GNU General Public License v3.0
2.2k stars 464 forks source link

pytorch版本问题 #39

Closed RFHzhj closed 3 years ago

RFHzhj commented 3 years ago

您好博主,在进行推理时,使用CPU没问题,使用GPU时会报错,错误如下: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.) return torch._C._cuda_getDeviceCount() > 0 Traceback (most recent call last): File "area_detect.py", line 170, in detect() File "area_detect.py", line 17, in detect device = torch_utils.select_device(opt.device) File "/home/rfh/Smart_Construction-master/utils/torch_utils.py", line 30, in select_device assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device # check availablity AssertionError: CUDA unavailable, invalid device 2 requested

torch==1.5.1,cuda是10.0版本,想问下是什么问题?是pytorch和cuda版本不匹配吗?

PeterH0323 commented 3 years ago

用 conda 安装 cuda toolkit == 10.0

RFHzhj commented 3 years ago

用 conda 安装 cuda toolkit == 10.0

谢谢回复,问题已经解决了

PeterH0323 commented 3 years ago

感谢您的支持,如果本项目帮到您请帮我点个 🌟 , Thx!

omega-leo commented 1 year ago

用 conda 安装 cuda toolkit == 10.0

谢谢回复,问题已经解决了

发生异常: AssertionError
CUDA unavailable, invalid device 0 requested
File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\utils\torch_utils.py", line 30, in select_device
assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device  # check availablity
File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\detect_visual.py", line 54, in load_model
device = torch_utils.select_device(device)
File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\detect_visual.py", line 41, in __init__
self.model, self.half, self.names, self.colors, self.device = self.load_model()
File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\visual_interface.py", line 115, in __init__
self.predict_model = YOLOPredict(weight_path, out_file_path)
File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\visual_interface.py", line 256, in __init__
self.predict_handler_thread = PredictHandlerThread(self.input_player,
File "C:\Users\XX\OneDrive - LMT\桌面\头盔检测\Smart_Construction-master\visual_interface.py", line 471, in <module>
main_window = MainWindow(weight_root, out_file_root, real_time_show_predict)
AssertionError: CUDA unavailable, invalid device 0 requested

我报这个错,已经安装了cudatoolkit=10.2,不知道怎么还是不能用GPU,只能CPU