jetson orin配置yolov8运行环境

发布时间:2024年01月05日

配置yolov8环境

当前jetpack版本为5.1.1,对应的torch为1.14.0版本,torchvision版本为0.14.1,CUDA版本为11.4.315.opencv with cuda 版本4.5.4,tensorrt版本5.1.1。pytorch1.12.0 torchvision0.13.0
具体对应关系查看https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
安装步骤参考:https://blog.csdn.net/xwb_12340/article/details/135107394?spm=1001.2014.3001.5502

1)更新设备

 sudo apt update
 sudo apt install -y python3-pip
 pip3 install --upgrade pip

2)注释掉torch和torchvision,后面单独安装。当前目录为readme目录

cd ./ultralytics
  注释掉requirements.txt中的
  #torch>=1.8.0
  #torchvision>=0.9.0

3)安装依赖库

sudo apt install -y libfreetype6-dev
sudo pip3 install -r requirements.txt -i https://pypi.douban.com/simple

4)安装torch
https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048下载对应的torch文件

sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev
sudo pip3 install torch-1.14.0a0+44dac51c.nv23.02-cp38-cp38-linux_aarch64.whl
  1. 安装torchvision
apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.14.1 https://bgithub.xyz/pytorch/vision.git torchvision
cd torchvision
sudo python3 setup.py install

6)验证torch和torchvision

  >>> import torch
  >>> print(torch.__version__)
  >>> print('CUDA available: ' + str(torch.cuda.is_available()))
  >>> print('cuDNN version: ' + str(torch.backends.cudnn.version()))
  >>> a = torch.cuda.FloatTensor(2).zero_()
  >>> print('Tensor a = ' + str(a))
  >>> b = torch.randn(2).cuda()
  >>> print('Tensor b = ' + str(b))
  >>> c = a + b
  >>> print('Tensor c = ' + str(c))
  pip3 list,有如下信息表示安装torchvision成功
 torchvision                   0.16.1+fdea156
  >>> import torchvision
  >>> print(torchvision.__version__)

7)安装yolov8。当前目录为readme目录
安装onnx:
pip3 install onnx-graphsurgeon -i https://pypi.douban.com/simple

cd ./ultralytics
pip3 install .

测试usb摄像头

yolo predict model=/home/nvidia/ultralytics/yolov8n.pt source=0 show=true
文章来源:https://blog.csdn.net/xwb_12340/article/details/135413452
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。