KV260视觉入门套件smartcamera体验

一、基础环境 硬件:kv260视觉入门套件
摄像头:海康720p usb摄像头(因为部署vitis ai之后懒得poweroff插mipi camera了,直接usb上)
软件:ubuntu 22.04 + vitis ai v3.0
root@kria:~# uname -alinux kria 5.15.0-1020-xilinx-zynqmp #22-ubuntu smp fri feb 2414:14:20 utc 2023 aarch64 aarch64 aarch64 gnu/linuxroot@kria:~# 二、初步体验 vitis ai 3.0的用户手册如下,基本概念和指南很清晰,只需要一步一步照着做即可。
vitis ai — vitis™ ai 3.0 documentation (xilinx.github.io)
先拿smartcam来开刀,展示下具体流程,先apt update/upgrade全部走一遍。
(一)docker安装&配置 vitis ai v3.0通过docker部署,故需要安装&配置docker环境。
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
随后验证安装是否成功:
因为一直root,所以可以忽略docker用户权限。
之后添加国内docker镜像源,否则2.4g的smartcam镜像一晚上根本下不完。
先在/etc/docker/ 目录下增加daemon.json文件,将国内镜像源加进去,文件内容如下:
{ registry-mirrors: [ https://ccr.ccs.tencentyun.com, https://docker.mirrors.ustc.edu.cn, https://hub-mirror.c.163.com, https://mirror.baidubce.com, https://registry.docker-cn.com ]} 之后service docker restart重启docker服务,再docker info检查是否ok,差不多就是下面的样子:
cgroup version: 2 plugins: volume: local network: bridge host ipvlan macvlan null overlay log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog swarm: inactive runtimes: io.containerd.runc.v2 runc default runtime: runc init binary: docker-init containerd version: 8165feabfdfe38c65b599c4993d227328c231fca runc version: v1.1.8-0-g82f18fe init version: de40ad0 security options: apparmor seccomp profile: builtin cgroupns kernel version: 5.15.0-1023-xilinx-zynqmp operating system: ubuntu 22.04.3 lts ostype: linux architecture: aarch64 cpus: 4 total memory: 3.814gib name: kria id: d0241500-7aff-4090-bba3-e961db7c1818 docker root dir: /var/lib/docker debug mode: false experimental: false insecure registries: 127.0.0.0/8 registry mirrors: https://ccr.ccs.tencentyun.com/ https://docker.mirrors.ustc.edu.cn/ https://hub-mirror.c.163.com/ https://mirror.baidubce.com/ https://registry.docker-cn.com/ live restore enabled: false (二)配置vitis ai 先添加xilinx软件包源,通过add-apt-repository ppa:xilinx-apps/ppa和add-apt-repository ppa:ubuntu-xilinx/updates两个cmd设置额外的apt repository。
之后,apt update更新所有package。
root@kria:~/vitis-ai# apt updatehit:1 https://download.docker.com/linux/ubuntu jammy inreleasehit:2 http://ports.ubuntu.com/ubuntu-ports jammy inreleasehit:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates inreleasehit:4 http://oem.archive.canonical.com/updates jammy-limerick inreleasehit:5 https://ppa.launchpadcontent.net/ubuntu-xilinx/sdk/ubuntu jammy inreleasehit:6 http://ports.ubuntu.com/ubuntu-ports jammy-backports inreleasehit:7 http://ports.ubuntu.com/ubuntu-ports jammy-security inreleasehit:8 https://ppa.launchpadcontent.net/ubuntu-xilinx/updates/ubuntu jammy inreleasehit:9 https://ppa.launchpadcontent.net/xilinx-apps/ppa/ubuntu jammy inreleasereading package lists... donebuilding dependency tree... donereading state information... done5 packages can be upgraded. run 'apt list --upgradable' to see them.root@kria:~/vitis-ai# apt upgradereading package lists... donebuilding dependency tree... donereading state information... donecalculating upgrade... doneget more security updates through ubuntu pro with 'esm-apps' enabled: python2.7-minimal libjs-jquery-ui libopenexr25 libavcodec58 libavutil56 libswscale5 libswresample3 libavformat58 python2.7 libpython2.7-minimal libpython2.7-stdliblearn more about ubuntu pro at https://ubuntu.com/prothe following packages have been kept back: gjs libgjs0g libsmbclient libwbclient0 samba-libs0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. 后续,继续apt install xlnx-firmware-kv260-smartcam下载smartcam固件。
root@kria:~/vitis-ai# apt install xlnx-firmware-kv260-smartcamreading package lists... donebuilding dependency tree... donereading state information... donethe following new packages will be installed: xlnx-firmware-kv260-smartcam0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.need to get 2973 kb of archives.after this operation, 7921 kb of additional disk space will be used.get:1 https://ppa.launchpadcontent.net/xilinx-apps/ppa/ubuntu jammy/main arm64 xlnx-firmware-kv260-smartcam arm64 0.9-0xlnx1 [2973 kb]fetched 2973 kb in 4s (727 kb/s)scanning processes...restarting services...ocessor microcode upgrades.package configuration 通过xmutil命令xmutil listapps查看:
active_slot为0的表示正在运行,可以xmutil unloadapp停止掉,这之前还要xmutil desktop_disable禁用桌面,奇怪的是xmutil unloadapp运行后,风扇狂转,按理来说停止服务应该资源消耗变小了,可是fan那么激动做啥?
还有个提醒memory leak的error,有知道的大佬吗?
root@kria:~/vitis-ai# xmutil unloadapp[ 8191.766515] of: error: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/zyxclmm_drm[ 8191.781699] of: error: memory leak before free overlay changeset, /axi/isp_vcap_csi/ports/port@0/endpoint[ 8191.793445] of: error: memory leak, expected refcount 1 instead of -1073741824, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/isp_vcap_csi/ports/port@0/endpoint[ 8191.811821] of: error: memory leak before free overlay changeset, /axi/scaler@b0100000/ports/port@1/endpoint[ 8191.821849] of: error: memory leak, expected refcount 1 instead of -1073741824, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/scaler@b0100000/ports/port@1/endpoint[ 8191.840101] of: error: memory leak before free overlay changeset, /axi/scaler@b0100000/ports/port@0/endpoint[ 8191.850111] of: error: memory leak, expected refcount 1 instead of -1073741824, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/scaler@b0100000/ports/port@0/endpoint[ 8191.868361] of: error: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/scaler@b0100000/ports[ 8191.884328] of: error: memory leak before free overlay changeset, /axi/csiss@80000000/ports/port@1/endpoint[ 8191.894253] of: error: memory leak, expected refcount 1 instead of -1073741824, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/csiss@80000000/ports/port@1/endpoint[ 8191.912406] of: error: memory leak before free overlay changeset, /axi/csiss@80000000/ports/port@0/endpoint[ 8191.922328] of: error: memory leak, expected refcount 1 instead of -1073741824, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/csiss@80000000/ports/port@0/endpoint[ 8191.940542] of: error: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /axi/i2c@80030000/i2c-mux@74/i2c@0/isp@3c/sensors/sensor@0remove from slot 0 returns: 0 (ok) (三)启动docker 先下载xilinx/smartcam的docker img,通过docker pull xilinx/smartcam命令。
root@kria:~/vitis-ai# docker pull xilinx/smartcamusing default tag: latestlatest: pulling from xilinx/smartcam00f50047d606: pull completed7951c234d55: pull complete05265a2d1f35: pull complete90b46a25b424: pull complete80e164c37cc5: pull complete3d8f42a1f194: pull completeb98fe3f03a5b: pull complete59a6d05de11d: pull completec3201d2e9455: pull complete5a86aa1eda97: pull complete1c16e9132328: pull completed5655ba163b7: pull complete3044adb41328: pull completef5dc15e1f4ef: pull completedigest: sha256:da2e52629011aeec332152a0f468d3ff156917dba9b596cf6d0de958d5dc29d7status: downloaded newer image for xilinx/smartcam:latestdocker.io/xilinx/smartcam:latest 用了国内的源,速度就是快,很快就下载完成。再看看imgs:
root@kria:~/vitis-ai# docker imagesrepository tag image id created sizehello-world latest b038788ddb22 4 months ago 9.14kbxilinx/smartcam latest aa0270aef908 11 months ago 1.41gb 通过命令启动xilinx/smartcam镜像,
此时root@xlnx-docker:/# 提示进入docker环境。
三、运行 如文章之初所说,因为部署vitis ai之后懒得poweroff插mipi camera了(直接带电插mipi camera又感觉有风险),那就直接usb camera上吧。
先确定usb camera的名字,通过拔插usb摄像头确定是/dev/media1,为什么不是/dev/video*?一个问号。
root@xlnx-docker:/# ls /dev/media*/dev/media0 /dev/media1 本来想smartcam --usb=1 -w 640 -h 480 --target=dp,接上hdmi显示器后不能显示,貌似显示器不支持这个分辨率,为什么是640x480这个奇葩的分辨率,是因为海康usb摄像头为720p,所以选了个摄像头支持的分辨率。
root@xlnx-docker:/# smartcam --usb=1 -w 640 -h 480 --target=dpresize: mean_r=128.000000resize: mean_g=128.000000resize: mean_b=128.000000resize: scale_r=1.000000resize: scale_g=1.000000resize: scale_b=1.000000[ 9484.157137] zynqmp-display fd4a0000.display: layer width:height must be 640:480[ 9484.187386] zynqmp-display fd4a0000.display: layer width:height must be 640:480[ 9484.202081] zynqmp-display fd4a0000.display: layer width:height must be 640:480[ 9484.224098] zynqmp-display fd4a0000.display: layer width:height must be 640:480[ 9484.264872] zynqmp-display fd4a0000.display: layer width:height must be 640:480 那就rtsp吧,smartcam --usb=1 -w 640 -h 480 --target=rtsp伺候:
root@xlnx-docker:/# smartcam --usb=1 -w 640 -h 480 --target=rtspstream ready at: rtsp://172.17.0.1:554/testrtsp://192.168.99.238:554/test 用支持rtsp的播放器再同一网段内连接,本人头像就不照了,刚好在刷抖音,刷个人脸来看看。
效果不错,最后,来一张合影,基本上各种线缆都接上了。

secure boot相关的基本概念和框架
“有颜在先”,360颜值手机H5将在8月21日进行发布
从工艺制程到客户争夺 台积电和三星新一轮争夺战开打
中国短视频行业进入平稳期,疫情催生更多用户规模
三星将收购网络服务提供商TWS,为了提供更好的5G基础设施
KV260视觉入门套件smartcamera体验
区块链中常见的三种共识机制介绍
日本半导体巨头尔必达拟赋予美光优先谈判权
AP9235B DC-DC升压恒流IC PWM调光芯片 SOT23-6
华捷艾米李骊谈企业在数字经济时代如何助力生态建设
先进制程竞玩家数量的一次大衰退
苹果13pro手机参数配置详情
超长续航的红米4X有何诱惑力,红米4系列手机产品对比
赛车碳纤维零部件3d扫描仪尺寸检测、控制及数字化存档
选择最合适机器视觉照明的八个小技巧
路由器中的WiFi模块有什么作用
杜绝劣质冲牙器!心诺冲牙器为实力之选
兰宝传感以激光高精度测距助力中国智造高端化转型
支持API 9的Sample已上新,速来拿走
厚物科技PXIe控制器PXI控制器PXIe-9150