From e221c312b426d4322fe36e784c0b25163c9ee9f3 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 08:21:12 +0000 Subject: [PATCH 1/8] update ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md. Signed-off-by: alex --- ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md index af43eedf1..ef50c66a0 100644 --- a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md @@ -51,11 +51,11 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL For Ascend310: ``` - atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg + atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg --enable_small_channel=1 --enable_compress_weight=true ``` For Ascend310P3: ``` - atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310P3 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg + atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310P3 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg --enable_small_channel=1 --enable_compress_weight=true ``` - Build the program -- Gitee From e71b8842ab4abe85f42098f9f55f40129205fc8e Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 09:24:07 +0000 Subject: [PATCH 2/8] add ACL_TensorFlow/built-in/cv/Vgg16_for_ACL. Signed-off-by: alex --- ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_en.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_en.md diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_en.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_en.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 3d0611c0f7afc4fbaf7970e3557f059b04aad3bd Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 09:25:14 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTensorF?= =?UTF-8?q?low/built-in/cv/Vgg16=5Ffor=5FACL/README=5Fen.md=20=E4=B8=BA=20?= =?UTF-8?q?ACL=5FTensorFlow/built-in/cv/Vgg16=5Ffor=5FACL/README=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/Vgg16_for_ACL/{README_en.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/{README_en.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_en.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_en.md rename to ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md -- Gitee From 013f410c495a714ec464030748cf2c86322e6acb Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 09:25:33 +0000 Subject: [PATCH 4/8] update ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md. Signed-off-by: alex --- .../built-in/cv/Vgg16_for_ACL/README_EN.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md index e69de29bb..ef50c66a0 100644 --- a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md @@ -0,0 +1,97 @@ + + +# Vgg16 Inference for Tensorflow + +This repository provides a script and recipe to Inference the Vgg16 model. + +## Notice +**This sample only provides reference for you to learn the Ascend software stack and is not for commercial purposes.** + +Before starting, please pay attention to the following adaptation conditions. If they do not match, may leading in failure. + +| Conditions | Need | +| --- | --- | +| CANN Version | >=5.0.3 | +| Chip Platform| Ascend310/Ascend310P3 | +| 3rd Party Requirements| Please follow the 'requirements.txt' | + +## Quick Start Guide + +### 1. Clone the respository + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL +``` + +### 2. Download and preprocess the dataset + +1. Download the ImageNet2012 dataset by yourself + + + +### 3. Offline Inference + +**Convert pb to om.** + +- configure the env + + ``` + #Please modify the environment settings as needed + export install_path=/usr/local/Ascend + export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH + export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg:$PYTHONPATH + export LD_LIBRARY_PATH=${install_path}/atc/lib64:${install_path}/acllib/lib64:$LD_LIBRARY_PATH + export ASCEND_OPP_PATH=${install_path}/opp + ``` + +- convert pb to om + + [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/Vgg16_for_ACL.zip) + + For Ascend310: + ``` + atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg --enable_small_channel=1 --enable_compress_weight=true + ``` + For Ascend310P3: + ``` + atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310P3 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg --enable_small_channel=1 --enable_compress_weight=true + ``` + +- Build the program + + For Ascend310: + ``` + unset ASCEND310P3_DVPP + bash build.sh + ``` + For Ascend310P3: + ``` + export ASCEND310P3_DVPP=1 + bash build.sh + ``` + +- Run the program: + + ``` + cd scripts + bash benchmark_tf.sh --batchSize=1 --modelType=vgg16 --imgType=raw --precision=fp16 --outputType=fp32 --useDvpp=1 --deviceId=0 --modelPath=vgg16_tf_aipp.om --dataPath=image-1024 --trueValuePath=val_lable.txt + ``` + + + +## Performance + +### Result + +Our result were obtained by running the applicable inference script. To achieve the same results, follow the steps in the Quick Start Guide. + +#### Inference accuracy results + +| model | SOC | **data** | Top1/Top5 | +| :---------------:|:-------:|:-------: | :-------------: | +| offline Inference| Ascend310 | 50K images | 72.82 %/ 91.24% | +| offline Inference| Ascend310P3 | 50K images | 73.4 %/ 91.7% | + +## Reference +[1] https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/built-in/cv/image_classification/VGG16_ID0068_for_TensorFlow -- Gitee From fadfa4175a2200de900d9e30d7a8fce40ae98660 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 09:35:13 +0000 Subject: [PATCH 5/8] update ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md. Signed-off-by: alex --- .../built-in/cv/Vgg16_for_ACL/README.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md index ef50c66a0..438d09fc8 100644 --- a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md @@ -1,40 +1,40 @@ +中文|[English](README_EN.md) +# Vgg16 TensorFlow离线推理 -# Vgg16 Inference for Tensorflow +此链接提供Vgg16 TensorFlow模型在NPU上离线推理的脚本和方法 -This repository provides a script and recipe to Inference the Vgg16 model. +## 注意 +**此案例仅为您学习Ascend软件堆栈提供参考,不用于商业目的。** -## Notice -**This sample only provides reference for you to learn the Ascend software stack and is not for commercial purposes.** - -Before starting, please pay attention to the following adaptation conditions. If they do not match, may leading in failure. +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 | Conditions | Need | | --- | --- | -| CANN Version | >=5.0.3 | -| Chip Platform| Ascend310/Ascend310P3 | -| 3rd Party Requirements| Please follow the 'requirements.txt' | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | -## Quick Start Guide +## 快速指南 -### 1. Clone the respository +### 1. 拷贝代码 ```shell git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL ``` -### 2. Download and preprocess the dataset +### 2. 下载数据集和预处理 -1. Download the ImageNet2012 dataset by yourself +1. 请自行下载ImageNet2012测试数据集 -### 3. Offline Inference +### 3. 离线推理 -**Convert pb to om.** +**离线模型转换** -- configure the env +- 环境变量设置 ``` #Please modify the environment settings as needed @@ -45,9 +45,9 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL export ASCEND_OPP_PATH=${install_path}/opp ``` -- convert pb to om +- Pb模型转换为om模型 - [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/Vgg16_for_ACL.zip) + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/Vgg16_for_ACL.zip) For Ascend310: ``` @@ -58,7 +58,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL atc --model=vgg16_tf.pb --framework=3 --output=vgg16_tf_aipp --output_type=FP32 --soc_version=Ascend310P3 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=vgg16_tf_aipp.cfg --enable_small_channel=1 --enable_compress_weight=true ``` -- Build the program +- 编译程序 For Ascend310: ``` @@ -71,7 +71,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL bash build.sh ``` -- Run the program: +- 开始运行: ``` cd scripts @@ -80,18 +80,18 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL -## Performance +## 推理结果 -### Result +### 结果 -Our result were obtained by running the applicable inference script. To achieve the same results, follow the steps in the Quick Start Guide. +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速入门指南》中的步骤操作。 -#### Inference accuracy results +#### 推理精度结果 | model | SOC | **data** | Top1/Top5 | | :---------------:|:-------:|:-------: | :-------------: | | offline Inference| Ascend310 | 50K images | 72.82 %/ 91.24% | | offline Inference| Ascend310P3 | 50K images | 73.4 %/ 91.7% | -## Reference +## 参考 [1] https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/built-in/cv/image_classification/VGG16_ID0068_for_TensorFlow -- Gitee From 9b89c8068f5cb942bc5baec7de21140631d50f27 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 10:22:42 +0000 Subject: [PATCH 6/8] update ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md. Signed-off-by: alex --- ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md index ef50c66a0..68971b6d0 100644 --- a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # Vgg16 Inference for Tensorflow -- Gitee From 795d8bad0cd25be072ba3fa345fe466377d78eea Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 11:47:00 +0000 Subject: [PATCH 7/8] update ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md. Signed-off-by: alex --- ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md index 68971b6d0..85cad53db 100644 --- a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README_EN.md @@ -36,14 +36,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL - configure the env - ``` - #Please modify the environment settings as needed - export install_path=/usr/local/Ascend - export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH - export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg:$PYTHONPATH - export LD_LIBRARY_PATH=${install_path}/atc/lib64:${install_path}/acllib/lib64:$LD_LIBRARY_PATH - export ASCEND_OPP_PATH=${install_path}/opp - ``` + Please follow the [guide](https://gitee.com/ascend/ModelZoo-TensorFlow/wikis/02.%E7%A6%BB%E7%BA%BF%E6%8E%A8%E7%90%86%E6%A1%88%E4%BE%8B/Ascend%E5%B9%B3%E5%8F%B0%E6%8E%A8%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE?sort_id=6458719) to set the envs - convert pb to om -- Gitee From 9a29aee9cbc08db57ed287c607f3120d8f079040 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 18 Oct 2022 11:48:01 +0000 Subject: [PATCH 8/8] update ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md. Signed-off-by: alex --- ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md index 438d09fc8..bdbe61a39 100644 --- a/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL/README.md @@ -36,14 +36,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Vgg16_for_ACL - 环境变量设置 - ``` - #Please modify the environment settings as needed - export install_path=/usr/local/Ascend - export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH - export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg:$PYTHONPATH - export LD_LIBRARY_PATH=${install_path}/atc/lib64:${install_path}/acllib/lib64:$LD_LIBRARY_PATH - export ASCEND_OPP_PATH=${install_path}/opp - ``` + 请参考[说明](https://gitee.com/ascend/ModelZoo-TensorFlow/wikis/02.%E7%A6%BB%E7%BA%BF%E6%8E%A8%E7%90%86%E6%A1%88%E4%BE%8B/Ascend%E5%B9%B3%E5%8F%B0%E6%8E%A8%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE?sort_id=6458719),设置环境变量 - Pb模型转换为om模型 -- Gitee