【周易AIPU 仿真】R329 + ubuntu20.04+ docker+ tf_vgg_16

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

提交notion_r329_example


  1. 准备:下载sdk,pull docker, 进入docker
sudo docker pull zepan/zhouyi
sudo docker run -i -t zepan/zhouyi  /bin/bash
  1. 验证docker
cd ~/demos/tflite
./run_sim.sh
python3 quant_predict.py
  1. 下载模型,转换模型
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
tar -xzvf vgg_16_2016_08_28.tar.gz
git clone https://github.com/tensorflow/models.git # dowbload tools 
# Get Graph
python3 ./models/research/slim/export_inference_graph.py \
    --alsologtostderr --model_name=vgg_16 \
    --image_size=224 --labels_offset=0 \
    --output_file=./vgg_16_inf.pb
# Frozen
python3 /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/tools/freeze_graph.py \
 --input_graph=./vgg_16_inf.pb \
 --input_checkpoint=./vgg_16.ckpt \
 --input_binary=true --output_graph=./vgg_16_frozen.pb \
 --output_node_names=vgg_16/fc8/squeezed

4 To meet requirement, use SDK

>>pip3 uninstall AIPUBuilder
>>cd ~/Zhouyi_Compass/AI610-SDK-r0p0-00eac0/AI610-SDK-1003-r0p0-eac0# 
>> source env_setup.sh

work, ignorm the same error in picture!
在这里插入图片描述

  1. gen a config
    • /root/demos/tflite/config/tf_vgg_16_run.cfg
    • example:
[Common]
mode = run

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

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

[GBuilder]
inputs=./tflite/model/input.bin
simulator=./tflite/aipu_simulator_z1
outputs=./output_vgg_16.bin
profile=True
target=Z1_0701
  1. build and run on SDK
>> cd /root/demos/tflite/:
>> aipubuild ./config/tf_vgg_16_run.cfg
  1. Analysis result
>> cd /root/demos/tflite/
>> python3 ./quant_predict.py output_vgg_16.bin

在这里插入图片描述


相关阅读:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值