YOLOv8 project reasoning from CPU to GPU
#YOLOv8 project reasoning from CPU to GPU
YOLOv8 enters the pit and exits the pit, Nvidia graphics cards are available, ATI and other graphics cards can be skipped and swiped away! ! !
Connect YOLOv8 code to debug and run actual combat
1. Run the test
Run E:\AI\yolo\yolov8\ultralytics-main\ultralytics\yolo\v8\detect\predict.py and
the result is as shown in the figure below, using CPU for inference.
2. Check the Pytorch version
Enter the yolov8 virtual environment: conda activate yolov8
check the Pytorch version:pip list
3. Install CUDA
Nvidia graphics cards are available, and other graphics cards such as ATI can be skipped directly! ! !
Check the CUDA version supported by the graphics card: nvidia-smi
My computer graphics card supports CUDA Version up to 11.0,
so I installed CUDA11.0
CUDA download link
Choose according to your operating system, architecture, version, and installation method.
Uninstall all NIVIDIA software while downloading, and then install it again. The specific installation process is too much on the Internet, so I ignored it. But be sure to remember your own installation directory, which will be used below.
After the installation is complete, test the command:nvcc -V
4. Install cuDNN
cuDNN download link
Unzip it, copy the bin, include and lib, and paste it into the CUDA installation directory.
5. Install PyTorch
Go to the PyTorch link
Select the command with +cu
Use the install command
pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
Check the Pytorch version:pip list
##6. Run the test
Run E:\AI\yolo\yolov8\ultralytics-main\ultralytics\yolo\v8\detect\predict.py
is the GPU!
7. View the results
Done! ! !