【周易AIPU 仿真】R329 开发板docker下仿真流程

首发极术社区
如对Arm相关技术感兴趣,欢迎私信aijishu20加入技术微信群。

1.模型

测试模型:mobilenet_v1_1.0/mobilenet_v2_1.4/inception_v1
下载地址:
https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models
https://www.tensorflow.org/

2.矫正集的data.npy和label.npy

#以下所有操作docker下运行
sudo docker run -i -t zepan/zhouyi  /bin/bash

将图片和label放到calibration目录下的img路径和label.txt下,

python preprocess_for_dataset.py

我这里使用docker下demo中mobilenet的data.npy与label.npy

链接:https://pan.baidu.com/s/15uhkqp4Opm0ljBRyVPeOpQ 
提取码:z6w1 

3.NN compiler的cfg文件

input节点和output节点需要查看模型结构:https://netron.app/
mobilenet

[Common]
mode = run

[Parser]
model_type = tflite
model_name = mobilenet_v2_1.4
detection_postprocess =
model_domain = image_classification
input_model = ./model/model.tflite
input = input
input_shape = [1, 224, 224, 3]
output = MobilenetV2/Predictions/Reshape_1
output_dir = ./

[AutoQuantizationTool]
quantize_method = SYMMETRIC
quant_precision = int8
ops_per_channel = DepthwiseConv
reverse_rgb = False
label_id_offset =
dataset_name =
detection_postprocess =
anchor_generator =
log = False
calibration_data = ./dataset/dataset.npy
calibration_label = ./dataset/label.npy

[GBuilder]
inputs=./model/input.bin
simulator=aipu_simulator_z1
outputs=mobilenet_v2_1.4.bin
profile= True
target=Z1_0701

inception_v1

[Common]
mode = run

[Parser]
model_type = tflite
model_name = inception_v1
detection_postprocess = 
model_domain = image_classification
input_model = ./model/inception_v1.tflite
input = input
input_shape = [1, 224, 224, 3]
output = InceptionV1/Logits/Predictions/Softmax
output_dir = ./

[AutoQuantizationTool]
quantize_method = SYMMETRIC
quant_precision = int8
ops_per_channel = DepthwiseConv
reverse_rgb = False
label_id_offset = 0
log = False
calibration_data = ./dataset/dataset.npy
calibration_label = ./dataset/label.npy

[GBuilder]
inputs=./model/input.bin
simulator=aipu_simulator_z1
outputs=inceptionV1.bin
profile= True
target=Z1_0701

4.simulator执行的输入输出结果(mobilenet)

#拷贝测试图片 如下图
cp dataset/img/ILSVRC2012_val_00000004.JPEG   ./model/1.jpg

在这里插入图片描述

#生成对应图片的input.bin
cd model
python gen_inputbin.py 
#run
cd ..
./run_sim.sh

在这里插入图片描述

#解析bin
python quant_predict.py

在这里插入图片描述

结论

可能由于校验数据太少,精度还有点问题,几张demo图中就这个碗有点效果;后续更换自己数据模型精度可能会正常。

7.16补充inception_v1结果

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

这模型精度比较正常了。。。换个图再测试下:

相关阅读:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值