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
- 写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
- 转换模型
aipubuild config/vgg_16_build.cfg
2. 板子实测
- 将上面转换好的模型
vgg_16.bin
上传到板子上/root/zhouyi_test/model
在R329上编译
cd /root/zhouyi_test/ mkdir build && cd build cmake .. make
- 在PC上交叉编译
...
在板子上实测
./zhouyi_cam ./model/vgg_16.bin 1 0
报错
[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);
报错时的内存情况
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