M4N-DOCK使用yolov5s模型(官方)
配置好基本环境
如果没有连接上网络的,可以看博主写的上一篇怎么连接网络
apt update
apt install build-essential libopencv-dev cmake
apt install wget git vim
apt install python3-pip
cd /root
python3 -m venv ort
source /root/ort/bin/activate
安装以上的后,你电脑上面应该就具备了基本环境
编译源码
git clone https://github.com/AXERA-TECH/ax-samples.git
cd ax-samples
mkdir build && cd build
cmake -DBSP_MSP_DIR=/soc/ -DAXERA_TARGET_CHIP=ax650 ..
make -j6
make install
注意:就是电脑挂了梯子后,共享网络给板子,板子还是不会挂上代理的,所以我自己使用的是在电脑上下载好,然后上传板子,当然也可以下面的方法:
获取免费的加速方式
1、打开 https://ghproxy.com/
2、浏览网页可知,通过在 git 链接前面添加 https://ghproxy.com/,即可进行下载加速,
那么可以将上面代码替换为
git clone https://ghproxy.com/https://github.com/AXERA-TECH/ax-samples.git
cd ax-samples
mkdir build && cd build
cmake -DBSP_MSP_DIR=/soc/ -DAXERA_TARGET_CHIP=ax650 ..
make -j6
make install
编译完成后,生成的可执行示例存放在 ax-samples/build/install/ax650/
路径下:
例如博主的:
下载官方给的转化好的axmodel
在官方给的googl云盘链接的pulsar2-modelzoo中找到下图所框选的yolov5s.axmodel下载放入生成可执行文件同目录下,并准备一张图片如下。
官方给的googl云盘链接
测试结果
输出终端信息:
(ort) root@maixbox:/home/ax-samples/build/install/ax650# ls
ax_classification ax_hrnet ax_pp_humanseg ax_pp_vehicle_attribute ax_rtdetr ax_simcc_pose ax_yolov5s_seg ax_yolov8 yolov5s.axmodel
ax_detr ax_imgproc ax_pp_liteseg_stdc2_cityscapes ax_ppyoloe ax_rtmdet ax_yolo_nas ax_yolov6 ax_yolov8_pose
ax_dinov2 ax_model_info ax_pp_ocr_rec ax_ppyoloe_obj365 ax_scrfd ax_yolov5_face ax_yolov7 ax_yolox
ax_glpdepth ax_pfld ax_pp_person_attribute ax_realesrgan ax_segformer ax_yolov5s ax_yolov7_tiny_face dog.jpg
(ort) root@maixbox:/home/ax-samples/build/install/ax650# ./ax_yolov5s -m yolov5s.axmodel -i dog.jpg
--------------------------------------
model file : yolov5s.axmodel
image file : dog.jpg
img_h, img_w : 640 640
--------------------------------------
WARN,Func(__is_valid_file),NOT find file = '/etc/ax_syslog.conf'
ERROR,Func(__syslog_parma_cfg_get), NOT find = '/etc/ax_syslog.conf'
Engine creating handle is done.
Engine creating context is done.
Engine get io info is done.
Engine alloc io is done.
Engine push input is done.
--------------------------------------
post process cost time:1.87 ms
--------------------------------------
Repeat 1 times, avg time 7.77 ms, max_time 7.77 ms, min_time 7.77 ms
--------------------------------------
detection num: 3
16: 91%, [ 138, 218, 310, 541], dog
2: 69%, [ 470, 76, 690, 173], car
1: 56%, [ 158, 120, 569, 420], bicycle
--------------------------------------
(ort) root@maixbox:/home/ax-samples/build/install/ax650#
后续摸索部署自己的yolov5模型到m4n-dock上