陈军 · 2021年08月24日

【R329开发板评测(二)】vgg16分类网络测试

1. 模型转换

  1. 启动docker镜像

docker run -it --rm --mount type=bind,source=/home/darknet/CM/27_zouyi/AIPU/samples/pb/resnet101pb,target=/tf/src zepan/zhouyi /bin/bash

  1. 写build cfg

vgg_16_build.cfg

[Common]
mode=build

[Parser]
model_name = MobilenetV2
detection_postprocess = 
model_domain = image_classification
output = vgg_16/fc8/squeezed
input_model = pretrained/vgg_16_frozen.pb
input = input
input_shape = [1,224,224,3]
output_dir = ./

[AutoQuantizationTool]
model_name = MobilenetV2
quantize_method = SYMMETRIC
ops_per_channel = DepthwiseConv
calibration_data = ./dataset/dataset1000.npy
calibration_label = ./dataset/label1000.npy
preprocess_mode = normalize
quant_precision=int8
reverse_rgb = False
label_id_offset = 0

[GBuilder]
outputs=./output/vgg_16.bin
target=Z1_0701
  1. 转换模型

aipubuild config/vgg_16_build.cfg

2. 板子实测

  1. 将上面转换好的模型vgg_16.bin上传到板子上/root/zhouyi_test/model
  2. 在R329上编译

    cd /root/zhouyi_test/
    mkdir build && cd build
    cmake ..
    make
  3. 在PC上交叉编译

...

  1. 在板子上实测

    ./zhouyi_cam ./model/vgg_16.bin 1 0
  2. 报错

    [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.

    难道是vgg16模型太大了,对应到代码中,在读模型时报错
    status = AIPU_load_graph_helper(*ctx, file_model, gdesc);

  3. 报错时的内存情况

    root@maixsense:~/zhouyi_test# free -m
                total        used        free      shared  buff/cache   available
    Mem:             238          84          21           0         132         145
    Swap:           1023           1        1022

刚启动时的内存情况

               total        used        free      shared  buff/cache   available
Mem:             238          93          59           0          85         135
Swap:           1023           0        1023
推荐阅读
关注数
7434
内容数
92
人工智能边缘计算软硬件解决方案,提供高性能、低成本、低功耗、易使用的硬件选型方案.
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息