Requirements
Requirements for Windows, Linux and MacOS
- CMake >= 3.18: https://cmake.org/download/
- Powershell (already installed on windows): https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell
- CUDA >= 10.2: https://developer.nvidia.com/cuda-toolkit-archive (on Linux do Post-installation Actions)
- OpenCV >= 2.4: use your preferred package manager (brew, apt), build from source using vcpkg or download from OpenCV official site (on Windows set system variable OpenCV_DIR = C:\opencv\build – where are the include and x64 folders image)
- cuDNN >= 8.0.2 https://developer.nvidia.com/rdp/cudnn-archive (on Linux follow steps described here https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installlinux-tar , on Windows follow steps described here https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installwindows)
- GPU with CC >= 3.0: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
Install CMake
检查是有安装CMake
cmake --version
Install from APT
sudo apt update
sudo apt install cmake protobuf-compiler
Install from source
Preferred install from source codes rather than snap
sudo apt install build-essential libssl-dev
下载最新的cmake版本:https://cmake.org/download/
cd Downloads
tar -zxvf cmake-x.x.x.tar.gz
cd cmake-x-x-x
sudo ./bootstrap
sudo make
sudo make install
cmake --version
显示如下,即安装成功:
Install CUDA
wget https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux.run
sudo sh cuda_11.5.0_495.29.05_linux.run
Choose CUDA toolkit only, not driver
Add path to ~/.bashrc or ~/.zshrc
# CUDA paths
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
Install cuDNN
Download cudnn from the download page
cd Downloads
tar -xzvf cudnn-11.5-linux-*.tgz
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
Install OpenCV
The easiest way is apt
sudo apt install libopencv-dev python3-opencv