当前位置:   article > 正文

BM1684X开发板快速上手(快速跑通一个yolov5_pipeline_demo)

bm1684x

1. 运行环境要求

  • Ubuntu20.04,一定是20.04
  • SDK版本:SDK230501
    在这里插入图片描述

2. 上位机x86交叉编译

# 下载官方SDK230501
wget https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/06/15/16/Release_230501-public.zip
unzip Release_230501-public.zip
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu cmake
 
## 创建并指定空的依赖文件夹socsdk
cd Release_230501-public/
mkdir -p soc-sdk
export socsdk=/home/hhhh/Documents/sophon/Release_230501-public/soc-sdk # 需要根据自己的实际绝对路径进行修改
echo $socsdk
 
# ------/Release_230501-public/libsophon_20230605_025400/
cd libsophon_20230605_025400/
tar -zxf libsophon_0.4.8_aarch64.tar.gz
cp -rf libsophon_0.4.8_aarch64/opt/sophon/libsophon-0.4.8/lib ${socsdk}
cp -rf libsophon_0.4.8_aarch64/opt/sophon/libsophon-0.4.8/include ${socsdk}
 
# ------/Release_230501-public/sophon-mw_20230605_032400/
cd ../sophon-mw_20230605_032400/
tar -zxf sophon-mw-soc_0.6.3_aarch64.tar.gz
cp -rf sophon-mw-soc_0.6.3_aarch64/opt/sophon/sophon-ffmpeg_0.6.3/lib/ ${socsdk}
cp -rf sophon-mw-soc_0.6.3_aarch64/opt/sophon/sophon-ffmpeg_0.6.3/include/ ${socsdk}
cp -rf sophon-mw-soc_0.6.3_aarch64/opt/sophon/sophon-opencv_0.6.3/lib ${socsdk}
cp -rf sophon-mw-soc_0.6.3_aarch64/opt/sophon/sophon-opencv_0.6.3/include ${socsdk}
 
# qemu环境的搭建和arm64下依赖的构建 qemu安装依赖的过程中可能会出现问题
# qemu的安装环境  ------/Release_230501-public/rootfs
cd ..
sudo apt-get install -y qemu-user-static debootstrap
#在rootfs文件夹下安装了基于arm64架构的根文件系统
mkdir rootfs && cd rootfs
# qemu中的系统版本为20.04
sudo qemu-debootstrap --arch=arm64 focal .
 
## 进入qemu虚拟环境,以aarch64 架构的模拟环境运行 /bin/bash
sudo chroot . qemu-aarch64-static /bin/bash
 
## 进入qemu 后,安装libeigen3-dev、libgflags-dev、libgoogle-glog-dev、libexiv2-dev
sudo apt-get install -y software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install -y libeigen3-dev libgflags-dev libgoogle-glog-dev libexiv2-dev
## 退出qemu环境
exit
 
# 设置环境变量
export rootfs=/home/hhhh/Documents/sophon/Release_230501-public/rootfs
export socsdk=/home/hhhh/Documents/sophon/Release_230501-public/soc-sdk
 
# 复制并填充依赖文件
## libgoogle-glog-dev
sudo cp -rf ${rootfs}/usr/lib/aarch64-linux-gnu/libglog* ${socsdk}/lib
sudo cp -rf ${rootfs}/usr/include/glog ${socsdk}/include
## libgflags-dev
sudo cp -rf ${rootfs}/usr/lib/aarch64-linux-gnu/libgflags* ${socsdk}/lib
sudo cp -rf ${rootfs}/usr/include/gflags ${socsdk}/include
## libexiv2-dev
sudo cp -rf ${rootfs}/usr/lib/aarch64-linux-gnu/libexiv2* ${socsdk}/lib
sudo cp -rf ${rootfs}/usr/include/exiv2 ${socsdk}/include
## libeigen3-dev
sudo cp -rf ${rootfs}/usr/include/eigen3 ${socsdk}/include
 
# pipeline-demo编译
cd ../sophon-pipeline_20230605_080800/
tar -xzvf sophon-pipeline_v0.3.7_c9b37f7_20230605.tar.gz
 
cd sophon-pipeline_v0.3.7_c9b37f7_20230605/
## 编译代码
./tools/compile.sh soc ${socsdk}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70

3.BM1684x开发板demo运行

3.1 编译好的文件与模型文件准备

更多说明文件路径./Release_230501-public/sophon-pipeline_20230605_080800

需要copy到开发板上:

  1. 将编译好的pipeline-demo release文件:
    ./sophon-ipeline_v0.3.7_c9b37f7_20230605/release.
  2. bmodel:yolov5s_3output_640_int8_4b_BM1684.bmodel
  3. 测试视频的文件:elevator-1080p-25fps-4000kbps.h264

3.2 run_demo(yolov5为例)

修改cameras_yolov5.json
在这里插入图片描述

cd ${SOPHON_PIPELINE_YOLOV5}
# 增加文件权限
chmod +x yolov5s_demo
# ./soc/yolov5s_demo --help 查看命令行帮助信息
# 以arm SoC 1684x yolov5s模型为例。若需要使用       本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/842765
推荐阅读
相关标签