gpu环境配置:
安装cuda和cudnn
nvidia-smi查看gpu驱动以及支持的最高cuda版本
对应表格中的版本依次安装cuda、cudnn、TensorRT
版本对应表:https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements
cuda:https://developer.nvidia.com/cuda-toolkit-archive
cudnn:https://developer.nvidia.com/rdp/cudnn-archive
TensorRT:https://developer.nvidia.com/tensorrt-download
cuda安装直接使用官网的安装命令安装
参考安装方式:https://blog.csdn.net/h3c4lenovo/article/details/119003405
安装完成后记得配置环境变量
安装cudnn比较简单,只需要把文件复制到指定的目录,授予ar读写权限就可以了
安装tensorrt
https://zhuanlan.zhihu.com/p/392143346
安装cnocr(装新版再替换为旧版)
参考链接:https://cnocr.readthedocs.io/zh/latest/install/
安装命令:pip install cnocr[ort-gpu]
卸载新版onnxruntime:pip uninstall onnxruntime-gpu
安装旧版(指定版本的onnxruntime-gpu):pip install onnxruntime-gpu==1.8
替换为旧版pytorch
历史版本查询下载链接:https://pytorch.org/get-started/previous-versions/
安装过程可能会有版本过老不兼容的情况,根据每个包的发布时间大概推算安装一个,先从pip install cnocr[ort-gpu]==(指定版本)
开始,然后pip install cnstd(指定版本)
然后pip install 自己下载的torch包
这步完成之后就可以运行了,如果运行过程中出现cv2库import异常,需要继续安装opengl库
ubuntu系统不自带opengl库,需要用apt命令安装,参考下面的链接
https://blog.csdn.net/chengde6896383/article/details/88028826
安装编译器与基本库函数:sudo apt-get install build-essential
安装OpenGL Library:sudo apt-get install libgl1-mesa-dev
安装OpenGL Utilities:sudo apt-get install libglu1-mesa-dev
安装OpenGL Utility Toolkit:sudo apt-get install libglut-dev
注意:在这一步的时候,可能会出现以下情况,shell提示:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libglut-dev
将上述sudo apt-get install libglut-dev
命令改成sudo apt-get install freeglut3-dev
即可。
本文由 ice 创作,采用 知识共享署名4.0 国际许可协议进行许可。
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。