R329 AIPU 实机测试vgg16(失败)
先参考下面这个帖子装好Debian系统。
先生成量化模型
aipubuild config/vgg_16_build.cfg
vgg_16_build.cfg文件内容如下:
[Common]
mode=build
[Parser]
model_name = vgg_16
detection_postprocess =
model_domain = image_classification
output = vgg_16/fc8/squeezed
input_model = ./vgg_16_model/frozen.pb
input = input
input_shape = [1,224,224,3]
[AutoQuantizationTool]
model_name = vgg_16
quantize_method = SYMMETRIC
ops_per_channel = DepthwiseConv
calibration_data = ./preprocess_vgg_16_dataset/dataset.npy
calibration_label = ./preprocess_vgg_16_dataset/label.npy
preprocess_mode = normalize
quant_precision=int8
reverse_rgb = False
label_id_offset = 0
[GBuilder]
outputs=./aipu.bin
profile= True
target=Z1_0701
上传模型到sipeed MaixSensor板子
配网在上面那篇文章里已经有说明了,这里我们直接用ifconfig查看板子ip地址:
root@maixsense:~/zhouyi_test# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 200 (200.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 200 (200.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.6 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::b3c8:37d9:6fa2:fa60 prefixlen 64 scopeid 0x20<link>
ether 38:01:46:2e:85:ca txqueuelen 1000 (Ethernet)
RX packets 105153 bytes 158137500 (150.8 MiB)
RX errors 0 dropped 2542 overruns 0 frame 0
TX packets 41962 bytes 4311511 (4.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在ubuntu pc上用sftp连接板子,put上传到板子
(base) xingxing@xingxing-pc:~/r329/workspace/vgg_16$ sftp root@192.168.3.6
The authenticity of host '192.168.3.6 (192.168.3.6)' can't be established.
ECDSA key fingerprint is SHA256:ULX1SeRw2GpE9KCkq8w+vR9UqdDz8hqY11TBRP9AtPQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
sftp> put vgg_aipu.bin /root/zhouyi_test
Uploading vgg_aipu.bin to /root/zhouyi_test/vgg_aipu.bin
vgg_aipu.bin 100% 132MB 4.8MB/s 00:27
在板子上跑起来
root@maixsense:~/zhouyi_test# ./zhouyi_cam vgg_aipu.bin 1
拉垮了,报错
Zhouyi Cam test program:
Usage:
./zhouyi aipu.bin signed [label_oft]
signed=0, uint8 output; =1, int8 output
real_label_idx = predict_idx-label_oft,
NOTE: default cal with 224x224
LCD width is 240, height is 240
rate is 25.000000
rate is 25.000000
frame_width is 640.000000, frame_height is 480.000000
###L302
[ 4231.484935] armchina 3050000.aipu: [MM] buffer allocation failed for: bytes 0x6200000, page align 1
[DEMO ERROR] AIPU_load_graph_helper: UMD fails in allocating buffers.
[DEMO INFO] AIPU load graph successfully.
[DEMO ERROR] AIPU_alloc_tensor_buffers: Graph ID/descriptor provided is an invalid one has been unloaded or never existed.
###L309
[DEMO ERROR] AIPU_unload_graph: Graph ID/descriptor provided is an invalid one has been unloaded or never existed.
AIPU_alloc_tensor_buffers在申请内存时报错,猜测是不是vgg16模型太大了?
我现在去model zoo里面找个别的模型试试。
试试resnet50.
model zoo去GitHub下载,下载模型需要用FTP客户端。
按照上面的操作将模型上传到板子,执行结果如下: