From 9f091c785cc1af591fb79156fbad15f2f3470c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:18:24 +0000 Subject: [PATCH 01/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/MobileNetv1=5Ffor=5FACL/README.md=20=E4=B8=BA?= =?UTF-8?q?=20ACL=5FTensorFlow/built-in/cv/MobileNetv1=5Ffor=5FACL/README?= =?UTF-8?q?=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/MobileNetv1_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md -- Gitee From b7f88b5b6b6be9f0b808d57ab75fd756c9639546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:18:34 +0000 Subject: [PATCH 02/52] add ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 49c1f57b3a675e0fd257269b63955536f111b826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:19:05 +0000 Subject: [PATCH 03/52] update ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/MobileNetv1_for_ACL/README_EN.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md index ae4939a2a..4a7e74ad0 100644 --- a/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README_EN.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # MobileNetv1 Inference for Tensorflow @@ -46,13 +46,7 @@ The jpegs pictures will be preprocessed to bin fils. - configure the env - ``` - 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 0fbf726c06abcb5aa3bb683cce14963ddda7c380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:26:35 +0000 Subject: [PATCH 04/52] update ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md index 9b3c6be63..c04940fe1 100644 --- a/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md @@ -28,7 +28,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL 1. 请自行下载ImageNet2012测试数据集, 您可以获得验证图片(50000张JPEG和ILSVRC2012val-label-index.txt) -2. Put JPEGS to **'scripts/ILSVRC2012val'** and label text to **'scripts/'** +2. 将JPEG文件放入'scripts/ILSVRC2012val'目录下 ,将label text 放入 'scripts/'目录下 3. 图片预处理: ``` -- Gitee From e2cbdb767fcb7c5db6cd2ab63029ee223e3ff569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:29:24 +0000 Subject: [PATCH 05/52] update ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md index c04940fe1..2529fb2ee 100644 --- a/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md @@ -36,7 +36,7 @@ cd scripts mkdir input_bins python3 inception_preprocessing.py ./ILSVRC2012val/ ./input_bins/ ``` -jpegs图片将被预处理为bin文件. +jpeg图片将被预处理为bin文件. ### 3. 离线推理 @@ -48,7 +48,7 @@ jpegs图片将被预处理为bin文件. - Pb模型转换为om模型 - [Pb模型链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/Inceptionv3_for_ACL.zip) + [Pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/Inceptionv3_for_ACL.zip) ``` atc --model=inceptionv3_tf.pb --framework=3 --output=inceptionv3_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,299,299,3" --insert_op_conf=inceptionv3_aipp.cfg --enable_small_channel=1 --log=info -- Gitee From a7c2180820b72ea4189918db2ee19caf709e234d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:31:11 +0000 Subject: [PATCH 06/52] update ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/MobileNetv1_for_ACL/README.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md index e69de29bb..96a6db00a 100644 --- a/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL/README.md @@ -0,0 +1,79 @@ +中文|[English](README_EN.md) + +# MobileNetv1 TensorFlow离线推理 + +此链接提供MobileNetv1 TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/MobileNetv1_for_ACL +``` + +### 2. 下载数据集和预处理 + +1. 请自行下载ImageNet2012测试数据集, 您可以获得验证图片(50000张JPEG和ILSVRC2012val-label-index.txt) + +2. 将JPEG文件放入'scripts/ILSVRC2012val'目录下 ,将label text 放入 'scripts/'目录下 +3. 图片预处理: +``` +cd scripts +mkdir input_bins +python3 mobilenetv1_preprocessing.py ./ILSVRC2012val/ ./input_bins/ +``` +jpeg图片将被预处理为bin文件 + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [Pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/MobileNetv1_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + + ``` + atc --model=mobilenetv1_tf.pb --framework=3 --output=mobilenetv1_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=mobilenetv1_tf_aipp.cfg --enable_small_channle=1 + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + +- 开始运行: + + ``` + cd scripts + bash benchmark_tf.sh + ``` + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| model | **data** | Top1/Top5 | +| :---------------: | :-------: | :-------------: | +| offline Inference | 50000 images | 70.9 %/ 89.9% | -- Gitee From 9842678763149fb524dcc95ef75bc2b6d6910b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:31:15 +0000 Subject: [PATCH 07/52] update ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md index 2529fb2ee..a7591867a 100644 --- a/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Inceptionv3_for_ACL/README.md @@ -54,13 +54,13 @@ jpeg图片将被预处理为bin文件. atc --model=inceptionv3_tf.pb --framework=3 --output=inceptionv3_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,299,299,3" --insert_op_conf=inceptionv3_aipp.cfg --enable_small_channel=1 --log=info ``` -- Build the program +- 编译程序 ``` bash build.sh ``` -- Run the program: +- 开始运行: ``` cd scripts -- Gitee From 4d65e88cc6f8b87095f3ddb0f8d15c3b2f70f8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:33:20 +0000 Subject: [PATCH 08/52] update ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/MobileNetv2_for_ACL/README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md index aceca8db4..2b8af4caa 100644 --- a/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # MobileNetv2 Inference for Tensorflow @@ -37,14 +37,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/MobileNetv2_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 88c40d8062ef4d12d10b9f93b3919c36db7408cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:33:37 +0000 Subject: [PATCH 09/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/MobileNetv2=5Ffor=5FACL/README.md=20=E4=B8=BA?= =?UTF-8?q?=20ACL=5FTensorFlow/built-in/cv/MobileNetv2=5Ffor=5FACL/README?= =?UTF-8?q?=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/MobileNetv2_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README_EN.md -- Gitee From ee6ce3b1fea08dbd1bd9af863dbb5aa1918953a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:33:45 +0000 Subject: [PATCH 10/52] add ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From b67a9a8da5c744f85bab94ec2ceee64b54adaa6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:36:59 +0000 Subject: [PATCH 11/52] update ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/MobileNetv2_for_ACL/README.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md index e69de29bb..8a1bb1cb0 100644 --- a/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL/README.md @@ -0,0 +1,87 @@ +中文|[English](README_EN.md) + +# MobileNetv2 TensorFlow离线推理 + +此链接提供MobileNetv2 TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/MobileNetv2_for_ACL +``` + +### 2. Download and preprocess the dataset + +1. 请自行下载ImageNet2012测试数据集 + + + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/MobileNetv2_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + + For Ascend310: + ``` + atc --model=mobilenet_v2_tf.pb --framework=3 --output=mobilenet_v2_tf_aipp --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=mobilenet_v2_tf_aipp.cfg + ``` + For Ascend310P3: + ``` + atc --model=mobilenet_v2_tf.pb --framework=3 --output=mobilenet_v2_tf_aipp --output_type=FP32 --soc_version=Ascend310P3 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=mobilenet_v2_tf_aipp.cfg + ``` + +- 编译程序 + + For Ascend310: + ``` + unset ASCEND310P3_DVPP + bash build.sh + ``` + For Ascend310P3: + ``` + export ASCEND310P3_DVPP=1 + bash build.sh + ``` + +- 开始运行: + + ``` + cd scripts + bash benchmark_tf.sh --batchSize=1 --modelType=mobilenetv2 --imgType=raw --precision=fp16 --outputType=fp32 --useDvpp=1 --deviceId=0 --modelPath=mobilenet_v2_tf_aipp.om --dataPath=image-1024 --trueValuePath=val_lable.txt + ``` + + + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| model | SOC | **data** | Top1/Top5 | +| :---------------:|:-------:|:-------: | :-------------: | +| offline Inference| Ascend310 | 50K images | 71.75 %/ 90.48% | +| offline Inference| Ascend310P3 | 50K images | 72.2 %/ 90.8% | -- Gitee From d8ba5127697622bce2e84cde945090119071887e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:54:48 +0000 Subject: [PATCH 12/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/MobileNetv3=5FLarge=5Ffor=5FACL/README.md=20?= =?UTF-8?q?=E4=B8=BA=20ACL=5FTensorFlow/built-in/cv/MobileNetv3=5FLarge=5F?= =?UTF-8?q?for=5FACL/README=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cv/MobileNetv3_Large_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md -- Gitee From 69056d2d1d6f6a97f5abaab11d56a37f40108bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:54:55 +0000 Subject: [PATCH 13/52] add ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 4ccbf7fa45332e1bac846d90e3cfa148d8ae7f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 01:55:36 +0000 Subject: [PATCH 14/52] update ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md index 2f038f186..527c7be7d 100644 --- a/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README_EN.md @@ -1,3 +1,5 @@ +English|[中文](README.md) + # MOBILENETV3LARGE inference for Tensorflow This repository provides a script and recipe to Inference the @@ -40,13 +42,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL - configure the env - ``` - 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 d80b418b9c7d1e95678a014165e442c55d8db8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:01:54 +0000 Subject: [PATCH 15/52] update ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../cv/MobileNetv3_Large_for_ACL/README.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md index e69de29bb..fcc7485f1 100644 --- a/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL/README.md @@ -0,0 +1,76 @@ +中文|[English](README_EN.md) + +# MOBILENETV3LARGE TensorFlow离线推理 + +此链接提供MOBILENETV3LARGE TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/MobileNetv3_Large_for_ACL +``` + +### 2. 下载数据集和预处理 + +1. 请自行下载ImageNet2012测试数据集 + +2. 执行预处理脚本 + ``` + python3 scripts/mobilenet_data_prepare.py --image_path=Path of the dataset --out_path=Dataset output path + + ``` + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/MobileNetv3_Large_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + + ``` + atc --model=model/mobilenetv3large_tf.pb --framework=3 --output=model/mobilenetv3_large_aipp --output_type=FP32 --insert_op_conf=./mobilenetv3_tensorflow.cfg --input_shape=input:1,224,224,3 --soc_version=Ascend310P3 --fusion_switch_file=./mobilenetv3_fusion_config.json + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + +- 开始运行: + + ``` + bash benchmark_tf.sh --batchSize=1 --outputType=fp32 --modelPath=../../model/mobilenetv3_large_aipp.om --dataPath=../../datasets/imagenet_50000/ --modelType=mobilenetv3_large --imgType=rgb --trueValuePath=../../datasets/input_5w.csv + ``` + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| model | **data** | Top1/Top5 | +| :---------------: | :-------: | :-------------: | +| offline Inference | 50K images | 75.7 %/ 92.8% | + -- Gitee From da90fca82d3899c1f5784ed89d59085ffe8b3a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:12:45 +0000 Subject: [PATCH 16/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/contrib/cv/MTCNN=5Ffor=5FACL/README.md=20=E4=B8=BA=20ACL?= =?UTF-8?q?=5FTensorFlow/contrib/cv/MTCNN=5Ffor=5FACL/README=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contrib/cv/MTCNN_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md rename to ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md -- Gitee From 108eabd322f011036fdb9bc967fa9fdbdd263d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:12:53 +0000 Subject: [PATCH 17/52] add ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md diff --git a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 173622c86ea7ba334ebd1912e5a3daf1421fe26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:13:38 +0000 Subject: [PATCH 18/52] update ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md index 686d9bdd4..c715389be 100644 --- a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md +++ b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README_EN.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # MTCNN Inference for Tensorflow @@ -33,13 +33,7 @@ cd Modelzoo-TensorFlow/ACL/Official/cv/MTCNN_for_ACL - configure the env - ``` - 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:$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 - Build the program -- Gitee From d1d1140917b85a0d377cea7b62665197808e066f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:23:44 +0000 Subject: [PATCH 19/52] update ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../contrib/cv/MTCNN_for_ACL/README.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md index e69de29bb..8819ba9aa 100644 --- a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md +++ b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md @@ -0,0 +1,57 @@ +中文|[English](README_EN.md) + +# MTCNN TensorFlow离线推理 + +此链接提供MTCNN TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL/Official/cv/MTCNN_for_ACL +``` + + +### 2. 离线推理 + + +**Pb模型转换为om模型与推理** + + [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Research/cv/MTCNN_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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),设置环境变量 + +- 编译程序 + + ``` + cd xacl_fmk-master + bash xacl_fmk.sh + ``` + +- 开始运行: + + + ``` + cd .. + python3 acltest.py ompath data_in_om data_out_om Ascend310P3 ./mtc_pnet.pb ./mtc_rnet.pb ./mtc_onet.pb + ``` + 注意: + 默认情况下,“picture”目录中的图像已被推理。如果要替换图像,请替换“picture”目录中的图像。 + + ompath、data_in_om和data_out_om目录将自动创建。 + -- Gitee From 499eb857d6b8f53d1f73fb5109b3a12f0e9bfd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:24:32 +0000 Subject: [PATCH 20/52] update ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md index 8819ba9aa..447b31905 100644 --- a/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md +++ b/ACL_TensorFlow/contrib/cv/MTCNN_for_ACL/README.md @@ -30,7 +30,7 @@ cd Modelzoo-TensorFlow/ACL/Official/cv/MTCNN_for_ACL **Pb模型转换为om模型与推理** - [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Research/cv/MTCNN_for_ACL.zip) + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Research/cv/MTCNN_for_ACL.zip) - 环境变量设置 -- Gitee From 9f1c5a368d2f1335cae018dcd804456886c01373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:37:20 +0000 Subject: [PATCH 21/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/contrib/cv/NIMA=5Ffor=5FACL/README.md=20=E4=B8=BA=20ACL?= =?UTF-8?q?=5FTensorFlow/contrib/cv/NIMA=5Ffor=5FACL/README=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contrib/cv/NIMA_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/contrib/cv/NIMA_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md rename to ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md -- Gitee From 31326e1986b8dc162428607e7b9d6b8b38a0bb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:37:28 +0000 Subject: [PATCH 22/52] add ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md diff --git a/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 4f53be4a2e92a1e443146c0e53bd610e9aee2874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:38:11 +0000 Subject: [PATCH 23/52] update ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md b/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md index a4bfbf962..6da3324ca 100644 --- a/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md +++ b/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README_EN.md @@ -1,3 +1,5 @@ +English|[中文](README.md) + # NIMA Inference for Tensorflow This respository provides a scripts and recipe to Inference of the NIMA model @@ -53,13 +55,7 @@ The pictures will be preprocessed to input_bins files. The lables will be prepro 1.configure the env -``` -export install_path_atc=/usr/local/Ascend -export ASCEND_OPP_PATH=${install_path_atc}/opp -export PATH=/usr/local/python3.7.5/bin:${install_path_atc}/atc/ccec_compiler/bin:${install_path_atc}/atc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin -export PYTHONPATH=${install_path_atc}/atc/python/site-packages/te:${install_path_atc}/atc/python/site-packages/topi:${install_path_atc}/atc/python/site-packages/auto_tune.egg:${install_path_atc}/atc/python/site-packages/schedule_search.egg -export LD_LIBRARY_PATH=${install_path_atc}/acllib/lib64:${install_path_atc}/atc/lib64:${install_path_atc}/toolkit/lib64:${install_path_atc}/add-ons:$LD_LIBRARY_PATH -``` +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 2.convert pb to om -- Gitee From e56ceca98ac13c93a3bbf809b594abaf88c6cf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 02:48:57 +0000 Subject: [PATCH 24/52] update ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../contrib/cv/NIMA_for_ACL/README.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md index e69de29bb..a7a90d253 100644 --- a/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md +++ b/ACL_TensorFlow/contrib/cv/NIMA_for_ACL/README.md @@ -0,0 +1,93 @@ +中文|[English](README_EN.md) + +# NIMA TensorFlow离线推理 +此链接提供NIMA TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + + ``` + git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git + cd Modelzoo-TensorFlow/ACL_TensorFlow/contrib/cv/NIMA_for_ACL + ``` + +### 2. 下载数据集和预处理 + + +1. 请自行下载AVA测试数据集(包含5000张图片和AVA.txt) + +2. 将AVA测试数据集移动到“scripts/AVA_dataset_test”,如下所示: + + ``` + AVA_DATASET_TEST + | + |__image + | |____12315.jpg + | |____12316.jpg + | ..... + |__AVA.txt + + ``` + +3. 图片预处理 + + ``` + cd scripts + mkdir input_bins + python3 data_preprocess.py AVA_DATASET_TEST ./input_bins/ + + ``` +图片将被预处理为input_bins文件。标签将被预处理为predict_txt文件 + +### 3.离线推理 + +1.环境变量设置 + + 请参考[说明](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),设置环境变量 + +2.Pb模型转换为om模型 + +[**pb模型下载链接**](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Research/cv/NIMA_for_ACL.zip) + +``` +atc --model=./nima.pb --framework=3 --output=./nima_1batch_input_fp16_output_fp32 --soc_version=Ascend310 --input_shape="input_1:1,224,224,3" --soc_version=Ascend310 +``` +3.编译程序 +``` +bash build.sh +``` +将在benchmark/output目录下生成可执行文件:**benchmark** + +4.开始运行: +``` +cd scripts +bash benchmark_tf.sh +``` + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 +-------------------------- +| Dataset | Numbers | SSRC | +|-------------------|--------------|---------| +| AVA test dataset | 5000 images | 51.78% | + + +## 参考 +[1] https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/NIMA/NIMA_ID0853_for_TensorFlow -- Gitee From 4f39b5fd463b7e649901176523905d12a36ae284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 03:34:03 +0000 Subject: [PATCH 25/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/OpenPose=5Ffor=5FACL/README.md=20=E4=B8=BA=20?= =?UTF-8?q?ACL=5FTensorFlow/built-in/cv/OpenPose=5Ffor=5FACL/README=5FEN.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/OpenPose_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md -- Gitee From a82e66bc9a0cbf82cca60926d83d72c2323c4936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 03:34:11 +0000 Subject: [PATCH 26/52] add ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 4708827edfeb747611163cd10f724baf6a327091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 03:36:05 +0000 Subject: [PATCH 27/52] update ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/OpenPose_for_ACL/README_EN.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md index ce9d086a1..504346a48 100644 --- a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README_EN.md @@ -1,3 +1,4 @@ +English|[中文](README.md) # # OpenPose Inference for TensorFlow @@ -50,13 +51,8 @@ python3 preprocess.py \ **Convert pb to om.** - configure the env - ``` - 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 eb659517fe6902cff0c8e0e5b9c70e1be421ec0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 06:18:07 +0000 Subject: [PATCH 28/52] update ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/OpenPose_for_ACL/README.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md index e69de29bb..060149be2 100644 --- a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md @@ -0,0 +1,121 @@ +中文|[English](README_EN.md) +# + +# OpenPose TensorFlow离线推理 +此链接提供OpenPose TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL +``` + +### 2. 下载数据集和预处理 + +请自行下载COCO2014测试数据集, 详情见: [dataset](./dataset/coco/README.md) + + +### 3. 获取pb模型 + +获取OpenPose pb模型, 详情见: [models](./models/README.md) + +### 4. 获取处理脚本 + +pafprocess、slidingwindow 下载链接: [tf_openpose](https://github.com/BoomFan/openpose-tf/tree/master/tf_pose) and put them into libs + + +### 5. 离线推理 +**Preprocess the dataset** +```Bash +python3 preprocess.py \ + --resize 656x368 \ + --model cmu \ + --coco-year 2014 \ + --coco-dir ../dataset/coco/ \ + --output-dir ../input/ + +``` + +**Pb模型转换为om模型** +- 环境变量设置 + + 请参考[说明](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模型 + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/OpenPose_for_ACL.zip) + + ``` + atc --framework=3 \ + --model=./models/OpenPose_for_TensorFlow_BatchSize_1.pb \ + --output=./models/OpenPose_for_TensorFlow_BatchSize_1 \ + --soc_version=Ascend310 \ + --input_shape="image:1,368,656,3" + ``` + +**编译程序** +编译推理应用程序, 详情见: [xacl_fmk](./xacl_fmk/README.md) + +**开始运行** +``` +/xacl_fmk -m ./models/OpenPose_for_TensorFlow_BatchSize_1.om \ + -o ./output/openpose \ + -i ./input \ + -b 1 +``` + +**后处理** +``` +python3 postprocess.py \ + --resize 656x368 \ + --resize-out-ratio 8.0 \ + --model cmu \ + --coco-year 2014 \ + --coco-dir ../dataset/coco/ \ + --data-idx 100 \ + --output-dir ../output/openpose +``` + +**样本脚本** +我们还支持使用predict_openpose.sh运行上述所有步骤,**构建程序除外** + +### 6.结果 +*** +OpenPose 推理 : + +| Type | IoU | Area | MaxDets | Result | +| :------- | :------- | :------- | :------- | :------- | +| Average Precision (AP) | 0.50:0.95 | all | 20 | 0.399 | +| Average Precision (AP) | 0.50 | all | 20 | 0.648 | +| Average Precision (AP) | 0.75| all | 20 | 0.400 | +| Average Precision (AP) | 0.50:0.95 | medium | 20 | 0.364 | +| Average Precision (AP) | 0.50:0.95 | large | 20 | 0.443 | +| Average Recall (AR) | 0.50:0.95 | all | 20 | 0.456 | +| Average Recall (AR) | 0.50 | all | 20 | 0.683 | +| Average Recall (AR) | 0.75 | all | 20 | 0.465 | +| Average Recall (AR) | 0.50:0.95 | medium | 20 | 0.371 | +| Average Recall (AR) | 0.50:0.95 | large | 20 | 0.547 | + +*** + +## 参考 + +[1] https://github.com/ildoonet/tf-pose-estimation/tree/master/tf_pose/pafprocess/ + + +# -- Gitee From f07373eae7ad9efbf8b02f77a45efeb09a7248b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 06:19:01 +0000 Subject: [PATCH 29/52] update ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md index 060149be2..e82c4cafe 100644 --- a/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL/README.md @@ -38,7 +38,7 @@ pafprocess、slidingwindow 下载链接: [tf_openpose](https://github.com/BoomFa ### 5. 离线推理 -**Preprocess the dataset** +**数据预处理** ```Bash python3 preprocess.py \ --resize 656x368 \ -- Gitee From be299df76160a8cf31d3da1e510468bc415f0c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 06:46:10 +0000 Subject: [PATCH 30/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/PixelLink=5Ffor=5FACL/README.md=20=E4=B8=BA?= =?UTF-8?q?=20ACL=5FTensorFlow/built-in/cv/PixelLink=5Ffor=5FACL/README=5F?= =?UTF-8?q?EN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/PixelLink_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md -- Gitee From a5972e9fa81222897a82fb0d4dcc2c14cd484457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 06:46:19 +0000 Subject: [PATCH 31/52] add ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 9fa6a9b876110f1fbcd83b72987aab97fe2dd8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 06:49:47 +0000 Subject: [PATCH 32/52] update ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/PixelLink_for_ACL/README_EN.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md index b4c3d0b29..2f0867c5c 100644 --- a/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README_EN.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # PixelLink Inference for Tensorflow @@ -46,13 +46,7 @@ The jpegs pictures will be preprocessed to bin fils. - configure the env - ``` - 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 24951f6be013fa56a1583dda7a4241a5c085bb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 06:54:48 +0000 Subject: [PATCH 33/52] update ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/PixelLink_for_ACL/README.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md index e69de29bb..83aa9bc9f 100644 --- a/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL/README.md @@ -0,0 +1,91 @@ +中文|[English](README_EN.md) + +# PixelLink TensorFlow离线推理 + +此链接提供PixelLink TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/PixelLink_for_ACL +``` + +### 2. 下载预处理和数据集 + +1. 请自行下载Icdar2015测试数据集(包含500张图片) + +2. 将图片放到 'scripts/ch4_test_images'目录下 + +3. 图片预处理: +``` +cd scripts +mkdir input_bins +python3 pixellink_preprocessing.py ./ch4_test_images/ ./input_bins/ +``` +jpeg图片将被预处理为bin文件 + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/PixelLink_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + + ``` + atc --model=pixellink_tf.pb --framework=3 --output=pixellink_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,768,1280,3" --insert_op_conf=pixellink_tf_aipp.json --log=info + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + +- 开始运行: + + ``` + cd scripts + bash benchmark_tf.sh + ``` + +## 性能 + +### 结果 +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| model | **data** | Hmean | +| :---------------: | :-------: | :-------------: | +| offline Inference | 500 images | 82.4% | + -- Gitee From e459a969a19d28847014dd7d0b4ed7ab59f8fe22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:13:44 +0000 Subject: [PATCH 34/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/PSPnet101=5Ffor=5FACL/README.md=20=E4=B8=BA?= =?UTF-8?q?=20ACL=5FTensorFlow/built-in/cv/PSPnet101=5Ffor=5FACL/README=5F?= =?UTF-8?q?EN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/PSPnet101_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md -- Gitee From 3fa8d9bf18a1cda382f2e6a9a61904505ed94455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:13:54 +0000 Subject: [PATCH 35/52] add ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From e2828949e8d8e78c36e7004b75917bbac658a8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:15:07 +0000 Subject: [PATCH 36/52] update ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/PSPnet101_for_ACL/README_EN.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md index 0b47eb286..d0a0426d9 100644 --- a/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README_EN.md @@ -1,3 +1,5 @@ +English|[中文](README.md) + # PSPNet101 inference for Tensorflow This repository provides a script and recipe to Inference the PSPNet101 model. @@ -34,13 +36,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/PSPNet101_for_ACL - configure the env - ``` - 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 cdb6bb23b2b34bf557918b786fc6a4d93ba4f62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:22:50 +0000 Subject: [PATCH 37/52] update ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/PSPnet101_for_ACL/README.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md index e69de29bb..fd0195406 100644 --- a/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/PSPnet101_for_ACL/README.md @@ -0,0 +1,83 @@ +中文|[English](README_EN.md) + +# PSPNet101 TensorFlow离线推理 + +此链接提供PSPNet101 TensorFlow模型在NPU上离线推理的脚本和方法 + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/PSPNet101_for_ACL +``` + +### 2. 下载数据集和预处理 + +1. 请自行下载测试数据集 +2. 执行预处理脚本 + ``` + #无翻转 + python3 scripts/data_processing.py --img_num=500 --crop_width=720 --crop_height=720 --data_dir=../cityscapes --val_list=../cityscapes/list/cityscapes_val_list.txt --output_path=$dataset + ``` + + ``` + #翻转 + python3 scripts/data_processing.py --img_num=500 --crop_width=720 --crop_height=720 --data_dir=../cityscapes --val_list=../cityscapes/list/cityscapes_val_list.txt --output_path=$dataset --flipped_eval --flipped_output_path=$flipped_dataset + ``` + + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/PSPnet101_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + + ``` + atc --model=model/PSPNet101.pb --framework=3 --output=model/pspnet101_1batch --soc_version=Ascend310P3 --input_shape=input_image:1,1024,2048,3 --enable_small_channel=1 --insert_op_conf=pspnet_aipp.cfg + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + +- 开始运行: + + ``` + 无翻转 + bash benchmark_tf.sh --batchSize=1 --outputType=fp32 --modelPath=../../model/pspnet101_1batch.om --dataPath=../../datasets/ --modelType=PSPnet101 --imgType=rgb + ``` + + ``` + 翻转 + bash benchmark_tf.sh --batchSize=1 --outputType=fp32 --modelPath=../../model/pspnet101_1batch.om --dataPath=../../datasets/ --modelType=PSPnet101 --imgType=rgb --flippedDataPath=../../flipped_datasets/ --flippedEval=1 + ``` + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 无翻转推理精度结果 + +| model | **data** | mIoU | +| :---------------: | :-------: | :--------: | +| offline Inference | 500 images | 77% | + + +### 翻转推理精度结果 + +| model | **data** | mIoU | +| :---------------: | :-------: | :--------: | +| offline Inference | 500 images | 77.24% | + -- Gitee From 62a4b05fcd48ee93258594b33e04929fd5ed6bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:36:30 +0000 Subject: [PATCH 38/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/contrib/cv/PWCNet=5Ffor=5FACL/README.md=20=E4=B8=BA=20ACL?= =?UTF-8?q?=5FTensorFlow/contrib/cv/PWCNet=5Ffor=5FACL/README=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contrib/cv/PWCNet_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md rename to ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md -- Gitee From b4d61f291e050b727e91e66a696ff5f18b2cf32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:36:40 +0000 Subject: [PATCH 39/52] add ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md diff --git a/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 0229c3ffd431c859e92895bb9879ecc994ac36b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:37:20 +0000 Subject: [PATCH 40/52] update ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md b/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md index 459c3c130..9f50bed45 100644 --- a/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md +++ b/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README_EN.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # PWCNet Inference for Tensorflow @@ -59,13 +59,7 @@ input_bins - configure the env - ``` - 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:$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 d35d5ac5bdd9cea17a32e04e123043abdf33d13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 07:50:05 +0000 Subject: [PATCH 41/52] update ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../contrib/cv/PWCNet_for_ACL/README.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md index e69de29bb..a28e40f2c 100644 --- a/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md +++ b/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL/README.md @@ -0,0 +1,102 @@ +中文|[English](README_EN.md) + +# PWCNet TensorFlow离线推理 + +此链接提供PWCNet TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/contrib/cv/PWCNet_for_ACL +``` + +### 2. 下载数据集和预处理 +1. 请自行下载MPI Sintel测试数据集遵循[指南](https://github.com/philferriere/tfoptflow) 把预处理好数据集放到**scripts/dataset/MPI-Sintel-complete**目录下 + +2. 测试数据集和标签的预处理: +``` +cd scripts +mkdir input_bins +python3 data_preprocess.py --dataset ./dataset--output ./input_bins +``` +将在**input_bins**目录下生成 **image** 和**gt**目录: +``` +input_bins +| +|__image + |______alley_1-frames_0001_0002.bin + |______alley_1-frames_0002_0003.bin + |______alley_1-frames_0003_0004.bin +... + +| +|__gt + |______alley_1-frames_0001_0002.bin + |______alley_1-frames_0002_0003.bin + |______alley_1-frames_0003_0004.bin +... + +``` + +### 3. 离线推理 + +**Pb模型转换为om模型** + +- 环境变量设置 + + 请参考[说明](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模型 + + [**pb模型下载链接**](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/006_train_backup/PWCNet_tf_wosaisai/offline_infer/pwcnet.pb) + + batchsize=1 + + ``` + atc --model=pwcnet.pb --framework=3 --input_shape="x_tnsr:1,2,448,1024,3" --output=./pwcnet_1batch --soc_version=Ascend310 --log=info + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + An executable file **benchmark** will be generated under the path: **Benchmark/output/** + +- 开始运行: + + ``` + cd scripts + bash benchmark_tf.sh + ``` + + + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| Test Dataset | Number of pictures | EPE | +|--------------|-------------------|-------------------| +| MPI Sintel | 1041 | 1.25 | + +## 参考 +[1] https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/pwcnet/PWCNet_ID0171_for_TensorFlow -- Gitee From 5d1c2c41a4fd405319db83287af119e229a1c2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:08:03 +0000 Subject: [PATCH 42/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/ResCNN=5Ffor=5FACL/README.md=20=E4=B8=BA=20AC?= =?UTF-8?q?L=5FTensorFlow/built-in/cv/ResCNN=5Ffor=5FACL/README=5FEN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/ResCNN_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md -- Gitee From 27ab3403cb137a6547adeeb18d253888731302a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:08:11 +0000 Subject: [PATCH 43/52] add ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From b14735ef4e2f44d4d3eb7eca0c4f937dd19e7bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:09:59 +0000 Subject: [PATCH 44/52] update ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md index 7096fd5d4..06698cb91 100644 --- a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md +++ b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README_EN.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # ResCNN Inference for Tensorflow @@ -47,13 +47,7 @@ mkdir results - configure the env - ``` - 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 Because of the whole test picture will be split to some different sizes,including 64 x 64, 32 x 64, 32 x 44, etc, here,we convert three om files: -- Gitee From 2fe048e6d2ced4336c6c7122513111969eca0806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:16:09 +0000 Subject: [PATCH 45/52] update ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/ResCNN_for_ACL/README.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md index e69de29bb..aa80727c5 100644 --- a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md @@ -0,0 +1,86 @@ +中文|[English](README_EN.md) + +# ResCNN TensorFlow离线推理 + +此链接提供ResCNN TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/ +``` + +### 2. 下载数据集和预处理 + +1. 请自行下载DIV2K测试数据集 + +2. 将100张LR图片放到'./DIV2K_test_100/'目录下作为测试数据. + +3. 创建推理输入和输出目录: +``` +cd scripts +mkdir input_bins +mkdir results +``` + 将保存临时bin文件 + + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/ResCNN_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + 由于整个测试图片将被分割为一些不同的大小,包括64 x 64、32 x 64、32x 44,这里我们转换了三个om文件: + + ``` + atc --model=ResCNN_tf.pb --framework=3 --output=ResCNN_64_64_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,64,64,3" --log=info + atc --model=ResCNN_tf.pb --framework=3 --output=ResCNN_32_64_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,32,64,3" --log=info + atc --model=ResCNN_tf.pb --framework=3 --output=ResCNN_32_44_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,32,44,3" --log=info + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + +- 开始运行: + + ``` + bash benchmark_tf.sh + ``` + +## NPU 性能 +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 +| model | data | mean-PSNR | mean-SSIM| +| :---------------: | :-------: | :-------------: |:-------------:| +| offline Inference | 100 images | 23.748 |0.747| + + +## Reference +[1] https://github.com/payne911/SR-ResCNN-Keras + -- Gitee From 54113ae0bb64c3b6a57fcbe953e1b6826de7bb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:16:53 +0000 Subject: [PATCH 46/52] update ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md index aa80727c5..f24b02d47 100644 --- a/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/ResCNN_for_ACL/README.md @@ -81,6 +81,6 @@ mkdir results | offline Inference | 100 images | 23.748 |0.747| -## Reference +## 参考 [1] https://github.com/payne911/SR-ResCNN-Keras -- Gitee From e003255dd29b6263f51e872123b9d7a3b9c80830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:21:34 +0000 Subject: [PATCH 47/52] update ACL_TensorFlow/contrib/nlp/LSTM_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/contrib/nlp/LSTM_for_ACL/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACL_TensorFlow/contrib/nlp/LSTM_for_ACL/README.md b/ACL_TensorFlow/contrib/nlp/LSTM_for_ACL/README.md index b95fdd00d..e67bd447c 100644 --- a/ACL_TensorFlow/contrib/nlp/LSTM_for_ACL/README.md +++ b/ACL_TensorFlow/contrib/nlp/LSTM_for_ACL/README.md @@ -156,7 +156,7 @@ python3 xnlp_fmk.py \ ``` -**通过pb模型运行推理l** +**通过pb模型运行推理** * --in_nodes, --out_nodes:根据实际情况传参 * 保持其他参数与上一步相同 ```Bash @@ -173,7 +173,7 @@ python3 xnlp_fmk.py \ ``` -## Reference +## 参考 [1] https://arxiv.org/abs/1810.04805 -- Gitee From 224ea3a2b9876e0a677c66760a5c2abe61f59559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:36:37 +0000 Subject: [PATCH 48/52] update ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/Resnet101_for_ACL/README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md index 299f2b513..7bc9b49e4 100644 --- a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md @@ -1,4 +1,4 @@ - +English|[中文](README.md) # ResNet101 Inference for Tensorflow @@ -38,14 +38,7 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet101_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 9d1398962b0859857affec4e70a1e7c540449d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:36:55 +0000 Subject: [PATCH 49/52] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ACL=5FTenso?= =?UTF-8?q?rFlow/built-in/cv/Resnet101=5Ffor=5FACL/README.md=20=E4=B8=BA?= =?UTF-8?q?=20ACL=5FTensorFlow/built-in/cv/Resnet101=5Ffor=5FACL/README=5F?= =?UTF-8?q?EN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../built-in/cv/Resnet101_for_ACL/{README.md => README_EN.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/{README.md => README_EN.md} (100%) diff --git a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README_EN.md similarity index 100% rename from ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md rename to ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README_EN.md -- Gitee From 16ad74c96a4a2e0c0c0f88a544ddb04b4dd528bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:37:13 +0000 Subject: [PATCH 50/52] add ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md diff --git a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md new file mode 100644 index 000000000..e69de29bb -- Gitee From 189d382f2a3d6f6d04855861a1a1eff6badfb630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:42:26 +0000 Subject: [PATCH 51/52] update ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- .../built-in/cv/Resnet101_for_ACL/README.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md index e69de29bb..006243784 100644 --- a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md @@ -0,0 +1,87 @@ +English|[中文](README.md) + +# ResNet101 TensorFlow离线推理 + +此链接提供ResNet101 TensorFlow模型在NPU上离线推理的脚本和方法 + +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL +``` + +### 2. 下载数据集和预处理 + +1. 请自行下载ImageNet2012测试数据集 + + + +### 3. 离线推理 + +**Pb模型转换为om模型** + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/Official/cv/Resnet101_for_ACL.zip) + +- 环境变量设置 + + 请参考[说明](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模型 + + For Ascend310: + ``` + atc --model=resnet101_tf.pb --framework=3 --output=resnet101_tf_aipp --output_type=FP32 --soc_version=Ascend310 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=resnet101_tf_aipp.cfg + ``` + For Ascend310P3: + ``` + atc --model=resnet101_tf.pb --framework=3 --output=resnet101_tf_aipp --output_type=FP32 --soc_version=Ascend310P3 --input_shape="input:1,224,224,3" --log=info --insert_op_conf=resnet101_tf_aipp.cfg + ``` + +- 编译程序 + + For Ascend310: + ``` + unset ASCEND310P3_DVPP + bash build.sh + ``` + For Ascend310P3: + ``` + export ASCEND310P3_DVPP=1 + bash build.sh + ``` + +- 开始运行: + + ``` + cd scripts + bash benchmark_tf.sh --batchSize=1 --modelType=resnet101 --imgType=raw --precision=fp16 --outputType=fp32 --useDvpp=1 --deviceId=0 --modelPath=resnet101_tf_aipp.om --dataPath=image-1024 --trueValuePath=val_lable.txt + ``` + + + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| model | SOC | **data** | Top1/Top5 | +| :---------------:|:-------:|:-------: | :-------------: | +| offline Inference| Ascend310 | 50K images | 78.51 %/ 94.28% | +| offline Inference| Ascend310P3 | 50K images | 78.7 %/ 94.4% | -- Gitee From 8ab2749290b59a97ea3940f74aced44e7a0409b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=86=E4=B8=AD?= <7563702+zhang_lizhong@user.noreply.gitee.com> Date: Thu, 20 Oct 2022 08:42:53 +0000 Subject: [PATCH 52/52] update ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张理中 <7563702+zhang_lizhong@user.noreply.gitee.com> --- ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md index 006243784..6a7a0e168 100644 --- a/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Resnet101_for_ACL/README.md @@ -1,4 +1,4 @@ -English|[中文](README.md) +中文|[English](README_EN.md) # ResNet101 TensorFlow离线推理 -- Gitee