Hailo-8 AI计算卡使用

测试环境:

  • Hailo-8 AI计算卡

  • LKD3588

其他Neardi产品也可参考。

Hailo-8 AI计算卡是一款专门用于边缘计算人工智能应用的加速器模块,最高可提供每秒26兆次的运算(TOPS)能力。

接入Hailo-8算力棒

../../_images/hailo8_lkd3588.png

加入Hailo-8散热片

../../_images/hailo8_lkd3588_heat_dissipation.png

2023/10月后固件版本默认支持hailo8,烧录Neardi-3588最新固件下载与支持找到对应型号,烧录方法请参阅《使用Type-C线升级固件》一章。

查看固件版本:

neardi@LPA3588:~$ cat /etc/os-release | grep BUILD_NAME
BUILD_NAME="LZ160_3588_ubuntu20.04_v1.0_20240205_1439"

人脸识别和人脸属性检测

下载hailo8_ak_rockit

git clone https://gitee.com/ytlans/hailo8_ak_rockit

源码结构如下:

neardi@LPA3588:~/hailo8/hailo8_ak_rockit$ ls -al
total 6036
drwxrwxr-x 5 neardi neardi    4096 Mar  1 06:36 .
drwxrwxr-x 4 neardi neardi    4096 Mar  1 06:36 ..
-rwxrwxr-x 1 neardi neardi 3065744 Mar  1 06:36 ak_rockit_demo
drwxrwxr-x 2 neardi neardi    4096 Mar  1 06:36 ak_rockit_demo_res
drwxrwxr-x 8 neardi neardi    4096 Mar  1 06:36 .git
-rw-rw-r-- 1 neardi neardi   59371 Mar  1 06:36 hailort.log
-rwxrwxr-x 1 neardi neardi   69784 Mar  1 06:36 libgraphic_lsf.so
-rwxrwxr-x 1 neardi neardi 2950456 Mar  1 06:36 librockit.so
drwxrwxr-x 2 neardi neardi    4096 Mar  1 06:36 model
-rw-rw-r-- 1 neardi neardi       0 Mar  1 06:36 README.md
-rwxrwxr-x 1 neardi neardi      43 Mar  1 06:36 run_demo.sh

运行:

neardi@LPA3588:~/hailo8/hailo8_ak_rockit$ ./run_demo.sh 

此demo是对16路1080P@fps30 H265视频流进行分析,成功画面如下:

../../_images/hailo8_rockit_demo_result.png

注意: kill掉demo进程后, 可能会黑屏, 此时需要重新插拔一下HDMI即可恢复。

如何从camera读取视频并分析

下载hailo8_yolo5_demo

git clone https://gitee.com/ytlans/hailo8_yolo5_demo

源码结构如下:

neardi@LPA3588:~/hailo8/hailo8_yolo5_demo$ ls -al
total 6280
drwxrwxr-x 8 neardi neardi    4096 Mar  1 06:42 .
drwxrwxr-x 5 neardi neardi    4096 Mar  1 06:41 ..
drwxrwxr-x 3 neardi neardi    4096 Mar  1 06:42 Apps
drwxrwxr-x 8 neardi neardi    4096 Mar  1 06:42 .git
-rwxrwxr-x 1 neardi neardi    1065 Mar  1 06:42 LICENSE
drwxrwxr-x 4 neardi neardi    4096 Mar  1 06:42 MultiNetworkPipeline
drwxrwxr-x 2 neardi neardi    4096 Mar  1 06:42 Network
-rwxrwxr-x 1 neardi neardi     828 Mar  1 06:42 README.md
-rwxrwxr-x 1 neardi neardi 6387928 Mar  1 06:42 runme.4.14.0
drwxrwxr-x 2 neardi neardi    4096 Mar  1 06:42 SampledData
drwxrwxr-x 5 neardi neardi    4096 Mar  1 06:42 Utils

安装编译环境:

sudo apt update
sudo apt install build-essential cmake

编译:

neardi@LPA3588:~/hailo8/hailo8_yolo5_demo/Apps/yolo$ ./build.sh 
-I- Building aarch64
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
......
[100%] Linking CXX executable runme.4.14.0
[100%] Built target runme.4.14.0

编译成功后,拷贝编译生成的可执行文件到Apps/yolo目录,如下:

neardi@LPA3588:~/hailo8/hailo8_yolo5_demo/Apps/yolo$ cp runme.4.14.0 ../../

在Apps/yolo路径,如下运行demo:

neardi@LPA3588:~/hailo8/hailo8_yolo5_demo/Apps/yolo$ ./runme.4.14.0 -b 1 -n "yolov5s" -v "/dev/video22"

成功画面如下:

../../_images/hailo8_yolov5_demo_result.png

参考链接

注册成功后详细文档如下:

../../_images/hailo8_dev.png