1. 算法工具链准备
在 这里 下载算法工具链和模型并安装:
pip install tensorrt==10.2.0 protobuf==3.19.6 tensorflow==2.7.0
pip install ai_toolchain/h* -i https://mirrors.aliyun.com/pypi/simple
pip install pycocotools -i https://mirrors.aliyun.com/pypi/simple
tar -xvf ai_toolchain.tar.gz
本文以yolov5s_v2.0/04_detection/03_yolov5s/mapper中的浮点模型 YOLOv5s.onnx 为例进行浮点转换工具链测试。
2. 转换工具&模型检查
检查hb_mapper转换工具是否可用,并运行yolov5s_v2.0/04_detection/03_yolov5s/mapper/01_check.sh-
接下来准备检查数据并进行浮点模型转换,运行
02_preprocess.sh预处理出现以下结果表示处理成功:--
最后运行
03_build.sh,输出以下结果,模型被保存至model_output/yolov5s_672x672_nv12.bin
2024-08-01 12:46:33,005 INFO Convert to runtime bin file sucessfully!
2024-08-01 12:46:33,005 INFO End Model Convert
3.上板测试
转到开发板,使开发板和上位机连接至同一网络并查看IP地址
nmcli device wifi rescan && nmcli device wifi list
sudo wifi_connect <SSID> <PASSWORD>
ifconfig
使用SCP命令或WinSCP软件将yolov5s_672x672_nv12.bin复制到板上的/app/model/basic内替换YOLOv5模型即可,可使用/app/pydev_demo/07_yolov5_sample目录下的程序进行测试

